diff --git a/.gitignore b/.gitignore index 3f09e102a..22e7640f4 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ changelog.txt gradle.properties !/mdk/gradle.properties +/projects/forge/rejects/ diff --git a/build.gradle b/build.gradle index 3c0c9643a..f9407032d 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:3.+' + classpath 'net.minecraftforge.gradle:ForgeGradle:3.0.178' classpath 'org.ow2.asm:asm:7.2' classpath 'org.ow2.asm:asm-tree:7.2' } @@ -64,13 +64,16 @@ ext { ] } MAPPING_CHANNEL = 'snapshot' - MAPPING_VERSION = '20200514-1.15.1' - MC_VERSION = '1.15.2' - MCP_VERSION = '20200515.085601' + MAPPING_VERSION = '20200514-1.16' + MC_VERSION = '1.16-rc1' + MCP_VERSION = '20200622.150620' } project(':mcp') { apply plugin: 'net.minecraftforge.gradle.mcp' + repositories { + mavenLocal() + } mcp { config = MC_VERSION + '-' + MCP_VERSION pipeline = 'joined' @@ -84,6 +87,7 @@ project(':clean') { compileJava.sourceCompatibility = compileJava.targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. repositories { + mavenLocal() //mavenCentral() //TODO: Update Gradle to use HTTPS by default maven { name 'maven_central' diff --git a/missedpatches.md b/missedpatches.md new file mode 100644 index 000000000..0ecd18395 --- /dev/null +++ b/missedpatches.md @@ -0,0 +1,693 @@ +## Missed patches + - [x] Apply Patch: net/minecraft/particles/ParticleType.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/tags/Tag.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + Hunk #7 Failed: Cannot find hunk target\ + Hunk #8 Failed: Cannot find hunk target\ + Hunk #9 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/enchantment/EnchantmentHelper.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/tileentity/BeaconTileEntity.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/tileentity/PistonTileEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/tileentity/ConduitTileEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/tileentity/ChestTileEntity.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/tileentity/HopperTileEntity.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/command/arguments/BlockStateParser.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/command/Commands.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/command/impl/LocateCommand.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/inventory/container/Container.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/inventory/container/EnchantmentContainer.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/inventory/container/BeaconContainer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/inventory/container/RepairContainer.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/pathfinding/SwimmerPathNavigator.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/pathfinding/PathNavigator.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/pathfinding/WalkNodeProcessor.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/block/PoweredRailBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/block/PistonBlock.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/block/RedstoneDiodeBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/block/TurtleEggBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/block/BambooBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/block/VineBlock.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/block/StemBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/block/AbstractRailBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/block/NetherWartBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/FlowingFluidBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/FireBlock.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + Hunk #8 Failed: Cannot find hunk target\ + Hunk #9 Failed: Cannot find hunk target\ + Hunk #10 Failed: Cannot find hunk target\ + Hunk #11 Failed: Cannot find hunk target\ + Hunk #12 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/CampfireBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/NoteBlock.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/TNTBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/CocoaBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/ComparatorBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/SugarCaneBlock.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/ShearableDoublePlantBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/CropsBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/StairsBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/Blocks.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/trees/JungleTree.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/BlockState.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/BedBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/EnchantingTableBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/FlowerPotBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/ChorusFlowerBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/CactusBlock.java.patch\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/KelpTopBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/RedstoneWireBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/NetherPortalBlock.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/Block.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + Hunk #7 Failed: Cannot find hunk target\ + Hunk #8 Failed: Cannot find hunk target\ + Hunk #19 Failed: Cannot find hunk target\ + Hunk #20 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/block/SweetBerryBushBlock.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/SharedMonsterAttributes.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/LivingEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #16 Failed: Cannot find hunk target\ + Hunk #23 Failed: Cannot find hunk target\ + Hunk #29 Failed: Cannot find hunk target\ + Hunk #31 Failed: Cannot find hunk target\ + Hunk #34 Failed: Cannot find hunk target\ + Hunk #35 Failed: Cannot find hunk target\ + Hunk #40 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/EntityType.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #9 Failed: Cannot find hunk target\ + Hunk #10 Failed: Cannot find hunk target\ + Hunk #11 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/passive/MooshroomEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/passive/SheepEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/passive/SnowGolemEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/merchant/villager/VillagerEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/merchant/villager/AbstractVillagerEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/projectile/FishingBobberEntity.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/projectile/SmallFireballEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/MobEntity.java.patch\ + Hunk #6 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/player/ServerPlayerEntity.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #12 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/player/PlayerEntity.java.patch\ + Hunk #7 Failed: Cannot find hunk target\ + Hunk #11 Failed: Cannot find hunk target\ + Hunk #16 Failed: Cannot find hunk target\ + Hunk #27 Failed: Cannot find hunk target\ + Hunk #30 Failed: Cannot find hunk target\ + Hunk #31 Failed: Cannot find hunk target\ + Hunk #36 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/Entity.java.patch\ + Hunk #12 Failed: Cannot find hunk target\ + Hunk #13 Failed: Cannot find hunk target\ + Hunk #14 Failed: Cannot find hunk target\ + Hunk #26 Failed: Cannot find hunk target\ + Hunk #29 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/EntityClassification.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/monster/ZombieEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/monster/SlimeEntity.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/monster/EndermanEntity.java.patch\ + Hunk #6 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/item/ItemEntity.java.patch\ + Hunk #11 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #8 Failed: Cannot find hunk target\ + Hunk #9 Failed: Cannot find hunk target\ + Hunk #11 Failed: Cannot find hunk target\ + Hunk #16 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/item/minecart/MinecartCommandBlockEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/item/EnderPearlEntity.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/item/ExperienceOrbEntity.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/item/FireworkRocketEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/server/management/PlayerInteractionManager.java.patch\ + Hunk #6 Failed: Cannot find hunk target\ + Hunk #8 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/server/management/PlayerList.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #11 Failed: Cannot find hunk target\ + Hunk #13 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/server/MinecraftServer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #17 Failed: Cannot find hunk target\ + Hunk #19 Failed: Cannot find hunk target\ + Hunk #22 Failed: Cannot find hunk target\ + Hunk #23 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/server/integrated/IntegratedServer.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/dispenser/IDispenseItemBehavior.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/fluid/IFluidState.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/fluid/LavaFluid.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/potion/PotionBrewing.java.patch\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/network/login/server/SLoginSuccessPacket.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/network/play/server/SJoinGamePacket.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/network/play/server/SRespawnPacket.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/network/play/ServerPlayNetHandler.java.patch\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/WorldInfo.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/SaveHandler.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/loot/LootPool.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/loot/LootTableManager.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/loot/LootParameterSets.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/loot/LootTable.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/loot/LootContext.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/loot/functions/Smelt.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/SaveFormat.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/MapData.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/storage/DimensionSavedDataManager.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/chunk/storage/RegionFileCache.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/chunk/Chunk.java.patch\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #8 Failed: Cannot find hunk target\ + Hunk #18 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/end/DragonFightManager.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/server/ServerMultiWorld.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/server/ServerWorld.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + Hunk #7 Failed: Cannot find hunk target\ + Hunk #9 Failed: Cannot find hunk target\ + Hunk #12 Failed: Cannot find hunk target\ + Hunk #13 Failed: Cannot find hunk target\ + Hunk #18 Failed: Cannot find hunk target\ + Hunk #26 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/server/ChunkHolder.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/IWorld.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/Explosion.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/World.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #8 Failed: Cannot find hunk target\ + Hunk #9 Failed: Cannot find hunk target\ + Hunk #18 Failed: Cannot find hunk target\ + Hunk #19 Failed: Cannot find hunk target\ + Hunk #22 Failed: Cannot find hunk target\ + Hunk #25 Failed: Cannot find hunk target\ + Hunk #26 Failed: Cannot find hunk target\ + Hunk #27 Failed: Cannot find hunk target\ + Hunk #28 Failed: Cannot find hunk target\ + Hunk #29 Failed: Cannot find hunk target\ + Hunk #30 Failed: Cannot find hunk target\ + Hunk #31 Failed: Cannot find hunk target\ + Hunk #32 Failed: Cannot find hunk target\ + Hunk #33 Failed: Cannot find hunk target\ + Hunk #34 Failed: Cannot find hunk target\ + Hunk #35 Failed: Cannot find hunk target\ + Hunk #37 Failed: Cannot find hunk target\ + Hunk #38 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/dimension/Dimension.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/dimension/DimensionType.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/dimension/OverworldDimension.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/dimension/NetherDimension.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/dimension/EndDimension.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/spawner/WorldEntitySpawner.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/biome/Biome.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/biome/provider/BiomeProviderType.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/biome/DefaultBiomeFeatures.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/WorldType.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/world/gen/WorldGenRegion.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/world/gen/NoiseChunkGenerator.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/layer/LayerUtil.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/layer/BiomeLayer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/ChunkGeneratorType.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/structure/Structures.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/MegaJungleFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/OreFeatureConfig.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/SpringFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/FlowersFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/Feature.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/HugeTreesFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/AbstractSmallTreeFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/TreeFeatureConfig.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/ShrubFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/MegaPineTree.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/DungeonsFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/VinesFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/TreeFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/template/Template.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/template/StructureProcessor.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/AcaciaFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/world/gen/feature/IceSpikeFeature.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/advancements/AdvancementManager.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/advancements/AdvancementRewards.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/util/math/shapes/EntitySelectionContext.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/util/Session.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/util/registry/Registry.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/util/ScreenShotHelper.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/MouseHelper.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/Minecraft.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #8 Failed: Cannot find hunk target\ + Hunk #12 Failed: Cannot find hunk target\ + Hunk #14 Failed: Cannot find hunk target\ + Hunk #27 Failed: Cannot find hunk target\ + Hunk #31 Failed: Cannot find hunk target\ + Hunk #34 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/settings/KeyBinding.java.patch\ + Hunk #9 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/audio/SoundEngine.java.patch\ + Hunk #4 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/KeyboardListener.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/network/play/ClientPlayNetHandler.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #11 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/shader/Framebuffer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/shader/ShaderGroup.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/DisplayEffectsScreen.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/widget/Widget.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/widget/list/KeyBindingList.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/IngameGui.java.patch\ + Hunk #4 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + Hunk #7 Failed: Cannot find hunk target\ + Hunk #8 Failed: Cannot find hunk target\ + Hunk #9 Failed: Cannot find hunk target\ + Hunk #10 Failed: Cannot find hunk target\ + Hunk #11 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch\ + Hunk #6 Failed: Cannot find hunk target\ + Hunk #11 Failed: Cannot find hunk target\ + Hunk #12 Failed: Cannot find hunk target\ + Hunk #13 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/screen/MainMenuScreen.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #6 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/screen/ControlsScreen.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/screen/Screen.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/gui/screen/CreateWorldScreen.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/screen/LanguageScreen.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/screen/EnchantmentScreen.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/screen/SleepInMultiplayerScreen.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #7 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/SlotGui.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/gui/overlay/DebugOverlayGui.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/gui/toasts/RecipeToast.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/particle/DiggingParticle.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/particle/ParticleManager.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/resources/ClientResourcePackInfo.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/multiplayer/PlayerController.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #9 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/Matrix3f.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/model/BlockModel.java.patch\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/renderer/model/BakedQuad.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/model/FaceBakery.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/model/ModelBakery.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/BlockRendererDispatcher.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/FogRenderer.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/BlockModelRenderer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch\ + Hunk #8 Failed: Cannot find hunk target\ + Hunk #9 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/renderer/entity/layers/ArmorLayer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/entity/EntityRenderer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/entity/ItemRenderer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/renderer/GameRenderer.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/TransformationMatrix.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #2 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/client/renderer/RenderTypeLookup.java.patch\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/texture/LayeredTexture.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/FirstPersonRenderer.java.patch\ + Hunk #5 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/FluidBlockRenderer.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #4 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/Matrix4f.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/Vector3f.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/WorldRenderer.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/ItemRenderer.java.patch\ + Hunk #3 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/client/renderer/Vector4f.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/resources/IResourcePack.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/resources/ResourcePackInfo.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + Hunk #3 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/resources/ResourcePackList.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/item/crafting/Ingredient.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/item/crafting/RecipeManager.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/item/BowItem.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/item/LilyPadItem.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/item/AxeItem.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/item/PickaxeItem.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/item/FlintAndSteelItem.java.patch\ + Hunk #1 Failed: Cannot find hunk target\ + - [ ] Apply Patch: net/minecraft/item/MinecartItem.java.patch\ + Hunk #2 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/item/BucketItem.java.patch\ + Hunk #4 Failed: Cannot find hunk target\ + Hunk #5 Failed: Cannot find hunk target\ + - [x] Apply Patch: net/minecraft/item/Item.java.patch\ + Hunk #6 Failed: Cannot find hunk target\ + Hunk #8 Failed: Cannot find hunk target\ + Hunk #10 Failed: Cannot find hunk target\ diff --git a/namefails.txt b/namefails.txt new file mode 100644 index 000000000..745b4d435 --- /dev/null +++ b/namefails.txt @@ -0,0 +1,6 @@ +func_239290_a_ +func_233602_m_ should be func_220345_k (getTrackingRange) + +Look into: +func_241212_a_ should be func_225521_a (destroyBlock) +func_241211_a_ should be func_180501_a (setBlockState) \ No newline at end of file diff --git a/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch index 0f5ccce90..6786873fe 100644 --- a/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/platform/GlStateManager.java +++ b/com/mojang/blaze3d/platform/GlStateManager.java -@@ -579,10 +579,17 @@ +@@ -556,10 +556,17 @@ GL13.glClientActiveTexture(p_227747_0_); } diff --git a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch index 0735fd2a7..463522084 100644 --- a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch +++ b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch @@ -1,18 +1,18 @@ --- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java -@@ -64,6 +64,15 @@ - super.tick(); +@@ -63,6 +63,15 @@ + })); } -+ @Override -+ public boolean keyPressed(int key, int scanCode, int modifiers) { -+ if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) { -+ Realms.setScreen(this.field_224228_a); -+ return true; -+ } -+ return super.keyPressed(key, scanCode, modifiers); -+ } ++ @Override ++ public boolean func_231046_a_(int key, int scanCode, int modifiers) { ++ if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) { ++ field_230706_i_.func_147108_a(this.field_224228_a); ++ return true; ++ } ++ return super.func_231046_a_(key, scanCode, modifiers); ++ } + - public void render(int p_render_1_, int p_render_2_, float p_render_3_) { - this.renderBackground(); - this.drawCenteredString(this.field_224229_b, this.width() / 2, 80, 16777215); + public void func_230430_a_(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) { + this.func_230446_a_(p_230430_1_); + this.func_238472_a_(p_230430_1_, this.field_230712_o_, this.field_224229_b, this.field_230708_k_ / 2, 80, 16777215); diff --git a/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch b/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch index 0f1ac1daf..d51a334b5 100644 --- a/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch +++ b/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch @@ -1,14 +1,17 @@ --- a/net/minecraft/advancements/PlayerAdvancements.java +++ b/net/minecraft/advancements/PlayerAdvancements.java -@@ -154,6 +154,7 @@ +@@ -159,6 +159,10 @@ } - this.func_192748_e(); -+ if (net.minecraftforge.common.ForgeConfig.SERVER.fixAdvancementLoading.get()) net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.field_192759_g, this.field_192760_h, this.field_192758_f, this.field_192761_i, this::func_192738_c); else + this.func_240920_c_(p_240921_1_); ++ ++ if (net.minecraftforge.common.ForgeConfig.SERVER.fixAdvancementLoading.get()) ++ net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.field_192759_g, this.field_192760_h, this.field_192758_f, this.field_192761_i, this::func_192738_c); ++ else this.func_192752_d(); - this.func_192751_c(); + this.func_240919_b_(p_240921_1_); } -@@ -187,6 +188,8 @@ +@@ -192,6 +196,8 @@ } public boolean func_192750_a(Advancement p_192750_1_, String p_192750_2_) { @@ -17,9 +20,9 @@ boolean flag = false; AdvancementProgress advancementprogress = this.func_192747_a(p_192750_1_); boolean flag1 = advancementprogress.func_192105_a(); -@@ -199,6 +202,7 @@ +@@ -204,6 +210,7 @@ if (p_192750_1_.func_192068_c() != null && p_192750_1_.func_192068_c().func_193220_i() && this.field_192762_j.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223620_w)) { - this.field_192756_d.func_184103_al().func_148539_a(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j())); + this.field_240917_e_.func_232641_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()), ChatType.SYSTEM, Util.field_240973_b_); } + 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 f9b2a3da6..551c0f8f7 100644 --- a/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch +++ b/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch @@ -8,7 +8,7 @@ + private static final Map> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates); public static final ItemPredicate field_192495_a = new ItemPredicate(); @Nullable - private final Tag field_200018_b; + private final ITag field_200018_b; @@ -105,6 +107,11 @@ public static ItemPredicate func_192492_a(@Nullable JsonElement p_192492_0_) { if (p_192492_0_ != null && !p_192492_0_.isJsonNull()) { diff --git a/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch b/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch new file mode 100644 index 000000000..100974cf5 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch @@ -0,0 +1,85 @@ +--- a/net/minecraft/block/AbstractBlock.java ++++ b/net/minecraft/block/AbstractBlock.java +@@ -59,7 +59,8 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public abstract class AbstractBlock { ++//TODO, Delegates are weird here now, because Block extends this. ++public abstract class AbstractBlock extends net.minecraftforge.registries.ForgeRegistryEntry { + protected static final Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP}; + protected final Material field_149764_J; + protected final boolean field_235688_at_; +@@ -71,6 +72,7 @@ + protected final float field_226887_g_; + protected final boolean field_208621_p; + protected final AbstractBlock.Properties field_235684_aB_; ++ + @Nullable + protected ResourceLocation field_220085_g; + +@@ -86,6 +88,8 @@ + this.field_226887_g_ = p_i241196_1_.field_226894_k_; + this.field_208621_p = p_i241196_1_.field_208772_j; + this.field_235684_aB_ = p_i241196_1_; ++ final ResourceLocation lootTableCache = p_i241196_1_.field_222381_j; ++ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i241196_1_.lootTableSupplier != null ? p_i241196_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().func_110624_b(), "blocks/" + this.getRegistryName().func_110623_a()); + } + + @Deprecated +@@ -128,7 +132,7 @@ + + @Deprecated + public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) { +- if (this.func_235695_q_() && !p_196243_1_.func_203425_a(p_196243_4_.func_177230_c())) { ++ if (this.func_235695_q_() && (p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c() || !p_196243_4_.hasTileEntity())) { + p_196243_2_.func_175713_t(p_196243_3_); + } + +@@ -190,7 +194,7 @@ + + @Deprecated + 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 +@@ -293,7 +297,7 @@ + if (f == -1.0F) { + return 0.0F; + } else { +- int i = p_180647_2_.func_234569_d_(p_180647_1_) ? 30 : 100; ++ int i = net.minecraftforge.common.ForgeHooks.canHarvestBlock(p_180647_1_, p_180647_2_, p_180647_3_, p_180647_4_) ? 30 : 100; + return p_180647_2_.func_184813_a(p_180647_1_) / f / (float)i; + } + } +@@ -326,8 +330,7 @@ + + public final ResourceLocation func_220068_i() { + if (this.field_220085_g == null) { +- ResourceLocation resourcelocation = Registry.field_212618_g.func_177774_c(this.func_230328_p_()); +- this.field_220085_g = new ResourceLocation(resourcelocation.func_110624_b(), "blocks/" + resourcelocation.func_110623_a()); ++ this.field_220085_g = this.lootTableSupplier.get(); + } + + return this.field_220085_g; +@@ -345,6 +348,10 @@ + return this.field_235684_aB_.field_235800_b_.apply(this.func_230328_p_().func_176223_P()); + } + ++ /* ======================================== FORGE START ===================================== */ ++ private final java.util.function.Supplier lootTableSupplier; ++ /* ========================================= FORGE END ====================================== */ ++ + public abstract static class AbstractBlockState extends StateHolder { + private final int field_215708_d; + private final boolean field_215709_e; +@@ -786,6 +793,7 @@ + private ResourceLocation field_222381_j; + private boolean field_226895_m_ = true; + private boolean field_235813_o_; ++ private java.util.function.Supplier lootTableSupplier; + private AbstractBlock.IExtendedPositionPredicate> field_235814_p_ = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> { + return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.func_185906_d() < 14; + }; diff --git a/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch b/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch index 746bbfbe3..575c20163 100644 --- a/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch @@ -1,24 +1,32 @@ --- a/net/minecraft/block/AbstractRailBlock.java +++ b/net/minecraft/block/AbstractRailBlock.java -@@ -36,7 +36,7 @@ - } +@@ -13,7 +13,7 @@ + import net.minecraft.world.IWorldReader; + import net.minecraft.world.World; + +-public abstract class AbstractRailBlock extends Block { ++public abstract class AbstractRailBlock extends Block implements net.minecraftforge.common.extensions.IAbstractRailBlock { + protected static final VoxelShape field_185590_a = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D); + protected static final VoxelShape field_190959_b = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D); + private final boolean field_196277_c; +@@ -37,6 +37,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; + RailShape railshape = p_220053_1_.func_203425_a(this) ? p_220053_1_.func_177229_b(this.func_176560_l()) : null; ++ RailShape railShape2 = 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; } -@@ -56,7 +56,7 @@ +@@ -61,7 +62,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 @@ + if (func_235328_a_(p_220069_3_, p_220069_2_, railshape) && !p_220069_2_.func_175623_d(p_220069_3_)) { + if (!p_220069_6_) { + func_220075_c(p_220069_1_, p_220069_2_, p_220069_3_); +@@ -113,7 +114,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_); @@ -27,70 +35,24 @@ p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this); } -@@ -134,5 +134,66 @@ +@@ -132,5 +133,20 @@ return blockstate.func_206870_a(this.func_176560_l(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH); } -+ //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability - public abstract IProperty func_176560_l(); ++ @Deprecated //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability + public abstract Property 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. -+ */ ++ ++ @Override + public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos) + { -+ return !this.field_196277_c; ++ 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. -+ */ ++ @Override + 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()); ++ 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) { } ++ /* ========================================= FORGE END ======================================*/ } diff --git a/patches/minecraft/net/minecraft/block/BambooBlock.java.patch b/patches/minecraft/net/minecraft/block/BambooBlock.java.patch index f0d418982..ee4b91c7b 100644 --- a/patches/minecraft/net/minecraft/block/BambooBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/BambooBlock.java.patch @@ -1,16 +1,13 @@ --- a/net/minecraft/block/BambooBlock.java +++ b/net/minecraft/block/BambooBlock.java -@@ -91,10 +91,11 @@ - if (!p_225534_1_.func_196955_c(p_225534_2_, p_225534_3_)) { - p_225534_2_.func_175655_b(p_225534_3_, true); - } else if (p_225534_1_.func_177229_b(field_220266_f) == 0) { -- if (p_225534_4_.nextInt(3) == 0 && p_225534_2_.func_175623_d(p_225534_3_.func_177984_a()) && p_225534_2_.func_226659_b_(p_225534_3_.func_177984_a(), 0) >= 9) { -+ if (true) { - int i = this.func_220260_b(p_225534_2_, p_225534_3_) + 1; +@@ -101,8 +101,9 @@ + if (p_225542_1_.func_177229_b(field_220266_f) == 0) { + if (p_225542_4_.nextInt(3) == 0 && p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) { + int i = this.func_220260_b(p_225542_2_, p_225542_3_) + 1; - if (i < 16) { -+ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_4_.nextInt(3) == 0 && p_225534_2_.func_175623_d(p_225534_3_.func_177984_a()) && p_225534_2_.func_226659_b_(p_225534_3_.func_177984_a(), 0) >= 9)) { - this.func_220258_a(p_225534_1_, p_225534_2_, p_225534_3_, p_225534_4_, i); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); ++ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(3) == 0 && p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9)) { + this.func_220258_a(p_225542_1_, p_225542_2_, p_225542_3_, p_225542_4_, i); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); } } diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 16179bef2..bd9698c75 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -1,134 +1,51 @@ --- a/net/minecraft/block/Block.java +++ b/net/minecraft/block/Block.java -@@ -75,9 +75,10 @@ +@@ -52,8 +52,9 @@ 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 { +-public class Block extends AbstractBlock implements IItemProvider { ++public class Block extends AbstractBlock implements IItemProvider, net.minecraftforge.common.extensions.IForgeBlock { protected static final Logger field_196273_d = LogManager.getLogger(); -- public static final ObjectIntIdentityMap 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 Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP}; + public static final ObjectIntIdentityMap field_176229_d = new ObjectIntIdentityMap<>(); private static final LoadingCache field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader() { public Boolean load(VoxelShape p_load_1_) { -@@ -151,7 +152,7 @@ - - @Deprecated - public boolean func_220067_a(BlockState p_220067_1_, IBlockReader p_220067_2_, BlockPos p_220067_3_, EntityType p_220067_4_) { -- return p_220067_1_.func_224755_d(p_220067_2_, p_220067_3_, Direction.UP) && this.field_149784_t < 14; -+ return p_220067_1_.func_224755_d(p_220067_2_, p_220067_3_, Direction.UP) && p_220067_1_.getLightValue(p_220067_2_, p_220067_3_) < 14; - } - - @Deprecated -@@ -246,6 +247,10 @@ - this.field_149781_w = p_i48440_1_.field_200958_f; - this.field_149782_v = p_i48440_1_.field_200959_g; - this.field_149789_z = p_i48440_1_.field_200960_h; -+ this.harvestLevel = p_i48440_1_.harvestLevel; -+ this.harvestTool = p_i48440_1_.harvestTool; -+ final ResourceLocation lootTableCache = p_i48440_1_.field_222381_j; -+ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i48440_1_.lootTableSupplier != null ? p_i48440_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().func_110624_b(), "blocks/" + this.getRegistryName().func_110623_a()); - this.field_149765_K = p_i48440_1_.field_200961_i; - this.field_226886_f_ = p_i48440_1_.field_226893_j_; - this.field_226887_g_ = p_i48440_1_.field_226894_k_; -@@ -297,7 +302,7 @@ - - @Deprecated - 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 -@@ -314,8 +319,9 @@ - return this.field_149789_z; - } - -+ @Deprecated //Forge: New State sensitive version. - public boolean func_149716_u() { -- return this instanceof ITileEntityProvider; -+ return hasTileEntity(func_176223_P()); - } - - @Deprecated -@@ -471,10 +477,9 @@ - - @Deprecated - public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) { -- if (this.func_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_4_.hasTileEntity())) { - p_196243_2_.func_175713_t(p_196243_3_); - } -- - } - - @Deprecated -@@ -483,8 +488,8 @@ - if (f == -1.0F) { - return 0.0F; - } else { -- int i = p_180647_2_.func_184823_b(p_180647_1_) ? 30 : 100; -- return p_180647_2_.func_184813_a(p_180647_1_) / f / (float)i; -+ int i = net.minecraftforge.common.ForgeHooks.canHarvestBlock(p_180647_1_, p_180647_2_, p_180647_3_, p_180647_4_) ? 30 : 100; -+ return p_180647_2_.getDigSpeed(p_180647_1_, p_180647_4_) / f / (float)i; - } - } - -@@ -494,8 +499,7 @@ - - public ResourceLocation func_220068_i() { - if (this.field_220085_g == null) { -- ResourceLocation resourcelocation = Registry.field_212618_g.func_177774_c(this); -- this.field_220085_g = new ResourceLocation(resourcelocation.func_110624_b(), "blocks/" + resourcelocation.func_110623_a()); -+ this.field_220085_g = this.lootTableSupplier.get(); - } - - return this.field_220085_g; -@@ -555,7 +559,7 @@ +@@ -270,7 +271,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_223586_b(GameRules.field_223603_f)) { -+ if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180635_0_.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe ++ if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_223586_b(GameRules.field_223603_f) && p_180635_0_.restoringBlockSnapshots) { 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; -@@ -567,7 +571,7 @@ +@@ -282,7 +283,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_223586_b(GameRules.field_223603_f)) { -+ if (!p_180637_1_.field_72995_K && p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180637_1_.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe ++ if (!p_180637_1_.field_72995_K && p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f) && p_180637_1_.restoringBlockSnapshots) { while(p_180637_3_ > 0) { int i = ExperienceOrbEntity.func_70527_a(p_180637_3_); p_180637_3_ -= i; -@@ -577,6 +581,7 @@ +@@ -292,6 +293,7 @@ } -+ @Deprecated //Forge: State sensitive version ++ @Deprecated public float func_149638_a() { - return this.field_149781_w; + return this.field_235689_au_; } -@@ -675,6 +680,7 @@ +@@ -341,6 +343,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 ++ @Deprecated //Forge: Use more sensitive version public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) { return new ItemStack(this); } -@@ -688,6 +694,7 @@ - return Fluids.field_204541_a.func_207188_f(); - } - -+ @Deprecated //Forge: Use more sensitive version - public float func_208618_m() { - return this.field_149765_K; - } -@@ -716,6 +723,7 @@ +@@ -372,6 +375,7 @@ public void func_176224_k(World p_176224_1_, BlockPos p_176224_2_) { } @@ -136,15 +53,15 @@ public boolean func_149659_a(Explosion p_149659_1_) { return true; } -@@ -760,6 +768,7 @@ - } +@@ -391,6 +395,7 @@ + return this.field_196275_y; } + @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) } public SoundType func_220072_p(BlockState p_220072_1_) { return this.field_149762_H; } -@@ -769,7 +778,7 @@ +@@ -400,7 +405,7 @@ this.field_220086_i = Item.func_150898_a(this); } @@ -153,7 +70,7 @@ } public boolean func_208619_r() { -@@ -777,13 +786,81 @@ +@@ -408,7 +413,7 @@ } public String toString() { @@ -162,15 +79,15 @@ } @OnlyIn(Dist.CLIENT) - public void func_190948_a(ItemStack p_190948_1_, @Nullable IBlockReader p_190948_2_, List p_190948_3_, ITooltipFlag p_190948_4_) { +@@ -419,6 +424,73 @@ + return this; } + /* ======================================== FORGE START =====================================*/ + protected Random RANDOM = new Random(); + private net.minecraftforge.common.ToolType harvestTool; + private int harvestLevel; -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::getGeneration, BlockTags::func_199896_a); -+ private final java.util.function.Supplier lootTableSupplier; ++ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::func_199896_a); + + @Override + public float getSlipperiness(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) { @@ -185,98 +102,54 @@ + + @Override + public int getHarvestLevel(BlockState state) { -+ return harvestLevel; //TODO: RE-Evaluate ++ return harvestLevel; //TODO: RE-Evaluate + } + + @Override + 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)); ++ 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; ++ 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; + -+ if (plant.func_177230_c() == Blocks.field_196608_cF && this == Blocks.field_196608_cF) -+ return true; ++ if (plant.func_177230_c() == Blocks.field_196608_cF && this == Blocks.field_196608_cF) ++ return true; + -+ if (plantable instanceof BushBlock && ((BushBlock)plantable).func_200014_a_(state, world, pos)) -+ return true; ++ if (plantable instanceof BushBlock && ((BushBlock)plantable).func_200014_a_(state, world, pos)) ++ return true; + -+ switch (type) { -+ case Desert: return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof GlazedTerracottaBlock; -+ case Nether: return this.getBlock() == Blocks.field_150425_aM; -+ case Crop: return 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 || net.minecraftforge.common.Tags.Blocks.DIRT.func_199685_a_(this) || this.getBlock() == Blocks.field_150458_ak; -+ case Water: return state.func_185904_a() == Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper) -+ case Beach: -+ boolean isBeach = this.getBlock() == Blocks.field_196658_i || net.minecraftforge.common.Tags.Blocks.DIRT.func_199685_a_(this) || this.getBlock() == Blocks.field_150354_m; -+ boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_185904_a() == Material.field_151586_h || -+ world.func_180495_p(pos.func_177976_e()).func_185904_a() == Material.field_151586_h || -+ world.func_180495_p(pos.func_177978_c()).func_185904_a() == Material.field_151586_h || -+ world.func_180495_p(pos.func_177968_d()).func_185904_a() == Material.field_151586_h); -+ return isBeach && hasWater; -+ } -+ return false; -+ } ++ switch (type) { ++ case Desert: return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof GlazedTerracottaBlock; ++ case Nether: return this.getBlock() == Blocks.field_150425_aM; ++ case Crop: return this.getBlock() == Blocks.field_150458_ak; ++ case Cave: return Block.func_220056_d(state, world, pos, Direction.UP); ++ case Plains: return this.getBlock() == Blocks.field_196658_i || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || this.getBlock() == Blocks.field_150458_ak; ++ case Water: return state.func_185904_a() == net.minecraft.block.material.Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper) ++ case Beach: ++ boolean isBeach = this.getBlock() == Blocks.field_196658_i || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || this.getBlock() == Blocks.field_150354_m; ++ boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_185904_a() == net.minecraft.block.material.Material.field_151586_h || ++ world.func_180495_p(pos.func_177976_e()).func_185904_a() == net.minecraft.block.material.Material.field_151586_h || ++ world.func_180495_p(pos.func_177978_c()).func_185904_a() == net.minecraft.block.material.Material.field_151586_h || ++ world.func_180495_p(pos.func_177968_d()).func_185904_a() == net.minecraft.block.material.Material.field_151586_h); ++ return isBeach && hasWater; ++ } ++ return false; ++ } + -+ @Override -+ public final java.util.Set getTags() { -+ return reverseTags.getTagNames(); -+ } ++ @Override ++ public final java.util.Set getTags() { ++ return reverseTags.getTagNames(); ++ } + -+ static { ++ static { + net.minecraftforge.common.ForgeHooks.setBlockToolSetter((block, tool, level) -> { -+ block.harvestTool = tool; -+ block.harvestLevel = level; ++ block.harvestTool = tool; ++ block.harvestLevel = level; + }); -+ } ++ } + /* ========================================= FORGE END ======================================*/ + - public static enum OffsetType { - NONE, - XZ, -@@ -805,6 +882,9 @@ - private ResourceLocation field_222381_j; - private boolean field_226895_m_ = true; - private boolean field_208772_j; -+ private int harvestLevel = -1; -+ private net.minecraftforge.common.ToolType harvestTool; -+ private java.util.function.Supplier lootTableSupplier; - - private Properties(Material p_i48616_1_, MaterialColor p_i48616_2_) { - this.field_200953_a = p_i48616_1_; -@@ -837,6 +917,8 @@ - block$properties.field_226893_j_ = p_200950_0_.func_226891_m_(); - block$properties.field_208772_j = p_200950_0_.field_208621_p; - block$properties.field_226895_m_ = p_200950_0_.field_226888_j_; -+ block$properties.harvestLevel = p_200950_0_.harvestLevel; -+ block$properties.harvestTool = p_200950_0_.harvestTool; - return block$properties; - } - -@@ -901,13 +983,23 @@ - return this; - } - -+ public Block.Properties harvestLevel(int harvestLevel) { -+ this.harvestLevel = harvestLevel; -+ return this; -+ } -+ -+ public Block.Properties harvestTool(net.minecraftforge.common.ToolType harvestTool) { -+ this.harvestTool = harvestTool; -+ return this; -+ } -+ - public Block.Properties func_222380_e() { - this.field_222381_j = LootTables.field_186419_a; - return this; - } - - public Block.Properties func_222379_b(Block p_222379_1_) { -- this.field_222381_j = p_222379_1_.func_220068_i(); -+ this.lootTableSupplier = () -> p_222379_1_.delegate.get().func_220068_i(); - return this; - } - } + public static final class RenderSideCacheKey { + private final BlockState field_212164_a; + private final BlockState field_212165_b; diff --git a/patches/minecraft/net/minecraft/block/BlockState.java.patch b/patches/minecraft/net/minecraft/block/BlockState.java.patch index a0d2dfd38..815bf9924 100644 --- a/patches/minecraft/net/minecraft/block/BlockState.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockState.java.patch @@ -1,26 +1,11 @@ --- 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; +@@ -6,7 +6,7 @@ + import net.minecraft.state.Property; + import net.minecraft.util.registry.Registry; --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; -@@ -106,10 +106,14 @@ - return this.field_215708_d; - } +-public class BlockState extends AbstractBlock.AbstractBlockState { ++public class BlockState extends AbstractBlock.AbstractBlockState implements net.minecraftforge.common.extensions.IForgeBlockState { + public static final Codec field_235877_b_ = func_235897_a_(Registry.field_212618_g, Block::func_176223_P).stable(); -+ /** @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_); - } + public BlockState(Block p_i231876_1_, ImmutableMap, Comparable> p_i231876_2_, MapCodec p_i231876_3_) { diff --git a/patches/minecraft/net/minecraft/block/Blocks.java.patch b/patches/minecraft/net/minecraft/block/Blocks.java.patch index 0b40aa831..1cb852b30 100644 --- a/patches/minecraft/net/minecraft/block/Blocks.java.patch +++ b/patches/minecraft/net/minecraft/block/Blocks.java.patch @@ -1,36 +1,10 @@ --- a/net/minecraft/block/Blocks.java +++ b/net/minecraft/block/Blocks.java -@@ -14,6 +14,7 @@ - import net.minecraft.tileentity.TileEntityType; - import net.minecraft.util.registry.Registry; +@@ -26,6 +26,7 @@ + import net.minecraft.world.gen.feature.Feature; + import net.minecraft.world.gen.feature.HugeFungusConfig; +@net.minecraftforge.registries.ObjectHolder("minecraft") public class Blocks { - public static final Block field_150350_a = func_222382_a("air", new AirBlock(Block.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e())); - public static final Block field_150348_b = func_222382_a("stone", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_200948_a(1.5F, 6.0F))); -@@ -105,7 +106,7 @@ - public static final Block field_196601_az = func_222382_a("green_bed", new BedBlock(DyeColor.GREEN, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F).func_226896_b_())); - public static final Block field_196550_aA = func_222382_a("red_bed", new BedBlock(DyeColor.RED, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F).func_226896_b_())); - public static final Block field_196551_aB = func_222382_a("black_bed", new BedBlock(DyeColor.BLACK, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F).func_226896_b_())); -- public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e))); -+ public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true)); - public static final Block field_150319_E = func_222382_a("detector_rail", new DetectorRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e))); - public static final Block field_150320_F = func_222382_a("sticky_piston", new PistonBlock(true, Block.Properties.func_200945_a(Material.field_76233_E).func_200943_b(0.5F))); - public static final Block field_196553_aF = func_222382_a("cobweb", new WebBlock(Block.Properties.func_200945_a(Material.field_151569_G).func_200942_a().func_200943_b(4.0F))); -@@ -701,16 +702,4 @@ - private static Block func_222382_a(String p_222382_0_, Block p_222382_1_) { - return Registry.func_218325_a(Registry.field_212618_g, p_222382_0_, p_222382_1_); - } -- -- static { -- for(Block block : Registry.field_212618_g) { -- for(BlockState blockstate : block.func_176194_O().func_177619_a()) { -- blockstate.func_215692_c(); -- Block.field_176229_d.func_195867_b(blockstate); -- } -- -- block.func_220068_i(); -- } -- -- } - } + public static final Block field_150350_a = func_222382_a("air", new AirBlock(AbstractBlock.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e().func_235859_g_())); + public static final Block field_150348_b = func_222382_a("stone", new Block(AbstractBlock.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_235861_h_().func_200948_a(1.5F, 6.0F))); diff --git a/patches/minecraft/net/minecraft/block/BushBlock.java.patch b/patches/minecraft/net/minecraft/block/BushBlock.java.patch index 81b00dcdd..e426c8f86 100644 --- a/patches/minecraft/net/minecraft/block/BushBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/BushBlock.java.patch @@ -6,10 +6,10 @@ -public class BushBlock extends Block { +public class BushBlock extends Block implements net.minecraftforge.common.IPlantable { - protected BushBlock(Block.Properties p_i48437_1_) { + protected BushBlock(AbstractBlock.Properties p_i48437_1_) { super(p_i48437_1_); } -@@ -23,6 +23,8 @@ +@@ -22,6 +22,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(); @@ -18,9 +18,9 @@ return this.func_200014_a_(p_196260_2_.func_180495_p(blockpos), p_196260_2_, blockpos); } -@@ -33,4 +35,11 @@ +@@ -32,4 +34,11 @@ public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { - return p_196266_4_ == PathType.AIR && !this.field_196274_w ? true : super.func_196266_a(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_); + return p_196266_4_ == PathType.AIR && !this.field_235688_at_ ? true : super.func_196266_a(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_); } + + @Override diff --git a/patches/minecraft/net/minecraft/block/CactusBlock.java.patch b/patches/minecraft/net/minecraft/block/CactusBlock.java.patch index b38c7edc3..cf38b6079 100644 --- a/patches/minecraft/net/minecraft/block/CactusBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/CactusBlock.java.patch @@ -16,37 +16,26 @@ + if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update if (!p_225534_1_.func_196955_c(p_225534_2_, p_225534_3_)) { p_225534_2_.func_175655_b(p_225534_3_, true); - } else { + } @@ -42,6 +43,7 @@ + int i; + for(i = 1; p_225542_2_.func_180495_p(p_225542_3_.func_177979_c(i)).func_203425_a(this); ++i) { + } ++ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) { - if (i < 3) { - int j = p_225534_1_.func_177229_b(field_176587_a); -+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, blockpos, p_225534_1_, true)) { - if (j == 15) { - p_225534_2_.func_175656_a(blockpos, this.func_176223_P()); - BlockState blockstate = p_225534_1_.func_206870_a(field_176587_a, Integer.valueOf(0)); -@@ -50,7 +52,8 @@ - } else { - p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4); - } -- -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); -+ } + if (i < 3) { + int j = p_225542_1_.func_177229_b(field_176587_a); +@@ -53,7 +55,8 @@ + } else { + p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4); } +- ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); ++ } } } -@@ -81,8 +84,8 @@ - } - } - -- Block block = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_177230_c(); -- return (block == Blocks.field_150434_aF || block == Blocks.field_150354_m || block == Blocks.field_196611_F) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d(); -+ BlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); -+ return soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), Direction.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d(); } - - public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { -@@ -96,4 +99,14 @@ +@@ -98,4 +101,14 @@ public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { return false; } diff --git a/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch b/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch index c63573642..e9b7a7a63 100644 --- a/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch @@ -1,45 +1,33 @@ --- a/net/minecraft/block/ChorusFlowerBlock.java +++ b/net/minecraft/block/ChorusFlowerBlock.java -@@ -29,9 +29,9 @@ - p_225534_2_.func_175655_b(p_225534_3_, true); - } else { - BlockPos blockpos = p_225534_3_.func_177984_a(); -- if (p_225534_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) { -+ if (p_225534_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < p_225534_2_.func_201675_m().getHeight()) { - int i = p_225534_1_.func_177229_b(field_185607_a); -- if (i < 5) { -+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, blockpos, p_225534_1_, true)) { - boolean flag = false; - boolean flag1 = false; - BlockState blockstate = p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()); -@@ -56,7 +56,7 @@ - if (j < 2 || j <= p_225534_4_.nextInt(flag1 ? 5 : 4)) { - flag = true; - } -- } else if (blockstate.func_196958_f()) { -+ } else if (blockstate.isAir(p_225534_2_, p_225534_3_.func_177977_b())) { +@@ -65,7 +65,7 @@ + if (j < 2 || j <= p_225542_4_.nextInt(flag1 ? 5 : 4)) { flag = true; } - -@@ -88,7 +88,7 @@ - } else { - this.func_185605_c(p_225534_2_, p_225534_3_); - } -- -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); +- } else if (blockstate.func_196958_f()) { ++ } else if (blockstate.isAir(p_225542_2_, p_225542_3_.func_177977_b())) { + flag = true; } + +@@ -97,7 +97,7 @@ + } else { + this.func_185605_c(p_225542_2_, p_225542_3_); + } +- ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); } } -@@ -126,7 +126,7 @@ + } +@@ -133,7 +133,7 @@ + public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { 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_177230_c() != this.field_196405_b && !blockstate.func_203425_a(Blocks.field_150377_bs)) { - if (!blockstate.func_196958_f()) { + if (!blockstate.isAir(p_196260_2_, p_196260_3_.func_177977_b())) { return false; } else { boolean flag = false; -@@ -139,7 +139,7 @@ +@@ -146,7 +146,7 @@ } flag = true; diff --git a/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch b/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch index d22d6ae69..9deaf6a71 100644 --- a/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch @@ -1,22 +1,13 @@ --- a/net/minecraft/block/ComparatorBlock.java +++ b/net/minecraft/block/ComparatorBlock.java -@@ -71,7 +71,7 @@ - blockstate = p_176397_1_.func_180495_p(blockpos); - if (blockstate.func_185912_n()) { - i = blockstate.func_185888_a(p_176397_1_, blockpos); -- } else if (blockstate.func_196958_f()) { -+ } else if (blockstate.isAir(p_176397_1_, blockpos)) { - ItemFrameEntity itemframeentity = this.func_176461_a(p_176397_1_, direction, blockpos); - if (itemframeentity != null) { - i = itemframeentity.func_174866_q(); -@@ -157,4 +157,16 @@ +@@ -154,4 +154,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; ++ return state.func_203425_a(Blocks.field_196762_fd); + } + + @Override diff --git a/patches/minecraft/net/minecraft/block/CropsBlock.java.patch b/patches/minecraft/net/minecraft/block/CropsBlock.java.patch index 262ecdb0b..8c9543009 100644 --- a/patches/minecraft/net/minecraft/block/CropsBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/CropsBlock.java.patch @@ -1,34 +1,6 @@ --- a/net/minecraft/block/CropsBlock.java +++ b/net/minecraft/block/CropsBlock.java -@@ -58,12 +58,14 @@ - - public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { - super.func_225534_a_(p_225534_1_, p_225534_2_, p_225534_3_, p_225534_4_); -+ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_225534_2_.func_226659_b_(p_225534_3_, 0) >= 9) { - int i = this.func_185527_x(p_225534_1_); - if (i < this.func_185526_g()) { - float f = func_180672_a(this, p_225534_2_, p_225534_3_); -- if (p_225534_4_.nextInt((int)(25.0F / f) + 1) == 0) { -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_4_.nextInt((int)(25.0F / f) + 1) == 0)) { - p_225534_2_.func_180501_a(p_225534_3_, this.func_185528_e(i + 1), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); - } - } - } -@@ -92,9 +94,9 @@ - for(int j = -1; j <= 1; ++j) { - float f1 = 0.0F; - BlockState blockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j)); -- if (blockstate.func_177230_c() == Blocks.field_150458_ak) { -+ if (blockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) { - f1 = 1.0F; -- if (blockstate.func_177229_b(FarmlandBlock.field_176531_a) > 0) { -+ if (blockstate.isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j))) { - f1 = 3.0F; - } - } -@@ -130,7 +132,7 @@ +@@ -133,7 +133,7 @@ } public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { diff --git a/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch b/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch index 341a2ad7e..a36eba41b 100644 --- a/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch @@ -8,4 +8,4 @@ +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_) { + protected DeadBushBlock(AbstractBlock.Properties p_i48418_1_) { diff --git a/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch b/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch index 2ba96d58b..cc4984bde 100644 --- a/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/block/DetectorRailBlock.java +++ b/net/minecraft/block/DetectorRailBlock.java @@ -129,6 +129,8 @@ + } - public int func_180641_l(BlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) { - if (p_180641_1_.func_177229_b(field_176574_M)) { + List list1 = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, EntityPredicates.field_96566_b); + 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(); + if (!list1.isEmpty()) { + return Container.func_94526_b((IInventory)list1.get(0)); + } diff --git a/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch b/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch index ecf90a095..c88faf5f6 100644 --- a/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch @@ -5,7 +5,7 @@ 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; ++ return blockpos.func_177956_o() < 255 /*TODO context.getWorld().getDimension().getHeight() - 1*/ && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null; } public void func_180633_a(World p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) { @@ -14,6 +14,6 @@ } 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; + return blockstate.func_203425_a(this) && blockstate.func_177229_b(field_176492_b) == DoubleBlockHalf.LOWER; } } diff --git a/patches/minecraft/net/minecraft/block/FallingBlock.java.patch b/patches/minecraft/net/minecraft/block/FallingBlock.java.patch index ddd32d0d6..698795bff 100644 --- a/patches/minecraft/net/minecraft/block/FallingBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FallingBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/FallingBlock.java +++ b/net/minecraft/block/FallingBlock.java -@@ -29,7 +29,7 @@ +@@ -30,7 +30,7 @@ } public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { @@ -15,6 +15,6 @@ BlockPos blockpos = p_180655_3_.func_177977_b(); - if (func_185759_i(p_180655_2_.func_180495_p(blockpos))) { + if (p_180655_2_.func_175623_d(blockpos) || func_185759_i(p_180655_2_.func_180495_p(blockpos))) { - double d0 = (double)p_180655_3_.func_177958_n() + (double)p_180655_4_.nextFloat(); + double d0 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble(); double d1 = (double)p_180655_3_.func_177956_o() - 0.05D; - double d2 = (double)p_180655_3_.func_177952_p() + (double)p_180655_4_.nextFloat(); + double d2 = (double)p_180655_3_.func_177952_p() + p_180655_4_.nextDouble(); diff --git a/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch b/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch index 63e203b01..da061b1b7 100644 --- a/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/FarmlandBlock.java +++ b/net/minecraft/block/FarmlandBlock.java -@@ -76,7 +76,7 @@ +@@ -77,7 +77,7 @@ } public void func_180658_a(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) { @@ -9,7 +9,7 @@ func_199610_d(p_180658_1_.func_180495_p(p_180658_2_), p_180658_1_, p_180658_2_); } -@@ -87,9 +87,9 @@ +@@ -88,9 +88,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_)); } @@ -22,7 +22,7 @@ } private static boolean func_176530_e(IWorldReader p_176530_0_, BlockPos p_176530_1_) { -@@ -99,7 +99,7 @@ +@@ -100,7 +100,7 @@ } } diff --git a/patches/minecraft/net/minecraft/block/FireBlock.java.patch b/patches/minecraft/net/minecraft/block/FireBlock.java.patch index 4da84d952..f458ed6df 100644 --- a/patches/minecraft/net/minecraft/block/FireBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FireBlock.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/block/FireBlock.java +++ b/net/minecraft/block/FireBlock.java -@@ -64,13 +64,13 @@ - public BlockState func_196448_a(IBlockReader p_196448_1_, BlockPos p_196448_2_) { +@@ -76,13 +76,13 @@ + protected 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) && !blockstate.func_224755_d(p_196448_1_, blockpos, Direction.UP)) { @@ -16,23 +16,16 @@ } } -@@ -91,12 +91,14 @@ - - public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { - if (p_225534_2_.func_82736_K().func_223586_b(GameRules.field_223598_a)) { -+ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 2)) return; // Forge: prevent loading unloaded chunks when spreading fire - if (!p_225534_1_.func_196955_c(p_225534_2_, p_225534_3_)) { - p_225534_2_.func_217377_a(p_225534_3_, false); +@@ -105,7 +105,7 @@ } - Block block = p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()).func_177230_c(); -- boolean flag = p_225534_2_.field_73011_w instanceof EndDimension && block == Blocks.field_150357_h || block == Blocks.field_150424_aL || block == Blocks.field_196814_hQ; -+ BlockState other = p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()); -+ boolean flag = other.isFireSource(p_225534_2_, p_225534_3_.func_177977_b(), Direction.UP); + BlockState blockstate = p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()); +- boolean flag = blockstate.func_235714_a_(p_225534_2_.func_230315_m_().func_241515_q_()); ++ boolean flag = blockstate.isFireSource(p_225534_2_, p_225534_3_, Direction.UP); int i = p_225534_1_.func_177229_b(field_176543_a); if (!flag && p_225534_2_.func_72896_J() && this.func_176537_d(p_225534_2_, p_225534_3_) && p_225534_4_.nextFloat() < 0.2F + (float)i * 0.03F) { p_225534_2_.func_217377_a(p_225534_3_, false); -@@ -118,7 +120,7 @@ +@@ -126,7 +126,7 @@ return; } @@ -41,7 +34,7 @@ p_225534_2_.func_217377_a(p_225534_3_, false); return; } -@@ -126,12 +128,12 @@ +@@ -134,12 +134,12 @@ boolean flag1 = p_225534_2_.func_180502_D(p_225534_3_); int k = flag1 ? -50 : 0; @@ -60,34 +53,29 @@ BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(); for(int l = -1; l <= 1; ++l) { -@@ -169,16 +171,18 @@ +@@ -177,15 +177,17 @@ 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()); } -- 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()); + public int func_220274_q(BlockState p_220274_1_) { + return p_220274_1_.func_235901_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_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()); + public int func_220275_r(BlockState p_220275_1_) { + return p_220275_1_.func_235901_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_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); + int i = this.func_220274_q(p_176536_1_.func_180495_p(p_176536_2_)); if (p_176536_4_.nextInt(p_176536_3_) < i) { 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_)) { -@@ -188,18 +192,14 @@ - p_176536_1_.func_217377_a(p_176536_2_, false); +@@ -197,10 +199,7 @@ } -- Block block = blockstate.func_177230_c(); + Block block = blockstate.func_177230_c(); - if (block instanceof TNTBlock) { - TNTBlock tntblock = (TNTBlock)block; - TNTBlock.func_196534_a(p_176536_1_, p_176536_2_); @@ -96,6 +84,7 @@ } } +@@ -212,7 +211,7 @@ private boolean func_196447_a(IBlockReader p_196447_1_, BlockPos p_196447_2_) { for(Direction direction : Direction.values()) { @@ -104,7 +93,7 @@ return true; } } -@@ -215,13 +215,14 @@ +@@ -228,13 +227,14 @@ for(Direction direction : Direction.values()) { BlockState blockstate = p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(direction)); @@ -117,60 +106,13 @@ } + @Deprecated //Forge: Use canCatchFire with more context - public boolean func_196446_i(BlockState p_196446_1_) { + protected boolean func_196446_i(BlockState p_196446_1_) { return this.func_220275_r(p_196446_1_) > 0; } -@@ -246,8 +247,8 @@ - - BlockPos blockpos = p_180655_3_.func_177977_b(); - BlockState blockstate = p_180655_2_.func_180495_p(blockpos); -- if (!this.func_196446_i(blockstate) && !blockstate.func_224755_d(p_180655_2_, blockpos, Direction.UP)) { -- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177976_e()))) { -+ 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(); -@@ -256,7 +257,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(), 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(); -@@ -265,7 +266,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(), 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(); -@@ -274,7 +275,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(), 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(); -@@ -283,7 +284,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(), 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; -@@ -307,10 +308,23 @@ +@@ -253,10 +253,23 @@ } - public void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) { + private void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) { + if (p_180686_1_ == Blocks.field_150350_a) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); this.field_149849_a.put(p_180686_1_, p_180686_2_); this.field_149848_b.put(p_180686_1_, p_180686_3_); diff --git a/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch b/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch index b601fa829..a34dcbab8 100644 --- a/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch @@ -1,22 +1,21 @@ --- a/net/minecraft/block/FlowerPotBlock.java +++ b/net/minecraft/block/FlowerPotBlock.java -@@ -23,10 +23,37 @@ +@@ -24,12 +24,33 @@ protected static final VoxelShape field_196450_a = Block.func_208617_a(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D); private final Block field_196452_c; -+ private final Map> fullPots; -+ private final java.util.function.Supplier emptyPot; -+ private final java.util.function.Supplier flowerDelegate; -+ + @Deprecated // Mods should use the constructor below - public FlowerPotBlock(Block p_i48395_1_, Block.Properties p_i48395_2_) { -+ this(Blocks.field_150457_bL == null ? null : () -> (FlowerPotBlock) Blocks.field_150457_bL.delegate.get(), () -> p_i48395_1_.delegate.get(), p_i48395_2_); -+ if (Blocks.field_150457_bL != null) { -+ ((FlowerPotBlock)Blocks.field_150457_bL).addPlant(p_i48395_1_.getRegistryName(), () -> this); -+ } -+ } -+ -+ /** + public FlowerPotBlock(Block p_i48395_1_, AbstractBlock.Properties p_i48395_2_) { +- super(p_i48395_2_); +- this.field_196452_c = p_i48395_1_; +- field_196451_b.put(p_i48395_1_, this); ++ this(Blocks.field_150457_bL == null ? null : () -> (FlowerPotBlock) Blocks.field_150457_bL.delegate.get(), () -> p_i48395_1_.delegate.get(), p_i48395_2_); ++ if (Blocks.field_150457_bL != null) { ++ ((FlowerPotBlock)Blocks.field_150457_bL).addPlant(p_i48395_1_.getRegistryName(), () -> this); ++ } + } +- ++ /** + * For mod use, eliminates the need to extend this class, and prevents modded + * flower pots from altering vanilla behavior. + * @@ -24,23 +23,22 @@ + * @param p_i48395_1_ The flower block. + * @param properties + */ -+ public FlowerPotBlock(@javax.annotation.Nullable java.util.function.Supplier emptyPot, java.util.function.Supplier p_i48395_1_, Block.Properties p_i48395_2_) { - super(p_i48395_2_); -- this.field_196452_c = p_i48395_1_; -- field_196451_b.put(p_i48395_1_, this); -+ this.field_196452_c = null; // Unused, redirected by coremod -+ this.flowerDelegate = p_i48395_1_; -+ if (emptyPot == null) { -+ this.fullPots = Maps.newHashMap(); -+ this.emptyPot = null; -+ } else { -+ this.fullPots = java.util.Collections.emptyMap(); -+ this.emptyPot = emptyPot; -+ } - } - ++ public FlowerPotBlock(@javax.annotation.Nullable java.util.function.Supplier emptyPot, java.util.function.Supplier p_i48395_1_, AbstractBlock.Properties p_i48395_2_) { ++ super(p_i48395_2_); ++ this.field_196452_c = null; // Unused, redirected by coremod ++ this.flowerDelegate = p_i48395_1_; ++ if (emptyPot == null) { ++ this.fullPots = Maps.newHashMap(); ++ this.emptyPot = null; ++ } else { ++ this.fullPots = java.util.Collections.emptyMap(); ++ this.emptyPot = emptyPot; ++ } ++ } public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { -@@ -40,7 +67,7 @@ + return field_196450_a; + } +@@ -41,7 +62,7 @@ public ActionResultType func_225533_a_(BlockState p_225533_1_, World p_225533_2_, BlockPos p_225533_3_, PlayerEntity p_225533_4_, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) { ItemStack itemstack = p_225533_4_.func_184586_b(p_225533_5_); Item item = itemstack.func_77973_b(); @@ -49,7 +47,7 @@ boolean flag = block == Blocks.field_150350_a; boolean flag1 = this.field_196452_c == Blocks.field_150350_a; if (flag != flag1) { -@@ -58,7 +85,7 @@ +@@ -59,7 +80,7 @@ p_225533_4_.func_71019_a(itemstack1, false); } @@ -57,23 +55,34 @@ + p_225533_2_.func_180501_a(p_225533_3_, getEmptyPot().func_176223_P(), 3); } - return ActionResultType.SUCCESS; -@@ -76,6 +103,17 @@ + return ActionResultType.func_233537_a_(p_225533_2_.field_72995_K); +@@ -77,10 +98,28 @@ } public Block func_220276_d() { - return this.field_196452_c; + return flowerDelegate.get(); } + + public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { + return false; + } ++ ++ //Forge Start ++ private final Map> fullPots; ++ private final java.util.function.Supplier emptyPot; ++ private final java.util.function.Supplier flowerDelegate; ++ + + public FlowerPotBlock getEmptyPot() { -+ return emptyPot == null ? this : emptyPot.get(); ++ return emptyPot == null ? this : emptyPot.get(); + } + + public void addPlant(net.minecraft.util.ResourceLocation flower, java.util.function.Supplier fullPot) { -+ if (getEmptyPot() != this) { -+ throw new IllegalArgumentException("Cannot add plant to non-empty pot: " + this); -+ } -+ fullPots.put(flower, fullPot); ++ if (getEmptyPot() != this) { ++ throw new IllegalArgumentException("Cannot add plant to non-empty pot: " + this); ++ } ++ fullPots.put(flower, fullPot); + } ++ //Forge End } diff --git a/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch b/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch index 4b42092df..0b5bd8651 100644 --- a/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/block/FlowingFluidBlock.java +++ b/net/minecraft/block/FlowingFluidBlock.java -@@ -31,9 +31,11 @@ +@@ -31,10 +31,11 @@ public class FlowingFluidBlock extends Block implements IBucketPickupHandler { public static final IntegerProperty field_176367_b = BlockStateProperties.field_208132_ag; - protected final FlowingFluid field_204517_c; + private final FlowingFluid field_204517_c; - private final List field_212565_c; + private final List field_212565_c; + public static final VoxelShape field_235510_c_ = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D); -+ // Forge: Use the constructor that takes a supplier -+ @Deprecated - protected FlowingFluidBlock(FlowingFluid p_i49014_1_, Block.Properties p_i49014_2_) { ++ @Deprecated // Forge: Use the constructor that takes a supplier + protected FlowingFluidBlock(FlowingFluid p_i49014_1_, AbstractBlock.Properties p_i49014_2_) { super(p_i49014_2_); this.field_204517_c = p_i49014_1_; -@@ -46,8 +48,21 @@ +@@ -47,8 +48,21 @@ this.field_212565_c.add(p_i49014_1_.func_207207_a(8, true)); this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0))); @@ -24,7 +24,7 @@ + /** + * @param supplier A fluid supplier such as {@link net.minecraftforge.fml.RegistryObject} + */ -+ public FlowingFluidBlock(java.util.function.Supplier supplier, Block.Properties p_i48368_1_) { ++ public FlowingFluidBlock(java.util.function.Supplier supplier, AbstractBlock.Properties p_i48368_1_) { + super(p_i48368_1_); + this.field_204517_c = null; + this.field_212565_c = Lists.newArrayList(); @@ -32,34 +32,18 @@ + this.supplier = supplier; + } + - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { - p_225542_2_.func_204610_c(p_225542_3_).func_206891_b(p_225542_2_, p_225542_3_, p_225542_4_); + public VoxelShape func_220071_b(BlockState p_220071_1_, IBlockReader p_220071_2_, BlockPos p_220071_3_, ISelectionContext p_220071_4_) { + return p_220071_4_.func_216378_a(field_235510_c_, p_220071_3_, true) && p_220071_1_.func_177229_b(field_176367_b) == 0 && p_220071_4_.func_230426_a_(p_220071_2_.func_204610_c(p_220071_3_.func_177984_a()), this.field_204517_c) ? field_235510_c_ : VoxelShapes.func_197880_a(); } -@@ -62,6 +77,7 @@ +@@ -71,6 +85,7 @@ - public IFluidState func_204507_t(BlockState p_204507_1_) { + public FluidState func_204507_t(BlockState p_204507_1_) { int i = p_204507_1_.func_177229_b(field_176367_b); + if (!fluidStateCacheInitialized) initFluidStateCache(); return this.field_212565_c.get(Math.min(i, 8)); } -@@ -122,13 +138,13 @@ - if (flag) { - IFluidState ifluidstate = p_204515_1_.func_204610_c(p_204515_2_); - if (ifluidstate.func_206889_d()) { -- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_150343_Z.func_176223_P()); -+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_150343_Z.func_176223_P())); - this.func_180688_d(p_204515_1_, p_204515_2_); - return false; - } - - if (ifluidstate.func_215679_a(p_204515_1_, p_204515_2_) >= 0.44444445F) { -- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_150347_e.func_176223_P()); -+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_150347_e.func_176223_P())); - this.func_180688_d(p_204515_1_, p_204515_2_); - return false; - } -@@ -161,4 +177,23 @@ +@@ -166,4 +181,23 @@ } } diff --git a/patches/minecraft/net/minecraft/block/JigsawBlock.java.patch b/patches/minecraft/net/minecraft/block/JigsawBlock.java.patch deleted file mode 100644 index d0c8cecd7..000000000 --- a/patches/minecraft/net/minecraft/block/JigsawBlock.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/block/JigsawBlock.java -+++ b/net/minecraft/block/JigsawBlock.java -@@ -30,6 +30,13 @@ - 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))); - } - -+ // FORGE: Fix jigsaw blocks not mirroring properly -+ @Override -+ @Deprecated -+ public BlockState func_185471_a(BlockState state, net.minecraft.util.Mirror mirrorIn) { -+ return state.func_206870_a(field_176387_N, mirrorIn.func_185803_b(state.func_177229_b(field_176387_N))); -+ } -+ - public BlockState func_196258_a(BlockItemUseContext p_196258_1_) { - return this.func_176223_P().func_206870_a(field_176387_N, p_196258_1_.func_196000_l()); - } diff --git a/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch b/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch index 2c446e407..bd955d51e 100644 --- a/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/LeavesBlock.java +++ b/net/minecraft/block/LeavesBlock.java -@@ -18,7 +18,7 @@ +@@ -19,7 +19,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; diff --git a/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch b/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch index b85d7d040..e4105627c 100644 --- a/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/block/MushroomBlock.java +++ b/net/minecraft/block/MushroomBlock.java -@@ -64,7 +64,7 @@ +@@ -63,7 +63,7 @@ + BlockPos blockpos = p_196260_3_.func_177977_b(); 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) { + if (!blockstate.func_203425_a(Blocks.field_150391_bh) && !blockstate.func_203425_a(Blocks.field_196661_l)) { - return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && this.func_200014_a_(blockstate, p_196260_2_, blockpos); + return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this); } else { diff --git a/patches/minecraft/net/minecraft/block/NetherPortalBlock.java.patch b/patches/minecraft/net/minecraft/block/NetherPortalBlock.java.patch index 7307175b9..dc55d7401 100644 --- a/patches/minecraft/net/minecraft/block/NetherPortalBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/NetherPortalBlock.java.patch @@ -1,56 +1,11 @@ --- a/net/minecraft/block/NetherPortalBlock.java +++ b/net/minecraft/block/NetherPortalBlock.java -@@ -69,7 +69,7 @@ +@@ -70,7 +70,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_); + public static boolean func_176548_d(IWorld p_176548_0_, BlockPos p_176548_1_) { + NetherPortalBlock.Size netherportalblock$size = func_201816_b(p_176548_0_, p_176548_1_); - if (netherportalblock$size != null) { -+ if (netherportalblock$size != null && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_1_, p_176548_2_, netherportalblock$size)) { ++ if (netherportalblock$size != null && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_0_, p_176548_1_, netherportalblock$size)) { netherportalblock$size.func_150859_c(); return true; } else { -@@ -241,13 +241,13 @@ - int i; - for(i = 0; i < 22; ++i) { - BlockPos blockpos = p_180120_1_.func_177967_a(p_180120_2_, i); -- if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || this.field_150867_a.func_180495_p(blockpos.func_177977_b()).func_177230_c() != Blocks.field_150343_Z) { -+ if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || !this.field_150867_a.func_180495_p(blockpos.func_177977_b()).isPortalFrame(this.field_150867_a, blockpos.func_177977_b())) { - break; - } - } - -- Block block = this.field_150867_a.func_180495_p(p_180120_1_.func_177967_a(p_180120_2_, i)).func_177230_c(); -- return block == Blocks.field_150343_Z ? i : 0; -+ BlockPos framePos = p_180120_1_.func_177967_a(p_180120_2_, i); -+ return this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos) ? i : 0; - } - - public int func_181100_a() { -@@ -274,13 +274,13 @@ - } - - if (i == 0) { -- block = this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150863_d)).func_177230_c(); -- if (block != Blocks.field_150343_Z) { -+ BlockPos framePos = blockpos.func_177972_a(this.field_150863_d); -+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) { - break label56; - } - } else if (i == this.field_150868_h - 1) { -- block = this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150866_c)).func_177230_c(); -- if (block != Blocks.field_150343_Z) { -+ BlockPos framePos = blockpos.func_177972_a(this.field_150866_c); -+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) { - break label56; - } - } -@@ -288,7 +288,8 @@ - } - - for(int j = 0; j < this.field_150868_h; ++j) { -- if (this.field_150867_a.func_180495_p(this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g)).func_177230_c() != Blocks.field_150343_Z) { -+ BlockPos framePos = this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g); -+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) { - this.field_150862_g = 0; - break; - } diff --git a/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch b/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch index 5b4e5f7a0..34487d9ae 100644 --- a/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/block/NetherWartBlock.java +++ b/net/minecraft/block/NetherWartBlock.java -@@ -31,9 +31,10 @@ +@@ -35,9 +35,10 @@ - public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { - int i = p_225534_1_.func_177229_b(field_176486_a); -- if (i < 3 && p_225534_4_.nextInt(10) == 0) { -+ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_4_.nextInt(10) == 0)) { - p_225534_1_ = p_225534_1_.func_206870_a(field_176486_a, Integer.valueOf(i + 1)); - p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_, 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); + public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + int i = p_225542_1_.func_177229_b(field_176486_a); +- if (i < 3 && p_225542_4_.nextInt(10) == 0) { ++ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(10) == 0)) { + p_225542_1_ = p_225542_1_.func_206870_a(field_176486_a, Integer.valueOf(i + 1)); + p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_, 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); } - super.func_225534_a_(p_225534_1_, p_225534_2_, p_225534_3_, p_225534_4_); + } diff --git a/patches/minecraft/net/minecraft/block/NoteBlock.java.patch b/patches/minecraft/net/minecraft/block/NoteBlock.java.patch index 1050235fc..c77e2f8aa 100644 --- a/patches/minecraft/net/minecraft/block/NoteBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/NoteBlock.java.patch @@ -9,18 +9,7 @@ p_196482_1_.func_175641_c(p_196482_2_, this, 0, 0); } -@@ -60,7 +60,9 @@ - if (p_225533_2_.field_72995_K) { - return ActionResultType.SUCCESS; - } else { -- p_225533_1_ = p_225533_1_.func_177231_a(field_196485_c); -+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.func_177229_b(field_196485_c), p_225533_1_.func_177231_a(field_196485_c).func_177229_b(field_196485_c)); -+ if (_new == -1) return ActionResultType.FAIL; -+ p_225533_1_ = (BlockState)p_225533_1_.func_206870_a(field_196485_c, _new); - p_225533_2_.func_180501_a(p_225533_3_, p_225533_1_, 3); - this.func_196482_a(p_225533_2_, p_225533_3_); - p_225533_4_.func_195066_a(Stats.field_188087_U); -@@ -76,6 +78,9 @@ +@@ -76,6 +76,9 @@ } public boolean func_189539_a(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) { diff --git a/patches/minecraft/net/minecraft/block/OreBlock.java.patch b/patches/minecraft/net/minecraft/block/OreBlock.java.patch index fee79b59a..95b1928d5 100644 --- a/patches/minecraft/net/minecraft/block/OreBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/OreBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/OreBlock.java +++ b/net/minecraft/block/OreBlock.java -@@ -29,12 +29,10 @@ +@@ -31,12 +31,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_); diff --git a/patches/minecraft/net/minecraft/block/PistonBlock.java.patch b/patches/minecraft/net/minecraft/block/PistonBlock.java.patch index b77708e32..b46b886e3 100644 --- a/patches/minecraft/net/minecraft/block/PistonBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/PistonBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/PistonBlock.java +++ b/net/minecraft/block/PistonBlock.java -@@ -166,6 +166,7 @@ +@@ -158,6 +158,7 @@ } if (p_189539_4_ == 0) { @@ -8,7 +8,7 @@ if (!this.func_176319_a(p_189539_2_, p_189539_3_, direction, true)) { return false; } -@@ -173,6 +174,7 @@ +@@ -165,6 +166,7 @@ p_189539_2_.func_180501_a(p_189539_3_, p_189539_1_.func_206870_a(field_176320_b, Boolean.valueOf(true)), 67); p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, SoundEvents.field_187715_dR, SoundCategory.BLOCKS, 0.5F, p_189539_2_.field_73012_v.nextFloat() * 0.25F + 0.6F); } else if (p_189539_4_ == 1 || p_189539_4_ == 2) { @@ -16,16 +16,7 @@ TileEntity tileentity1 = p_189539_2_.func_175625_s(p_189539_3_.func_177972_a(direction)); if (tileentity1 instanceof PistonTileEntity) { ((PistonTileEntity)tileentity1).func_145866_f(); -@@ -197,7 +199,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); -@@ -210,6 +212,7 @@ +@@ -204,6 +206,7 @@ p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, SoundEvents.field_187712_dQ, SoundCategory.BLOCKS, 0.5F, p_189539_2_.field_73012_v.nextFloat() * 0.15F + 0.6F); } @@ -33,25 +24,7 @@ return true; } -@@ -238,7 +241,7 @@ - return false; - } - -- return !block.func_149716_u(); -+ return !p_185646_0_.hasTileEntity(); - } else { - return false; - } -@@ -276,7 +279,7 @@ - for(int j = list2.size() - 1; j >= 0; --j) { - BlockPos blockpos2 = list2.get(j); - BlockState blockstate1 = p_176319_1_.func_180495_p(blockpos2); -- TileEntity tileentity = blockstate1.func_177230_c().func_149716_u() ? p_176319_1_.func_175625_s(blockpos2) : null; -+ TileEntity tileentity = blockstate1.hasTileEntity() ? p_176319_1_.func_175625_s(blockpos2) : null; - func_220059_a(blockstate1, p_176319_1_, blockpos2, tileentity); - p_176319_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 18); - --k; -@@ -340,6 +343,10 @@ +@@ -335,6 +338,10 @@ return p_185499_1_.func_206870_a(field_176387_N, p_185499_2_.func_185831_a(p_185499_1_.func_177229_b(field_176387_N))); } diff --git a/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch b/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch index d129e7fdf..08d65a9a4 100644 --- a/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch @@ -6,12 +6,12 @@ public static final BooleanProperty field_176569_M = BlockStateProperties.field_208194_u; + private final boolean isActivator; // TRUE for an Activator Rail, FALSE for Powered Rail - protected PoweredRailBlock(Block.Properties p_i48349_1_) { + protected PoweredRailBlock(AbstractBlock.Properties p_i48349_1_) { - super(true, p_i48349_1_); + this(p_i48349_1_, false); + } + -+ protected PoweredRailBlock(Block.Properties builder, boolean isPoweredRail) { ++ protected PoweredRailBlock(AbstractBlock.Properties builder, boolean isPoweredRail) { + 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 = !isPoweredRail; @@ -22,7 +22,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_) { BlockState blockstate = p_208071_1_.func_180495_p(p_208071_2_); -- if (blockstate.func_177230_c() != this) { +- if (!blockstate.func_203425_a(this)) { + if (!(blockstate.func_177230_c() instanceof PoweredRailBlock)) { return false; } else { @@ -31,7 +31,7 @@ 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 (isActivator == ((PoweredRailBlock)blockstate.func_177230_c()).isActivator) { ++ if (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/RedstoneDiodeBlock.java.patch b/patches/minecraft/net/minecraft/block/RedstoneDiodeBlock.java.patch index d7f116dcf..251dbae63 100644 --- a/patches/minecraft/net/minecraft/block/RedstoneDiodeBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/RedstoneDiodeBlock.java.patch @@ -4,12 +4,12 @@ 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 = this.func_235695_q_() ? 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 @@ +@@ -163,6 +163,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()); @@ -18,11 +18,3 @@ 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 index 71c810df0..d71b325ab 100644 --- a/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/RedstoneOreBlock.java +++ b/net/minecraft/block/RedstoneOreBlock.java -@@ -68,11 +68,11 @@ +@@ -71,11 +71,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_); diff --git a/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch b/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch index 0bfd181fb..21c1e6a32 100644 --- a/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch @@ -1,56 +1,38 @@ --- a/net/minecraft/block/RedstoneWireBlock.java +++ b/net/minecraft/block/RedstoneWireBlock.java -@@ -123,7 +123,7 @@ - BlockState blockstate1 = p_208074_1_.func_180495_p(blockpos1); - if (!blockstate1.func_215686_e(p_208074_1_, blockpos1)) { - boolean flag = blockstate.func_224755_d(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 (blockstate.func_224756_o(p_208074_1_, blockpos)) { +@@ -184,7 +184,7 @@ + BlockState blockstate = p_235545_1_.func_180495_p(blockpos); + if (p_235545_4_) { + boolean flag = this.func_235552_b_(p_235545_1_, blockpos, blockstate); +- if (flag && func_176346_d(p_235545_1_.func_180495_p(blockpos.func_177984_a()))) { ++ if (flag && canConnectTo(p_235545_1_.func_180495_p(blockpos.func_177984_a()), p_235545_1_, blockpos.func_177984_a(), null) ) { + if (blockstate.func_224755_d(p_235545_1_, blockpos, p_235545_3_.func_176734_d())) { return RedstoneSide.UP; } -@@ -132,7 +132,7 @@ +@@ -193,7 +193,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; +- return !func_176343_a(blockstate, p_235545_3_) && (blockstate.func_215686_e(p_235545_1_, blockpos) || !func_176346_d(p_235545_1_.func_180495_p(blockpos.func_177977_b()))) ? RedstoneSide.NONE : RedstoneSide.SIDE; ++ return !canConnectTo(blockstate, p_235545_1_, blockpos, p_235545_3_) && (blockstate.func_215686_e(p_235545_1_, blockpos) || !canConnectTo(p_235545_1_.func_180495_p(blockpos.func_177977_b()), p_235545_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_) { -@@ -315,26 +315,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); +@@ -335,11 +335,7 @@ } } -- 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) { + if (p_176343_0_.func_203425_a(Blocks.field_150488_af)) { return true; -@@ -344,7 +336,7 @@ - } else if (Blocks.field_190976_dk == p_176343_0_.func_177230_c()) { + } else if (p_176343_0_.func_203425_a(Blocks.field_196633_cV)) { +@@ -348,7 +344,7 @@ + } else if (p_176343_0_.func_203425_a(Blocks.field_190976_dk)) { 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; diff --git a/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch b/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch index cc072f5e5..ededb1e1d 100644 --- a/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch @@ -2,17 +2,17 @@ +++ b/net/minecraft/block/SaplingBlock.java @@ -29,6 +29,7 @@ - public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { - super.func_225534_a_(p_225534_1_, p_225534_2_, p_225534_3_, p_225534_4_); -+ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_225534_2_.func_201696_r(p_225534_3_.func_177984_a()) >= 9 && p_225534_4_.nextInt(7) == 0) { - this.func_226942_a_(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_4_); - } -@@ -39,6 +40,7 @@ - if (p_226942_3_.func_177229_b(field_176479_b) == 0) { - p_226942_1_.func_180501_a(p_226942_2_, p_226942_3_.func_177231_a(field_176479_b), 4); - } else { -+ if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_226942_1_, p_226942_4_, p_226942_2_)) return; - this.field_196387_c.func_225545_a_(p_226942_1_, p_226942_1_.func_72863_F().func_201711_g(), p_226942_2_, p_226942_3_, p_226942_4_); + public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + if (p_225542_2_.func_201696_r(p_225542_3_.func_177984_a()) >= 9 && p_225542_4_.nextInt(7) == 0) { ++ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + this.func_226942_a_(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_); } +@@ -39,6 +40,7 @@ + p_226942_1_.func_180501_a(p_226942_2_, p_226942_3_.func_235896_a_(field_176479_b), 4); + } else { + this.field_196387_c.func_230339_a_(p_226942_1_, p_226942_1_.func_72863_F().func_201711_g(), p_226942_2_, p_226942_3_, p_226942_4_); ++ if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_226942_1_, p_226942_4_, p_226942_2_)) return; + } + + } diff --git a/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch b/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch index 9e15b84f7..3a78d7c30 100644 --- a/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch @@ -8,4 +8,4 @@ +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_) { + protected SeaGrassBlock(AbstractBlock.Properties p_i48780_1_) { diff --git a/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch b/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch index d46dc4046..963e4828c 100644 --- a/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/block/SpreadableSnowyDirtBlock.java +++ b/net/minecraft/block/SpreadableSnowyDirtBlock.java -@@ -31,6 +31,7 @@ +@@ -33,6 +33,7 @@ - public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { - if (!func_220257_b(p_225534_1_, p_225534_2_, p_225534_3_)) { -+ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading - p_225534_2_.func_175656_a(p_225534_3_, Blocks.field_150346_d.func_176223_P()); + public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + if (!func_220257_b(p_225542_1_, p_225542_2_, p_225542_3_)) { ++ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading + p_225542_2_.func_175656_a(p_225542_3_, Blocks.field_150346_d.func_176223_P()); } else { - if (p_225534_2_.func_201696_r(p_225534_3_.func_177984_a()) >= 9) { + if (p_225542_2_.func_201696_r(p_225542_3_.func_177984_a()) >= 9) { diff --git a/patches/minecraft/net/minecraft/block/StairsBlock.java.patch b/patches/minecraft/net/minecraft/block/StairsBlock.java.patch index 5c51b0cc0..1ac6dd5f3 100644 --- a/patches/minecraft/net/minecraft/block/StairsBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/StairsBlock.java.patch @@ -1,12 +1,11 @@ --- a/net/minecraft/block/StairsBlock.java +++ b/net/minecraft/block/StairsBlock.java -@@ -84,13 +84,24 @@ +@@ -83,13 +83,23 @@ return voxelshape; } -+ // Forge: Use the other constructor that takes a Supplier -+ @Deprecated - protected StairsBlock(BlockState p_i48321_1_, Block.Properties p_i48321_2_) { ++ @Deprecated // Forge: Use the other constructor that takes a Supplier + protected StairsBlock(BlockState p_i48321_1_, AbstractBlock.Properties p_i48321_2_) { super(p_i48321_2_); this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176309_a, Direction.NORTH).func_206870_a(field_176308_b, Half.BOTTOM).func_206870_a(field_176310_M, StairsShape.STRAIGHT).func_206870_a(field_204513_t, Boolean.valueOf(false))); this.field_150149_b = p_i48321_1_.func_177230_c(); @@ -14,7 +13,7 @@ + this.stateSupplier = () -> p_i48321_1_; } -+ public StairsBlock(java.util.function.Supplier state, Block.Properties properties) { ++ public StairsBlock(java.util.function.Supplier state, AbstractBlock.Properties properties) { + super(properties); + this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176309_a, Direction.NORTH).func_206870_a(field_176308_b, Half.BOTTOM).func_206870_a(field_176310_M, StairsShape.STRAIGHT).func_206870_a(field_204513_t, Boolean.valueOf(false))); + this.field_150149_b = Blocks.field_150350_a; // These are unused, fields are redirected @@ -25,11 +24,12 @@ public boolean func_220074_n(BlockState p_220074_1_) { return true; } -@@ -262,4 +273,12 @@ +@@ -265,4 +275,14 @@ public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { return false; } + ++ // Forge Start + private final java.util.function.Supplier stateSupplier; + private Block getModelBlock() { + return getModelState().func_177230_c(); @@ -37,4 +37,5 @@ + private BlockState getModelState() { + return stateSupplier.get(); + } ++ // Forge end } diff --git a/patches/minecraft/net/minecraft/block/StemBlock.java.patch b/patches/minecraft/net/minecraft/block/StemBlock.java.patch index dd697331f..53d8d0db4 100644 --- a/patches/minecraft/net/minecraft/block/StemBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/StemBlock.java.patch @@ -1,36 +1,35 @@ --- a/net/minecraft/block/StemBlock.java +++ b/net/minecraft/block/StemBlock.java -@@ -40,22 +40,24 @@ +@@ -37,22 +37,24 @@ + } - public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { - super.func_225534_a_(p_225534_1_, p_225534_2_, p_225534_3_, p_225534_4_); -+ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_225534_2_.func_226659_b_(p_225534_3_, 0) >= 9) { - float f = CropsBlock.func_180672_a(this, p_225534_2_, p_225534_3_); -- if (p_225534_4_.nextInt((int)(25.0F / f) + 1) == 0) { -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_4_.nextInt((int)(25.0F / f) + 1) == 0)) { - int i = p_225534_1_.func_177229_b(field_176484_a); + public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { ++ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + if (p_225542_2_.func_226659_b_(p_225542_3_, 0) >= 9) { + float f = CropsBlock.func_180672_a(this, p_225542_2_, p_225542_3_); +- if (p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0) { ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0)) { + int i = p_225542_1_.func_177229_b(field_176484_a); if (i < 7) { -- p_225534_1_ = p_225534_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)); -- p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_, 2); -+ p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)), 2); +- p_225542_1_ = p_225542_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)); +- p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_, 2); ++ p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)), 2); } else { - Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_225534_4_); - BlockPos blockpos = p_225534_3_.func_177972_a(direction); -- Block block = p_225534_2_.func_180495_p(blockpos.func_177977_b()).func_177230_c(); -- if (p_225534_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_225534_2_.func_180495_p(blockpos.func_177977_b()); -+ Block block = soil.func_177230_c(); -+ if (p_225534_2_.func_175623_d(blockpos) && (soil.canSustainPlant(p_225534_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_225534_2_.func_175656_a(blockpos, this.field_149877_a.func_176223_P()); - p_225534_2_.func_175656_a(p_225534_3_, this.field_149877_a.func_196523_e().func_176223_P().func_206870_a(HorizontalBlock.field_185512_D, direction)); + Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_225542_4_); + BlockPos blockpos = p_225542_3_.func_177972_a(direction); + BlockState blockstate = p_225542_2_.func_180495_p(blockpos.func_177977_b()); +- if (p_225542_2_.func_180495_p(blockpos).func_196958_f() && (blockstate.func_203425_a(Blocks.field_150458_ak) || blockstate.func_203425_a(Blocks.field_150346_d) || blockstate.func_203425_a(Blocks.field_196660_k) || blockstate.func_203425_a(Blocks.field_196661_l) || blockstate.func_203425_a(Blocks.field_196658_i))) { ++ Block block = blockstate.func_177230_c(); ++ if (p_225542_2_.func_175623_d(blockpos) && (blockstate.canSustainPlant(p_225542_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_225542_2_.func_175656_a(blockpos, this.field_149877_a.func_176223_P()); + p_225542_2_.func_175656_a(p_225542_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_225534_2_, p_225534_3_, p_225534_1_); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); } } -@@ -101,4 +103,10 @@ +@@ -97,4 +99,10 @@ public StemGrownBlock func_208486_d() { return this.field_149877_a; } diff --git a/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch b/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch index cd26ff88d..5cfe32e5f 100644 --- a/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch @@ -9,32 +9,16 @@ 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); -@@ -39,12 +39,15 @@ - - if (i < 3) { - int j = p_225534_1_.func_177229_b(field_176355_a); -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, true)) { - if (j == 15) { - p_225534_2_.func_175656_a(p_225534_3_.func_177984_a(), this.func_176223_P()); - p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_176355_a, Integer.valueOf(0)), 4); - } else { - p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_176355_a, Integer.valueOf(j + 1)), 4); - } -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); -+ } - } - } - -@@ -59,6 +62,8 @@ +@@ -63,6 +63,8 @@ } 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) { + BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); + if (blockstate.func_177230_c() == this) { return true; -@@ -82,4 +87,14 @@ +@@ -86,4 +88,14 @@ protected void func_206840_a(StateContainer.Builder p_206840_1_) { p_206840_1_.func_206894_a(field_176355_a); } diff --git a/patches/minecraft/net/minecraft/block/TNTBlock.java.patch b/patches/minecraft/net/minecraft/block/TNTBlock.java.patch index 96361ce46..219824b4e 100644 --- a/patches/minecraft/net/minecraft/block/TNTBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TNTBlock.java.patch @@ -1,22 +1,6 @@ --- a/net/minecraft/block/TNTBlock.java +++ b/net/minecraft/block/TNTBlock.java -@@ -29,10 +29,14 @@ - this.func_180632_j(this.func_176223_P().func_206870_a(field_212569_a, Boolean.valueOf(false))); - } - -+ public void catchFire(BlockState state, World world, BlockPos pos, @Nullable net.minecraft.util.Direction face, @Nullable LivingEntity igniter) { -+ func_196535_a(world, pos, igniter); -+ } -+ - public void func_220082_b(BlockState p_220082_1_, World p_220082_2_, BlockPos p_220082_3_, BlockState p_220082_4_, boolean p_220082_5_) { - if (p_220082_4_.func_177230_c() != p_220082_1_.func_177230_c()) { - if (p_220082_2_.func_175640_z(p_220082_3_)) { -- func_196534_a(p_220082_2_, p_220082_3_); -+ catchFire(p_220082_1_, p_220082_2_, p_220082_3_, null, null); - p_220082_2_.func_217377_a(p_220082_3_, false); - } - -@@ -41,7 +45,7 @@ +@@ -41,7 +41,7 @@ public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) { if (p_220069_2_.func_175640_z(p_220069_3_)) { @@ -25,7 +9,7 @@ p_220069_2_.func_217377_a(p_220069_3_, false); } -@@ -49,7 +53,7 @@ +@@ -49,7 +49,7 @@ public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_) { if (!p_176208_1_.func_201670_d() && !p_176208_4_.func_184812_l_() && p_176208_3_.func_177229_b(field_212569_a)) { @@ -34,7 +18,7 @@ } super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_); -@@ -63,10 +67,12 @@ +@@ -63,10 +63,12 @@ } } @@ -47,7 +31,7 @@ private static void func_196535_a(World p_196535_0_, BlockPos p_196535_1_, @Nullable LivingEntity p_196535_2_) { if (!p_196535_0_.field_72995_K) { TNTEntity tntentity = new TNTEntity(p_196535_0_, (double)p_196535_1_.func_177958_n() + 0.5D, (double)p_196535_1_.func_177956_o(), (double)p_196535_1_.func_177952_p() + 0.5D, p_196535_2_); -@@ -81,7 +87,7 @@ +@@ -81,7 +83,7 @@ if (item != Items.field_151033_d && item != Items.field_151059_bz) { return super.func_225533_a_(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_4_, p_225533_5_, p_225533_6_); } else { @@ -56,9 +40,9 @@ p_225533_2_.func_180501_a(p_225533_3_, Blocks.field_150350_a.func_176223_P(), 11); if (!p_225533_4_.func_184812_l_()) { if (item == Items.field_151033_d) { -@@ -103,7 +109,7 @@ - Entity entity = abstractarrowentity.func_212360_k(); - if (abstractarrowentity.func_70027_ad()) { +@@ -102,7 +104,7 @@ + Entity entity = p_220066_4_.func_234616_v_(); + if (p_220066_4_.func_70027_ad()) { BlockPos blockpos = p_220066_3_.func_216350_a(); - func_196535_a(p_220066_1_, blockpos, entity instanceof LivingEntity ? (LivingEntity)entity : null); + catchFire(p_220066_2_, p_220066_1_, blockpos, null, entity instanceof LivingEntity ? (LivingEntity)entity : null); diff --git a/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch b/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch index 9349ebe64..a06bc9003 100644 --- a/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch @@ -8,4 +8,4 @@ +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_) { + protected TallGrassBlock(AbstractBlock.Properties p_i48310_1_) { diff --git a/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch b/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch index 2c26a8d20..092cb6004 100644 --- a/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch @@ -1,9 +1,11 @@ --- a/net/minecraft/block/TrapDoorBlock.java +++ b/net/minecraft/block/TrapDoorBlock.java -@@ -149,6 +149,16 @@ +@@ -147,4 +147,17 @@ + return super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_); } - ++ ++ //Forge Start + @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)) { @@ -13,7 +15,6 @@ + } + return false; + } ++ //Forge End + - public boolean func_220067_a(BlockState p_220067_1_, IBlockReader p_220067_2_, BlockPos p_220067_3_, EntityType p_220067_4_) { - return false; - } + } diff --git a/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch b/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch index b3baed68a..205480817 100644 --- a/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/block/TurtleEggBlock.java +++ b/net/minecraft/block/TurtleEggBlock.java -@@ -141,7 +141,7 @@ - if (p_212570_2_ instanceof TurtleEntity) { - return false; +@@ -149,7 +149,7 @@ + if (!(p_212570_2_ instanceof LivingEntity)) { + return false; + } else { +- return p_212570_2_ instanceof PlayerEntity || p_212570_1_.func_82736_K().func_223586_b(GameRules.field_223599_b); ++ return p_212570_2_ instanceof LivingEntity && !(p_212570_2_ instanceof PlayerEntity) ? net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_212570_1_, p_212570_2_) : true; + } } else { -- return p_212570_2_ instanceof LivingEntity && !(p_212570_2_ instanceof PlayerEntity) ? p_212570_1_.func_82736_K().func_223586_b(GameRules.field_223599_b) : true; -+ return p_212570_2_ instanceof LivingEntity && !(p_212570_2_ instanceof PlayerEntity) ? net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_212570_1_, p_212570_2_) : true; - } - } - } + return false; diff --git a/patches/minecraft/net/minecraft/block/VineBlock.java.patch b/patches/minecraft/net/minecraft/block/VineBlock.java.patch index 28f301906..f4f9333cf 100644 --- a/patches/minecraft/net/minecraft/block/VineBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/VineBlock.java.patch @@ -9,38 +9,37 @@ 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; -@@ -152,14 +152,14 @@ - p_225534_2_.func_217377_a(p_225534_3_, false); - } +@@ -143,14 +143,14 @@ + } -- } else if (p_225534_2_.field_73012_v.nextInt(4) == 0) { -+ } else if (p_225534_2_.field_73012_v.nextInt(4) == 0 && p_225534_2_.isAreaLoaded(p_225534_3_, 4)) { // Forge: check area to prevent loading unloaded chunks - Direction direction = Direction.func_176741_a(p_225534_4_); - BlockPos blockpos = p_225534_3_.func_177984_a(); - if (direction.func_176740_k().func_176722_c() && !p_225534_1_.func_177229_b(func_176267_a(direction))) { - if (this.func_196539_a(p_225534_2_, p_225534_3_)) { - BlockPos blockpos4 = p_225534_3_.func_177972_a(direction); - BlockState blockstate5 = p_225534_2_.func_180495_p(blockpos4); -- if (blockstate5.func_196958_f()) { -+ if (blockstate5.isAir(p_225534_2_, blockpos4)) { + public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { +- if (p_225542_2_.field_73012_v.nextInt(4) == 0) { ++ if (p_225542_2_.field_73012_v.nextInt(4) == 0 && p_225542_2_.isAreaLoaded(p_225542_3_, 4)) { // Forge: check area to prevent loading unloaded chunks + Direction direction = Direction.func_239631_a_(p_225542_4_); + BlockPos blockpos = p_225542_3_.func_177984_a(); + if (direction.func_176740_k().func_176722_c() && !p_225542_1_.func_177229_b(func_176267_a(direction))) { + if (this.func_196539_a(p_225542_2_, p_225542_3_)) { + BlockPos blockpos4 = p_225542_3_.func_177972_a(direction); + BlockState blockstate4 = p_225542_2_.func_180495_p(blockpos4); +- if (blockstate4.func_196958_f()) { ++ if (blockstate4.isAir(p_225542_2_, blockpos4)) { Direction direction3 = direction.func_176746_e(); Direction direction4 = direction.func_176735_f(); - boolean flag = p_225534_1_.func_177229_b(func_176267_a(direction3)); -@@ -216,8 +216,8 @@ - if (p_225534_3_.func_177956_o() > 0) { - BlockPos blockpos1 = p_225534_3_.func_177977_b(); - BlockState blockstate1 = p_225534_2_.func_180495_p(blockpos1); -- if (blockstate1.func_196958_f() || blockstate1.func_177230_c() == this) { -- BlockState blockstate2 = blockstate1.func_196958_f() ? this.func_176223_P() : blockstate1; -+ if (blockstate1.isAir(p_225534_2_, blockpos1) || blockstate1.func_177230_c() == this) { -+ BlockState blockstate2 = blockstate1.isAir(p_225534_2_, blockpos1) ? this.func_176223_P() : blockstate1; - BlockState blockstate3 = this.func_196544_a(p_225534_1_, blockstate2, p_225534_4_); - if (blockstate2 != blockstate3 && this.func_196540_x(blockstate3)) { - p_225534_2_.func_180501_a(blockpos1, blockstate3, 2); -@@ -322,4 +322,6 @@ + boolean flag = p_225542_1_.func_177229_b(func_176267_a(direction3)); +@@ -207,7 +207,7 @@ + if (p_225542_3_.func_177956_o() > 0) { + BlockPos blockpos1 = p_225542_3_.func_177977_b(); + BlockState blockstate = p_225542_2_.func_180495_p(blockpos1); +- if (blockstate.func_196958_f() || blockstate.func_203425_a(this)) { ++ if (blockstate.isAir(p_225542_2_, blockpos) || blockstate.func_203425_a(this)) { + BlockState blockstate1 = blockstate.func_196958_f() ? this.func_176223_P() : blockstate; + BlockState blockstate2 = this.func_196544_a(p_225542_1_, blockstate1, p_225542_4_); + if (blockstate1 != blockstate2 && this.func_196540_x(blockstate2)) { +@@ -313,4 +313,7 @@ public static BooleanProperty func_176267_a(Direction p_176267_0_) { return field_196546_A.get(p_176267_0_); } + -+ @Override public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { return true; } ++ @Override ++ public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { return true; } } diff --git a/patches/minecraft/net/minecraft/block/WebBlock.java.patch b/patches/minecraft/net/minecraft/block/WebBlock.java.patch index 49f30cc9e..36ef020f3 100644 --- a/patches/minecraft/net/minecraft/block/WebBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/WebBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/block/WebBlock.java +++ b/net/minecraft/block/WebBlock.java @@ -5,7 +5,7 @@ - import net.minecraft.util.math.Vec3d; + import net.minecraft.util.math.vector.Vector3d; 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_) { + public WebBlock(AbstractBlock.Properties p_i48296_1_) { super(p_i48296_1_); } diff --git a/patches/minecraft/net/minecraft/client/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/GameSettings.java.patch index 20f28711e..4828e5177 100644 --- a/patches/minecraft/net/minecraft/client/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/GameSettings.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/GameSettings.java +++ b/net/minecraft/client/GameSettings.java -@@ -171,6 +171,7 @@ - public String field_74363_ab = "en_us"; +@@ -164,6 +164,7 @@ + public boolean field_241568_aS_; public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) { + setForgeKeybindProperties(); this.field_74317_L = p_i46326_1_; this.field_74354_ai = new File(p_i46326_2_, "options.txt"); if (p_i46326_1_.func_147111_S() && Runtime.getRuntime().maxMemory() >= 1000000000L) { -@@ -490,7 +491,11 @@ +@@ -507,7 +508,11 @@ for(KeyBinding keybinding : this.field_74324_K) { if (s.equals("key_" + keybinding.func_151464_g())) { @@ -21,7 +21,7 @@ } } -@@ -538,6 +543,7 @@ +@@ -554,6 +559,7 @@ } public void func_74303_b() { @@ -29,8 +29,8 @@ try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.field_74354_ai), StandardCharsets.UTF_8))) { printwriter.println("version:" + SharedConstants.func_215069_a().getWorldVersion()); printwriter.println("autoJump:" + AbstractOption.field_216719_z.func_216741_b(this)); -@@ -615,7 +621,7 @@ - printwriter.println("skipMultiplayerWarning:" + this.field_230152_Z_); +@@ -635,7 +641,7 @@ + printwriter.println("syncChunkWrites:" + this.field_241568_aS_); for(KeyBinding keybinding : this.field_74324_K) { - printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m()); @@ -38,7 +38,7 @@ } for(SoundCategory soundcategory : SoundCategory.values()) { -@@ -714,4 +720,22 @@ +@@ -733,4 +739,22 @@ p_198017_1_.func_198985_a(set); } diff --git a/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch b/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch index 9b277462d..bd4e905cc 100644 --- a/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/KeyboardListener.java +++ b/net/minecraft/client/KeyboardListener.java -@@ -251,7 +251,9 @@ +@@ -256,7 +256,9 @@ } INestedGuiEventHandler inestedguieventhandler = this.field_197972_a.field_71462_r; @@ -11,7 +11,7 @@ if (this.field_197972_a.field_71474_y.field_152395_am.func_197976_a(p_197961_3_, p_197961_4_)) { this.field_197972_a.func_228018_at_().func_198077_g(); this.field_197972_a.field_71474_y.field_74353_u = this.field_197972_a.func_228018_at_().func_198113_j(); -@@ -270,6 +272,8 @@ +@@ -275,6 +277,8 @@ }); return; } @@ -19,25 +19,8 @@ + ((ControlsScreen)this.field_197972_a.field_71462_r).field_146491_f = null; //Forge: Unset pure modifiers. } - boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.getFocused() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.getFocused()).func_212955_f(); -@@ -289,10 +293,14 @@ - Screen.wrapScreenError(() -> { - if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.field_197973_b)) { - if (p_197961_5_ == 0) { -- aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); -+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); - } - } else { -- aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); -+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); - } - - }, "keyPressed event handler", inestedguieventhandler.getClass().getCanonicalName()); -@@ -353,7 +361,7 @@ + boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.func_241217_q_() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.func_241217_q_()).func_212955_f(); +@@ -350,7 +354,7 @@ } } } @@ -46,22 +29,3 @@ } } -@@ -363,12 +371,16 @@ - if (iguieventlistener != null && this.field_197972_a.func_213250_au() == null) { - if (Character.charCount(p_197963_3_) == 1) { - Screen.wrapScreenError(() -> { -- iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_); -+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_)) return; -+ if (iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_)) return; -+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_); - }, "charTyped event handler", iguieventlistener.getClass().getCanonicalName()); - } else { - for(char c0 : Character.toChars(p_197963_3_)) { - Screen.wrapScreenError(() -> { -- iguieventlistener.charTyped(c0, p_197963_4_); -+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, c0, p_197963_4_)) return; -+ if (iguieventlistener.charTyped(c0, p_197963_4_)) return; -+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, c0, p_197963_4_); - }, "charTyped event handler", iguieventlistener.getClass().getCanonicalName()); - } - } diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 52729db89..2bb33dfbc 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java -@@ -322,6 +322,7 @@ +@@ -358,6 +358,7 @@ public Minecraft(GameConfiguration p_i45547_1_) { super("Client"); field_71432_P = this; @@ -8,74 +8,34 @@ this.field_71412_D = p_i45547_1_.field_178744_c.field_178760_a; File file1 = p_i45547_1_.field_178744_c.field_178759_c; this.field_130070_K = p_i45547_1_.field_178744_c.field_178758_b; -@@ -336,7 +337,6 @@ +@@ -370,7 +371,6 @@ this.field_152355_az = (new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString())).createMinecraftSessionService(); this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a; field_147123_G.info("Setting user: {}", (Object)this.field_71449_j.func_111285_a()); - field_147123_G.debug("(Session ID is {})", (Object)this.field_71449_j.func_111286_b()); this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a; - this.field_147129_ai = func_147122_X(); - this.field_71437_Z = null; -@@ -350,7 +350,7 @@ - i = 0; - } - -- Bootstrap.func_151354_b(); -+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.func_151354_b(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick); - Bootstrap.func_218821_c(); - KeybindTextComponent.field_193637_b = KeyBinding::func_193626_b; - this.field_184131_U = DataFixesManager.func_210901_a(); -@@ -383,13 +383,13 @@ - - this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i); - this.field_71417_B = new MouseHelper(this); -- this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i()); - this.field_195559_v = new KeyboardListener(this); - this.field_195559_v.func_197968_a(this.field_195558_d.func_198092_i()); - RenderSystem.initRenderer(this.field_71474_y.field_209231_W, false); - this.field_147124_at = new Framebuffer(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), true, field_142025_a); - this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F); - this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, this.field_152352_aC); -+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax); - this.field_71474_y.func_198017_a(this.field_110448_aq); - this.field_110448_aq.func_198983_a(); - this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab); -@@ -434,12 +434,14 @@ - this.func_193986_ar(); - this.field_110451_am.func_219534_a(this.field_193995_ae); - this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o); -+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.ParticleFactoryRegisterEvent()); - this.field_110451_am.func_219534_a(this.field_71452_i); - this.field_213272_aL = new PaintingSpriteUploader(this.field_71446_o); - this.field_110451_am.func_219534_a(this.field_213272_aL); - this.field_213273_aM = new PotionSpriteUploader(this.field_71446_o); - this.field_110451_am.func_219534_a(this.field_213273_aM); -- this.field_71456_v = new IngameGui(this); -+ this.field_71456_v = new net.minecraftforge.client.gui.ForgeIngameGui(this); -+ this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler. - this.field_184132_p = new DebugRenderer(this); - RenderSystem.setErrorCallback(this::func_195545_a); - if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) { -@@ -451,12 +453,11 @@ - this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E); - this.field_195558_d.func_227801_c_(); - this.func_213226_a(); -- if (s != null) { -- this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, s, i)); -- } else { -- this.func_147108_a(new MainMenuScreen(true)); -- } + this.field_238175_ae_ = !p_i45547_1_.field_178741_d.field_239099_d_; + this.field_238176_af_ = !p_i45547_1_.field_178741_d.field_239100_e_; +@@ -482,12 +482,11 @@ + this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E); + this.field_195558_d.func_227801_c_(); + this.func_213226_a(); +- if (s != null) { +- this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, s, i)); +- } else { +- this.func_147108_a(new MainMenuScreen(true)); +- } + //Final needed so we can move into lambda below. + final String autoServerName = s; + final int autoServerPort = i; + - ResourceLoadProgressGui.func_212970_a(this); - List list = this.field_110448_aq.func_198980_d().stream().map(ResourcePackInfo::func_195796_e).collect(Collectors.toList()); - this.func_213268_a(new ResourceLoadProgressGui(this, this.field_110451_am.func_219537_a(Util.func_215072_e(), this, field_223714_G, list), (p_229990_2_) -> { -@@ -466,6 +467,14 @@ - this.func_213256_aB(); - } + ResourceLoadProgressGui.func_212970_a(this); + List list = this.field_110448_aq.func_232623_f_(); + this.func_213268_a(new ResourceLoadProgressGui(this, this.field_110451_am.func_219537_a(Util.func_215072_e(), this, field_223714_G, list), (p_238197_1_) -> { +@@ -496,6 +495,14 @@ + this.func_213256_aB(); + } + if (net.minecraftforge.fml.client.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen + // FORGE: Move opening initial screen to after startup and events are enabled. @@ -85,19 +45,19 @@ + } else { + this.func_147108_a(new MainMenuScreen(true)); + } - }); - }, false)); - } -@@ -505,7 +514,7 @@ + }); + }, false)); + } +@@ -534,7 +541,7 @@ } private void func_229988_a_(Throwable p_229988_1_) { -- if (this.field_110448_aq.func_198980_d().size() > 1) { +- if (this.field_110448_aq.func_232621_d_().size() > 1) { + if (this.field_110448_aq.func_198980_d().stream().anyMatch(e -> !e.func_195797_g())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any. ITextComponent itextcomponent; if (p_229988_1_ instanceof SimpleReloadableResourceManager.FailedPackException) { - itextcomponent = new StringTextComponent(((SimpleReloadableResourceManager.FailedPackException)p_229988_1_).func_230028_a().func_195762_a()); -@@ -579,7 +588,7 @@ + itextcomponent = new StringTextComponent(((SimpleReloadableResourceManager.FailedPackException)p_229988_1_).func_241203_a().func_195762_a()); +@@ -618,7 +625,7 @@ return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b())); }); SearchTreeReloadable searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> { @@ -106,7 +66,7 @@ }); NonNullList nonnulllist = NonNullList.func_191196_a(); -@@ -667,13 +676,13 @@ +@@ -688,13 +695,13 @@ Bootstrap.func_179870_a(p_71377_0_.func_71502_e()); if (p_71377_0_.func_71497_f() != null) { Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.func_71497_f()); @@ -123,7 +83,7 @@ } } -@@ -682,6 +691,7 @@ +@@ -703,6 +710,7 @@ return this.field_71474_y.field_211842_aO; } @@ -131,18 +91,18 @@ public CompletableFuture func_213237_g() { if (this.field_213276_aV != null) { return this.field_213276_aV; -@@ -760,10 +770,6 @@ +@@ -791,10 +799,6 @@ } public void func_147108_a(@Nullable Screen p_147108_1_) { - if (this.field_71462_r != null) { -- this.field_71462_r.removed(); +- this.field_71462_r.func_231164_f_(); - } - if (p_147108_1_ == null && this.field_71441_e == null) { p_147108_1_ = new MainMenuScreen(); - } else if (p_147108_1_ == null && this.field_71439_g.func_110143_aJ() <= 0.0F) { -@@ -774,6 +780,14 @@ + } else if (p_147108_1_ == null && this.field_71439_g.func_233643_dh_()) { +@@ -805,6 +809,14 @@ } } @@ -152,26 +112,26 @@ + + p_147108_1_ = event.getGui(); + if (old != null && p_147108_1_ != old) -+ old.removed(); ++ old.func_231164_f_(); + if (p_147108_1_ instanceof MainMenuScreen || p_147108_1_ instanceof MultiplayerScreen) { this.field_71474_y.field_74330_P = false; this.field_71456_v.func_146158_b().func_146231_a(true); -@@ -905,11 +919,13 @@ - RenderSystem.enableTexture(); +@@ -936,11 +948,13 @@ + RenderSystem.enableCull(); this.field_71424_I.func_76319_b(); if (!this.field_71454_w) { + net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickStart(this.field_71428_T.field_194147_b); this.field_71424_I.func_219895_b("gameRenderer"); this.field_71460_t.func_195458_a(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b, i, p_195542_1_); this.field_71424_I.func_219895_b("toasts"); - this.field_193034_aS.func_195625_a(); + this.field_193034_aS.func_238541_a_(new MatrixStack()); this.field_71424_I.func_76319_b(); + net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickEnd(this.field_71428_T.field_194147_b); } - this.field_71424_I.func_219897_b(); -@@ -976,7 +992,7 @@ + if (this.field_238174_aV_ != null) { +@@ -1039,7 +1053,7 @@ Framebuffer framebuffer = this.func_147110_a(); framebuffer.func_216491_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), field_142025_a); @@ -180,7 +140,7 @@ this.field_71417_B.func_198021_g(); } -@@ -1164,11 +1180,21 @@ +@@ -1227,11 +1241,21 @@ if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) { BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x; BlockPos blockpos = blockraytraceresult.func_216350_a(); @@ -204,7 +164,7 @@ } } -@@ -1187,6 +1213,8 @@ +@@ -1250,6 +1274,8 @@ } } else if (!this.field_71439_g.func_184838_M()) { @@ -213,7 +173,7 @@ switch(this.field_71476_x.func_216346_c()) { case ENTITY: this.field_71442_b.func_78764_a(this.field_71439_g, ((EntityRayTraceResult)this.field_71476_x).func_216348_a()); -@@ -1194,7 +1222,7 @@ +@@ -1257,7 +1283,7 @@ case BLOCK: BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x; BlockPos blockpos = blockraytraceresult.func_216350_a(); @@ -222,7 +182,7 @@ this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b()); break; } -@@ -1204,8 +1232,10 @@ +@@ -1267,8 +1293,10 @@ } this.field_71439_g.func_184821_cY(); @@ -233,7 +193,7 @@ this.field_71439_g.func_184609_a(Hand.MAIN_HAND); } } -@@ -1220,6 +1250,11 @@ +@@ -1283,6 +1311,11 @@ } for(Hand hand : Hand.values()) { @@ -245,7 +205,7 @@ ItemStack itemstack = this.field_71439_g.func_184586_b(hand); if (this.field_71476_x != null) { switch(this.field_71476_x.func_216346_c()) { -@@ -1233,6 +1268,7 @@ +@@ -1296,6 +1329,7 @@ if (actionresulttype.func_226246_a_()) { if (actionresulttype.func_226247_b_()) { @@ -253,7 +213,7 @@ this.field_71439_g.func_184609_a(hand); } -@@ -1245,6 +1281,7 @@ +@@ -1308,6 +1342,7 @@ ActionResultType actionresulttype1 = this.field_71442_b.func_217292_a(this.field_71439_g, this.field_71441_e, hand, blockraytraceresult); if (actionresulttype1.func_226246_a_()) { if (actionresulttype1.func_226247_b_()) { @@ -261,7 +221,7 @@ this.field_71439_g.func_184609_a(hand); if (!itemstack.func_190926_b() && (itemstack.func_190916_E() != i || this.field_71442_b.func_78758_h())) { this.field_71460_t.field_78516_c.func_187460_a(hand); -@@ -1260,6 +1297,9 @@ +@@ -1323,6 +1358,9 @@ } } @@ -271,7 +231,7 @@ if (!itemstack.func_190926_b()) { ActionResultType actionresulttype2 = this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand); if (actionresulttype2.func_226246_a_()) { -@@ -1286,6 +1326,8 @@ +@@ -1349,6 +1387,8 @@ --this.field_71467_ac; } @@ -280,7 +240,7 @@ this.field_71424_I.func_76320_a("gui"); if (!this.field_71445_n) { this.field_71456_v.func_73831_a(); -@@ -1403,6 +1445,8 @@ +@@ -1465,6 +1505,8 @@ this.field_71424_I.func_219895_b("keyboard"); this.field_195559_v.func_204870_b(); this.field_71424_I.func_76319_b(); @@ -289,31 +249,20 @@ } private void func_184117_aA() { -@@ -1557,6 +1601,12 @@ - this.func_147108_a(worldloadprogressscreen); - - while(!this.field_71437_Z.func_71200_ad()) { -+ if (!net.minecraftforge.fml.StartupQuery.check() || this.field_71437_Z.func_71241_aa()) { -+ this.func_147108_a(null); -+ return; -+ } else if (this.field_71462_r == null) // if we're showing nothing, put the working screen back again -+ this.func_147108_a(worldloadprogressscreen); -+ - worldloadprogressscreen.tick(); - this.func_195542_b(false); - -@@ -1577,11 +1627,17 @@ - networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> { - })); - networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN)); -- networkmanager.func_179290_a(new CLoginStartPacket(this.func_110432_I().func_148256_e())); -+ com.mojang.authlib.GameProfile gameProfile = this.func_110432_I().func_148256_e(); -+ if (!this.func_110432_I().hasCachedProperties()) { -+ gameProfile = field_152355_az.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. -+ this.func_110432_I().setProperties(gameProfile.getProperties()); -+ } -+ networkmanager.func_179290_a(new CLoginStartPacket(gameProfile)); - this.field_71453_ak = networkmanager; +@@ -1697,6 +1739,12 @@ + })); + networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN)); + networkmanager.func_179290_a(new CLoginStartPacket(this.func_110432_I().func_148256_e())); ++ com.mojang.authlib.GameProfile gameProfile = this.func_110432_I().func_148256_e(); ++ if (!this.func_110432_I().hasCachedProperties()) { ++ gameProfile = field_152355_az.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. ++ this.func_110432_I().setProperties(gameProfile.getProperties()); ++ } ++ networkmanager.func_179290_a(new CLoginStartPacket(gameProfile)); + this.field_71453_ak = networkmanager; + } else { + this.func_241559_a_(p_238195_6_, p_238195_1_, flag, () -> { +@@ -1770,6 +1818,7 @@ } public void func_71403_a(ClientWorld p_71403_1_) { @@ -321,7 +270,7 @@ WorkingScreen workingscreen = new WorkingScreen(); workingscreen.func_200210_a(new TranslationTextComponent("connect.joining")); this.func_213241_c(workingscreen); -@@ -1613,10 +1669,12 @@ +@@ -1801,10 +1850,12 @@ IntegratedServer integratedserver = this.field_71437_Z; this.field_71437_Z = null; this.field_71460_t.func_190564_k(); @@ -332,9 +281,9 @@ if (this.field_71441_e != null) { + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e)); if (integratedserver != null) { - while(!integratedserver.func_213201_w()) { - this.func_195542_b(false); -@@ -1627,6 +1685,7 @@ + this.field_71424_I.func_76320_a("waitForServer"); + +@@ -1819,6 +1870,7 @@ this.field_71456_v.func_181029_i(); this.field_71422_O = null; this.field_71455_al = false; @@ -342,131 +291,15 @@ this.field_213274_aO.func_216815_b(); } -@@ -1649,6 +1708,7 @@ +@@ -1849,6 +1901,7 @@ this.field_71452_i.func_78870_a(p_213257_1_); TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_); this.func_230150_b_(); + net.minecraftforge.client.MinecraftForgeClient.clearRenderCache(); } - public final boolean func_71355_q() { -@@ -1674,112 +1734,9 @@ - - private void func_147112_ai() { - if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) { -- boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d; -- TileEntity tileentity = null; -- RayTraceResult.Type raytraceresult$type = this.field_71476_x.func_216346_c(); -- ItemStack itemstack; -- if (raytraceresult$type == RayTraceResult.Type.BLOCK) { -- BlockPos blockpos = ((BlockRayTraceResult)this.field_71476_x).func_216350_a(); -- BlockState blockstate = this.field_71441_e.func_180495_p(blockpos); -- Block block = blockstate.func_177230_c(); -- if (blockstate.func_196958_f()) { -- return; -- } -- -- itemstack = block.func_185473_a(this.field_71441_e, blockpos, blockstate); -- if (itemstack.func_190926_b()) { -- return; -- } -- -- if (flag && Screen.hasControlDown() && block.func_149716_u()) { -- tileentity = this.field_71441_e.func_175625_s(blockpos); -- } -- } else { -- if (raytraceresult$type != RayTraceResult.Type.ENTITY || !flag) { -- return; -- } -- -- Entity entity = ((EntityRayTraceResult)this.field_71476_x).func_216348_a(); -- if (entity instanceof PaintingEntity) { -- itemstack = new ItemStack(Items.field_151159_an); -- } else if (entity instanceof LeashKnotEntity) { -- itemstack = new ItemStack(Items.field_151058_ca); -- } else if (entity instanceof ItemFrameEntity) { -- ItemFrameEntity itemframeentity = (ItemFrameEntity)entity; -- ItemStack itemstack1 = itemframeentity.func_82335_i(); -- if (itemstack1.func_190926_b()) { -- itemstack = new ItemStack(Items.field_151160_bD); -- } else { -- itemstack = itemstack1.func_77946_l(); -- } -- } else if (entity instanceof AbstractMinecartEntity) { -- AbstractMinecartEntity abstractminecartentity = (AbstractMinecartEntity)entity; -- Item item; -- switch(abstractminecartentity.func_184264_v()) { -- case FURNACE: -- item = Items.field_151109_aJ; -- break; -- case CHEST: -- item = Items.field_151108_aI; -- break; -- case TNT: -- item = Items.field_151142_bV; -- break; -- case HOPPER: -- item = Items.field_151140_bW; -- break; -- case COMMAND_BLOCK: -- item = Items.field_151095_cc; -- break; -- default: -- item = Items.field_151143_au; -- } -- -- itemstack = new ItemStack(item); -- } else if (entity instanceof BoatEntity) { -- itemstack = new ItemStack(((BoatEntity)entity).func_184455_j()); -- } else if (entity instanceof ArmorStandEntity) { -- itemstack = new ItemStack(Items.field_179565_cj); -- } else if (entity instanceof EnderCrystalEntity) { -- itemstack = new ItemStack(Items.field_185158_cP); -- } else { -- SpawnEggItem spawneggitem = SpawnEggItem.func_200889_b(entity.func_200600_R()); -- if (spawneggitem == null) { -- return; -- } -- -- itemstack = new ItemStack(spawneggitem); -- } -- } -- -- if (itemstack.func_190926_b()) { -- String s = ""; -- if (raytraceresult$type == RayTraceResult.Type.BLOCK) { -- s = Registry.field_212618_g.func_177774_c(this.field_71441_e.func_180495_p(((BlockRayTraceResult)this.field_71476_x).func_216350_a()).func_177230_c()).toString(); -- } else if (raytraceresult$type == RayTraceResult.Type.ENTITY) { -- s = Registry.field_212629_r.func_177774_c(((EntityRayTraceResult)this.field_71476_x).func_216348_a().func_200600_R()).toString(); -- } -- -- field_147123_G.warn("Picking on: [{}] {} gave null item", raytraceresult$type, s); -- } else { -- PlayerInventory playerinventory = this.field_71439_g.field_71071_by; -- if (tileentity != null) { -- this.func_184119_a(itemstack, tileentity); -- } -- -- int i = playerinventory.func_184429_b(itemstack); -- if (flag) { -- playerinventory.func_184434_a(itemstack); -- this.field_71442_b.func_78761_a(this.field_71439_g.func_184586_b(Hand.MAIN_HAND), 36 + playerinventory.field_70461_c); -- } else if (i != -1) { -- if (PlayerInventory.func_184435_e(i)) { -- playerinventory.field_70461_c = i; -- } else { -- this.field_71442_b.func_187100_a(i); -- } -- } -- -- } -+ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.field_71474_y.field_74322_I, Hand.MAIN_HAND).isCanceled()) -+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e); -+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions - } - } - -@@ -1861,6 +1818,7 @@ + public boolean func_238216_r_() { +@@ -2081,6 +2134,7 @@ return field_71432_P; } @@ -474,29 +307,10 @@ public CompletableFuture func_213245_w() { return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> { return p_229993_0_; -@@ -1988,6 +1946,8 @@ - } - - public MusicTicker.MusicType func_147109_W() { -+ MusicTicker.MusicType type = this.field_71441_e == null || this.field_71441_e.field_73011_w == null ? null : this.field_71441_e.field_73011_w.getMusicType(); -+ if (type != null) return type; - if (this.field_71462_r instanceof WinGameScreen) { - return MusicTicker.MusicType.CREDITS; - } else if (this.field_71439_g == null) { -@@ -2164,7 +2124,7 @@ - supplier = func_228022_c_(supplier); - } - -- return new ClientResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_); -+ return new ClientResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_, p_228011_3_.isHidden()); - } - - private static Supplier func_228021_b_(Supplier p_228021_0_) { -@@ -2182,4 +2142,12 @@ - public void func_228020_b_(int p_228020_1_) { +@@ -2407,6 +2461,14 @@ this.field_175617_aL.func_229355_a_(p_228020_1_); } -+ + + public ItemColors getItemColors() { + return this.field_184128_aI; + } @@ -504,4 +318,7 @@ + public SearchTreeManager getSearchTreeManager() { + return this.field_193995_ae; + } - } ++ + @OnlyIn(Dist.CLIENT) + public static final class PackManager implements AutoCloseable { + private final ResourcePackList field_238221_a_; diff --git a/patches/minecraft/net/minecraft/client/MouseHelper.java.patch b/patches/minecraft/net/minecraft/client/MouseHelper.java.patch index 7919bd9f9..ba1712f74 100644 --- a/patches/minecraft/net/minecraft/client/MouseHelper.java.patch +++ b/patches/minecraft/net/minecraft/client/MouseHelper.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/MouseHelper.java +++ b/net/minecraft/client/MouseHelper.java -@@ -66,6 +66,7 @@ +@@ -71,6 +71,7 @@ this.field_198042_g = -1; } @@ -8,25 +8,7 @@ boolean[] aboolean = new boolean[]{false}; if (this.field_198036_a.field_213279_p == null) { if (this.field_198036_a.field_71462_r == null) { -@@ -77,11 +78,15 @@ - double d1 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n(); - if (flag) { - Screen.wrapScreenError(() -> { -- aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, i); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.field_198036_a.field_71462_r, d0, d1, i); -+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, i); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.field_198036_a.field_71462_r, d0, d1, i); - }, "mouseClicked event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName()); - } else { - Screen.wrapScreenError(() -> { -- aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, i); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.field_198036_a.field_71462_r, d0, d1, i); -+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, i); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.field_198036_a.field_71462_r, d0, d1, i); - }, "mouseReleased event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName()); - } - } -@@ -105,7 +110,7 @@ +@@ -110,7 +111,7 @@ } } } @@ -35,18 +17,7 @@ } } -@@ -116,7 +121,9 @@ - if (this.field_198036_a.field_71462_r != null) { - double d1 = this.field_198040_e * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m(); - double d2 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n(); -- this.field_198036_a.field_71462_r.mouseScrolled(d1, d2, d0); -+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.field_198036_a.field_71462_r, d0)) return; -+ if (this.field_198036_a.field_71462_r.mouseScrolled(d1, d2, d0)) return; -+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.field_198036_a.field_71462_r, d0); - } else if (this.field_198036_a.field_71439_g != null) { - if (this.field_200542_o != 0.0D && Math.signum(d0) != Math.signum(this.field_200542_o)) { - this.field_200542_o = 0.0D; -@@ -129,6 +136,7 @@ +@@ -134,6 +135,7 @@ } this.field_200542_o -= (double)f1; @@ -54,18 +25,7 @@ if (this.field_198036_a.field_71439_g.func_175149_v()) { if (this.field_198036_a.field_71456_v.func_175187_g().func_175262_a()) { this.field_198036_a.field_71456_v.func_175187_g().func_195621_a((double)(-f1)); -@@ -180,7 +188,9 @@ - double d2 = (p_198022_3_ - this.field_198040_e) * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m(); - double d3 = (p_198022_5_ - this.field_198041_f) * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n(); - Screen.wrapScreenError(() -> { -- iguieventlistener.mouseDragged(d0, d1, this.field_198042_g, d2, d3); -+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3)) return; -+ if (iguieventlistener.mouseDragged(d0, d1, this.field_198042_g, d2, d3)) return; -+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3); - }, "mouseDragged event handler", iguieventlistener.getClass().getCanonicalName()); - } - } -@@ -245,6 +255,10 @@ +@@ -267,6 +269,10 @@ return this.field_198039_d; } @@ -76,7 +36,7 @@ public double func_198024_e() { return this.field_198040_e; } -@@ -253,6 +267,14 @@ +@@ -275,6 +281,14 @@ return this.field_198041_f; } diff --git a/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch index 45037cd56..677ac386a 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/audio/SoundEngine.java +++ b/net/minecraft/client/audio/SoundEngine.java -@@ -55,6 +55,7 @@ +@@ -56,6 +56,7 @@ this.field_148622_c = p_i50892_1_; this.field_148619_d = p_i50892_2_; this.field_217939_i = new AudioStreamManager(p_i50892_3_); @@ -8,7 +8,7 @@ } public void func_148596_a() { -@@ -70,6 +71,7 @@ +@@ -71,6 +72,7 @@ this.func_148613_b(); this.func_148608_i(); @@ -16,34 +16,35 @@ } private synchronized void func_148608_i() { -@@ -251,6 +253,8 @@ +@@ -266,7 +268,8 @@ public void func_148611_c(ISound p_148611_1_) { if (this.field_148617_f) { +- if (p_148611_1_.func_230510_t_()) { + 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) { -@@ -305,11 +309,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_)); ++ if (p_148611_1_ != null && p_148611_1_.func_230510_t_()) { + SoundEventAccessor soundeventaccessor = p_148611_1_.func_184366_a(this.field_148622_c); + ResourceLocation resourcelocation = p_148611_1_.func_147650_b(); + if (soundeventaccessor == null) { +@@ -331,11 +334,13 @@ + p_239543_8_.func_216420_a(vector3d); + p_239543_8_.func_216432_b(flag); }); - }); - } else { -@@ -317,6 +323,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_)); - }); - }); - } ++ final ISound isound = p_148611_1_; + if (!flag3) { + 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 { +@@ -343,6 +348,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 9fdfde39c..c7ef4ce9d 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/audio/SoundHandler.java +++ b/net/minecraft/client/audio/SoundHandler.java -@@ -214,6 +214,11 @@ +@@ -192,6 +192,11 @@ this.field_147694_f.func_195855_a(p_195478_1_, p_195478_2_); } diff --git a/patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch b/patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch index da4b1b55a..de496ed5c 100644 --- a/patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java +++ b/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java -@@ -115,7 +115,7 @@ +@@ -113,7 +113,7 @@ f = 1.0F; } @@ -9,7 +9,7 @@ int i = this.func_184612_cw(); float f1 = (float)i / 20.0F; if (f1 > 1.0F) { -@@ -127,6 +127,6 @@ +@@ -125,6 +125,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 index 95f656936..3dbf3cc31 100644 --- a/patches/minecraft/net/minecraft/client/entity/player/ClientPlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/player/ClientPlayerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/entity/player/ClientPlayerEntity.java +++ b/net/minecraft/client/entity/player/ClientPlayerEntity.java -@@ -134,6 +134,7 @@ +@@ -133,6 +133,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -8,7 +8,7 @@ return false; } -@@ -458,6 +459,11 @@ +@@ -479,6 +480,11 @@ } public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) { @@ -20,15 +20,15 @@ this.field_70170_p.func_184134_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); } -@@ -599,6 +605,7 @@ - boolean flag1 = this.field_71158_b.field_228350_h_; +@@ -617,6 +623,7 @@ boolean flag2 = this.func_223110_ee(); + this.field_239203_ch_ = !this.field_71075_bZ.field_75100_b && !this.func_203007_ba() && this.func_213298_c(Pose.CROUCHING) && (this.func_225608_bj_() || !this.func_70608_bn() && !this.func_213298_c(Pose.STANDING)); this.field_71158_b.func_225607_a_(this.func_228354_I_()); + 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; -@@ -613,11 +620,12 @@ +@@ -631,11 +638,12 @@ this.field_71158_b.field_78901_c = true; } @@ -45,8 +45,8 @@ + this.func_213282_i(this.func_226277_ct_() + (double)this.func_213311_cf() * 0.35D, event.getMinY(), this.func_226281_cx_() + (double)this.func_213311_cf() * 0.35D); } - boolean flag4 = (float)this.func_71024_bL().func_75116_a() > 6.0F || this.field_71075_bZ.field_75101_c; -@@ -961,4 +969,16 @@ + if (flag1) { +@@ -985,4 +993,16 @@ return this.field_204230_bP; } } diff --git a/patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch b/patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch index 912082d64..d54f3d34d 100644 --- a/patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java +++ b/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java -@@ -28,6 +28,7 @@ +@@ -29,6 +29,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 index bce2f11bd..3d92abefa 100644 --- a/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch @@ -1,28 +1,33 @@ --- a/net/minecraft/client/gui/DisplayEffectsScreen.java +++ b/net/minecraft/client/gui/DisplayEffectsScreen.java -@@ -34,6 +34,7 @@ - this.field_147003_i = (this.width - this.field_146999_f) / 2; +@@ -35,6 +35,9 @@ + this.field_147003_i = (this.field_230708_k_ - 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.width - this.field_146999_f) / 2; else - this.field_147003_i = 160 + (this.width - this.field_146999_f - 200) / 2; ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.PotionShiftEvent(this))) ++ this.field_147003_i = (this.field_230708_k_ - this.field_146999_f) / 2; ++ else + this.field_147003_i = 160 + (this.field_230708_k_ - this.field_146999_f - 200) / 2; this.field_147045_u = true; } -@@ -58,7 +59,7 @@ +@@ -59,7 +62,7 @@ j = 132 / (collection.size() - 1); } -- Iterable iterable = Ordering.natural().sortedCopy(collection); -+ Iterable iterable = collection.stream().filter( effectInstance -> effectInstance.shouldRender()).sorted().collect(java.util.stream.Collectors.toList()); - this.func_214079_a(i, j, iterable); - this.func_214077_b(i, j, iterable); - this.func_214078_c(i, j, iterable); -@@ -95,6 +96,8 @@ +- Iterable iterable = Ordering.natural().sortedCopy(collection); ++ Iterable iterable = collection.stream().filter(effectInstance -> effectInstance.shouldRender()).sorted().collect(java.util.stream.Collectors.toList()); + this.func_238810_a_(p_238811_1_, i, j, iterable); + this.func_238812_b_(p_238811_1_, i, j, iterable); + this.func_238813_c_(p_238811_1_, i, j, iterable); +@@ -96,6 +99,11 @@ int i = this.field_147009_r; - for(EffectInstance effectinstance : p_214078_3_) { -+ effectinstance.renderInventoryEffect(this, p_214078_1_, i, this.getBlitOffset()); -+ if (!effectinstance.shouldRenderInvText()) { i += p_214078_2_; continue; } + for(EffectInstance effectinstance : p_238813_4_) { ++ effectinstance.renderInventoryEffect(this, p_238813_1_, p_238813_2_, i, this.func_230927_p_()); ++ if (!effectinstance.shouldRenderInvText()) { ++ i += p_238813_3_; ++ 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/IngameGui.java.patch b/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch index 047eb3d85..080ef2c40 100644 --- a/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/IngameGui.java +++ b/net/minecraft/client/gui/IngameGui.java -@@ -406,6 +406,9 @@ +@@ -416,6 +416,9 @@ for(EffectInstance effectinstance : Ordering.natural().reverse().sortedCopy(collection)) { Effect effect = effectinstance.func_188419_a(); @@ -10,42 +10,45 @@ if (effectinstance.func_205348_f()) { int k = this.field_194811_H; int l = 1; -@@ -443,6 +446,7 @@ +@@ -453,6 +456,7 @@ RenderSystem.color4f(1.0F, 1.0F, 1.0F, f1); - blit(j1 + 3, k1 + 3, this.getBlitOffset(), 18, 18, textureatlassprite); + func_238470_a_(p_238444_1_, j1 + 3, k1 + 3, this.func_230927_p_(), 18, 18, textureatlassprite); }); -+ effectinstance.renderHUDEffect(this, k, l, this.getBlitOffset(), f); ++ effectinstance.renderHUDEffect(this, p_238444_1_, k, l, this.func_230927_p_(), f); } } -@@ -568,6 +572,7 @@ +@@ -577,7 +581,8 @@ + iformattabletextcomponent.func_240699_a_(TextFormatting.ITALIC); } - String s = itextcomponent.func_150254_d(); -+ s = this.field_92016_l.getHighlightTip(s); - int i = (this.field_194811_H - this.func_175179_f().func_78256_a(s)) / 2; - int j = this.field_194812_I - 59; +- int i = this.func_175179_f().func_238414_a_(iformattabletextcomponent); ++ ITextComponent highlightTip = this.field_92016_l.getHighlightTip(iformattabletextcomponent); ++ int i = this.func_175179_f().func_238414_a_(highlightTip); + int j = (this.field_194811_H - i) / 2; + int k = this.field_194812_I - 59; if (!this.field_73839_d.field_71442_b.func_78755_b()) { -@@ -584,7 +589,13 @@ +@@ -594,7 +599,13 @@ RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); - 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)); + func_238467_a_(p_238453_1_, j - 2, k - 2, j + i + 2, k + 9 + 2, this.field_73839_d.field_71474_y.func_216839_a(0)); +- this.func_175179_f().func_238407_a_(p_238453_1_, iformattabletextcomponent, (float)j, (float)k, 16777215 + (l << 24)); + FontRenderer font = field_92016_l.func_77973_b().getFontRenderer(field_92016_l); + if (font == null) { - this.func_175179_f().func_175063_a(s, (float)i, (float)j, 16777215 + (k << 24)); ++ this.func_175179_f().func_238407_a_(p_238453_1_, highlightTip, (float)j, (float)k, 16777215 + (l << 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)); ++ j = (this.field_194811_H - font.func_238414_a_(highlightTip)) / 2; ++ font.func_238407_a_(p_238453_1_, highlightTip, (float)j, (float)k, 16777215 + (l << 24)); + } RenderSystem.disableBlend(); RenderSystem.popMatrix(); } -@@ -1045,7 +1056,7 @@ +@@ -1057,7 +1068,7 @@ ItemStack itemstack = this.field_73839_d.field_71439_g.field_71071_by.func_70448_g(); if (itemstack.func_190926_b()) { this.field_92017_k = 0; - } else if (!this.field_92016_l.func_190926_b() && itemstack.func_77973_b() == this.field_92016_l.func_77973_b() && itemstack.func_200301_q().equals(this.field_92016_l.func_200301_q())) { -+ } else if (!this.field_92016_l.func_190926_b() && itemstack.func_77973_b() == this.field_92016_l.func_77973_b() && (itemstack.func_200301_q().equals(this.field_92016_l.func_200301_q()) && itemstack.getHighlightTip(itemstack.func_200301_q().func_150261_e()).equals(field_92016_l.getHighlightTip(field_92016_l.func_200301_q().func_150261_e())))) { ++ } else if (!this.field_92016_l.func_190926_b() && itemstack.func_77973_b() == this.field_92016_l.func_77973_b() && (itemstack.func_200301_q().equals(this.field_92016_l.func_200301_q()) && itemstack.getHighlightTip(itemstack.func_200301_q()).equals(field_92016_l.getHighlightTip(field_92016_l.func_200301_q())))) { if (this.field_92017_k > 0) { --this.field_92017_k; } diff --git a/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch index 384db2c54..58ca94458 100644 --- a/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/MapItemRenderer.java +++ b/net/minecraft/client/gui/MapItemRenderer.java -@@ -114,6 +114,7 @@ +@@ -115,6 +115,7 @@ for(MapDecoration mapdecoration : this.field_148242_b.field_76203_h.values()) { if (!p_228089_3_ || mapdecoration.func_191180_f()) { diff --git a/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch b/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch index 31774de27..57e6c839e 100644 --- a/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/gui/ResourceLoadProgressGui.java +++ b/net/minecraft/client/gui/ResourceLoadProgressGui.java -@@ -81,6 +81,7 @@ - this.blit(k1, i1, 0, 0, 256, 256); +@@ -97,6 +97,7 @@ + int l1 = (int)((double)this.field_212974_b.func_228018_at_().func_198087_p() * 0.8325D); float f3 = this.field_212975_c.func_219555_b(); this.field_212978_f = MathHelper.func_76131_a(this.field_212978_f * 0.95F + f3 * 0.050000012F, 0.0F, 1.0F); + net.minecraftforge.fml.client.ClientModLoader.renderProgressText(); if (f < 1.0F) { - this.func_228181_a_(i / 2 - 150, j / 4 * 3, i / 2 + 150, j / 4 * 3 + 10, 1.0F - MathHelper.func_76131_a(f, 0.0F, 1.0F)); + this.func_238629_a_(p_230430_1_, i / 2 - k1, l1 - 5, i / 2 + k1, l1 + 5, 1.0F - MathHelper.func_76131_a(f, 0.0F, 1.0F)); } -@@ -90,6 +91,7 @@ +@@ -106,6 +107,7 @@ } if (this.field_212979_g == -1L && this.field_212975_c.func_219554_d() && (!this.field_212977_e || f1 >= 2.0F)) { @@ -16,11 +16,11 @@ try { this.field_212975_c.func_219556_e(); this.field_212976_d.accept(Optional.empty()); -@@ -97,7 +99,6 @@ +@@ -113,7 +115,6 @@ this.field_212976_d.accept(Optional.of(throwable)); } - this.field_212979_g = Util.func_211177_b(); if (this.field_212974_b.field_71462_r != null) { - this.field_212974_b.field_71462_r.init(this.field_212974_b, this.field_212974_b.func_228018_at_().func_198107_o(), this.field_212974_b.func_228018_at_().func_198087_p()); + this.field_212974_b.field_71462_r.func_231158_b_(this.field_212974_b, this.field_212974_b.func_228018_at_().func_198107_o(), this.field_212974_b.func_228018_at_().func_198087_p()); } diff --git a/patches/minecraft/net/minecraft/client/gui/ScreenManager.java.patch b/patches/minecraft/net/minecraft/client/gui/ScreenManager.java.patch index 59b9cea2f..8227b04c0 100644 --- a/patches/minecraft/net/minecraft/client/gui/ScreenManager.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/ScreenManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/ScreenManager.java +++ b/net/minecraft/client/gui/ScreenManager.java -@@ -39,6 +39,10 @@ +@@ -40,6 +40,10 @@ private static final Map, ScreenManager.IScreenFactory> field_216914_b = Maps.newHashMap(); public static void func_216909_a(@Nullable ContainerType p_216909_0_, Minecraft p_216909_1_, int p_216909_2_, ITextComponent p_216909_3_) { @@ -11,7 +11,7 @@ if (p_216909_0_ == null) { field_216913_a.warn("Trying to open invalid screen with name: {}", (Object)p_216909_3_.getString()); } else { -@@ -46,9 +50,10 @@ +@@ -47,9 +51,10 @@ if (iscreenfactory == null) { field_216913_a.warn("Failed to create screen for menu type: {}", (Object)Registry.field_218366_G.func_177774_c(p_216909_0_)); } else { diff --git a/patches/minecraft/net/minecraft/client/gui/SlotGui.java.patch b/patches/minecraft/net/minecraft/client/gui/SlotGui.java.patch deleted file mode 100644 index 5dadc0cf1..000000000 --- a/patches/minecraft/net/minecraft/client/gui/SlotGui.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/net/minecraft/client/gui/SlotGui.java -+++ b/net/minecraft/client/gui/SlotGui.java -@@ -153,15 +153,8 @@ - this.capYPosition(); - Tessellator tessellator = Tessellator.func_178181_a(); - BufferBuilder bufferbuilder = tessellator.func_178180_c(); -- this.minecraft.func_110434_K().func_110577_a(AbstractGui.BACKGROUND_LOCATION); -- RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); -- float f = 32.0F; -- bufferbuilder.func_181668_a(7, DefaultVertexFormats.field_181709_i); -- bufferbuilder.func_225582_a_((double)this.x0, (double)this.y1, 0.0D).func_225583_a_((float)this.x0 / 32.0F, (float)(this.y1 + (int)this.yo) / 32.0F).func_225586_a_(32, 32, 32, 255).func_181675_d(); -- bufferbuilder.func_225582_a_((double)this.x1, (double)this.y1, 0.0D).func_225583_a_((float)this.x1 / 32.0F, (float)(this.y1 + (int)this.yo) / 32.0F).func_225586_a_(32, 32, 32, 255).func_181675_d(); -- bufferbuilder.func_225582_a_((double)this.x1, (double)this.y0, 0.0D).func_225583_a_((float)this.x1 / 32.0F, (float)(this.y0 + (int)this.yo) / 32.0F).func_225586_a_(32, 32, 32, 255).func_181675_d(); -- bufferbuilder.func_225582_a_((double)this.x0, (double)this.y0, 0.0D).func_225583_a_((float)this.x0 / 32.0F, (float)(this.y0 + (int)this.yo) / 32.0F).func_225586_a_(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) { -@@ -401,4 +394,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); -+ RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); -+ float scale = 32.0F; -+ buffer.func_181668_a(7, DefaultVertexFormats.field_181709_i); -+ buffer.func_225582_a_((double)this.x0, (double)this.y1, 0.0D).func_225583_a_(this.x0 / scale, (this.y1 + (int)this.yo) / scale).func_225586_a_(32, 32, 32, 255).func_181675_d(); -+ buffer.func_225582_a_((double)this.x1, (double)this.y1, 0.0D).func_225583_a_(this.x1 / scale, (this.y1 + (int)this.yo) / scale).func_225586_a_(32, 32, 32, 255).func_181675_d(); -+ buffer.func_225582_a_((double)this.x1, (double)this.y0, 0.0D).func_225583_a_(this.x1 / scale, (this.y0 + (int)this.yo) / scale).func_225586_a_(32, 32, 32, 255).func_181675_d(); -+ buffer.func_225582_a_((double)this.x0, (double)this.y0, 0.0D).func_225583_a_(this.x0 / scale, (this.y0 + (int)this.yo) / scale).func_225586_a_(32, 32, 32, 255).func_181675_d(); -+ tessellator.func_78381_a(); -+ } - } diff --git a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch index 2f7c19ac1..b8b7f6381 100644 --- a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/advancements/AdvancementTabGui.java +++ b/net/minecraft/client/gui/advancements/AdvancementTabGui.java -@@ -36,6 +36,7 @@ +@@ -38,6 +38,7 @@ private int field_191814_q = Integer.MIN_VALUE; private float field_191815_r; private boolean field_192992_s; @@ -8,7 +8,7 @@ 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 @@ +@@ -52,6 +53,15 @@ this.func_193937_a(this.field_191809_l, p_i47589_5_); } @@ -24,7 +24,7 @@ public Advancement func_193935_c() { return this.field_191805_h; } -@@ -150,8 +160,8 @@ +@@ -152,8 +162,8 @@ return null; } else { for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) { diff --git a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch index 7265fa1c5..e22029d93 100644 --- a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/advancements/AdvancementsScreen.java +++ b/net/minecraft/client/gui/advancements/AdvancementsScreen.java -@@ -24,6 +24,7 @@ +@@ -25,6 +25,7 @@ private final Map field_191947_i = Maps.newLinkedHashMap(); private AdvancementTabGui field_191940_s; private boolean field_191944_v; @@ -8,65 +8,65 @@ public AdvancementsScreen(ClientAdvancementManager p_i47383_1_) { super(NarratorChatListener.field_216868_a); -@@ -39,7 +40,13 @@ +@@ -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))); ++ int guiLeft = (this.field_230708_k_ - 252) / 2; ++ int guiTop = (this.field_230709_l_ - 140) / 2; ++ func_230480_a_(new net.minecraft.client.gui.widget.button.Button(guiLeft, guiTop - 50, 20, 20, new net.minecraft.util.text.StringTextComponent("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))); ++ func_230480_a_(new net.minecraft.client.gui.widget.button.Button(guiLeft + 252 - 20, guiTop - 50, 20, 20, new net.minecraft.util.text.StringTextComponent(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))); + maxPages = this.field_191947_i.size() / AdvancementTabType.MAX_TABS; + } } - public void removed() { -@@ -57,7 +64,7 @@ - int j = (this.height - 140) / 2; + public void func_231164_f_() { +@@ -58,7 +65,7 @@ + int j = (this.field_230709_l_ - 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_)) { +- if (advancementtabgui.func_195627_a(i, j, p_231044_1_, p_231044_3_)) { ++ if (advancementtabgui.getPage() == tabPage && advancementtabgui.func_195627_a(i, j, p_231044_1_, p_231044_3_)) { this.field_191946_h.func_194230_a(advancementtabgui.func_193935_c(), true); break; } @@ -82,6 +89,12 @@ - int j = (this.height - 140) / 2; - this.renderBackground(); - this.func_191936_c(p_render_1_, p_render_2_, i, j); + int i = (this.field_230708_k_ - 252) / 2; + int j = (this.field_230709_l_ - 140) / 2; + this.func_230446_a_(p_230430_1_); + if (maxPages != 0) { -+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ int width = this.font.func_78256_a(page); ++ net.minecraft.util.text.ITextComponent page = new net.minecraft.util.text.StringTextComponent(String.format("%d / %d", tabPage + 1, maxPages + 1)); ++ int width = this.field_230712_o_.func_238414_a_(page); + RenderSystem.disableLighting(); -+ this.font.func_175063_a(page, i + (252 / 2) - (width / 2), j - 44, -1); ++ this.field_230712_o_.func_238407_a_(p_230430_1_, 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); - } -@@ -128,6 +141,7 @@ - this.minecraft.func_110434_K().func_110577_a(field_191945_g); + this.func_238696_c_(p_230430_1_, p_230430_2_, p_230430_3_, i, j); + this.func_238695_a_(p_230430_1_, i, j); + this.func_238697_d_(p_230430_1_, p_230430_2_, p_230430_3_, i, j); +@@ -129,6 +142,7 @@ + this.field_230706_i_.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); + advancementtabgui.func_238683_a_(p_238695_1_, p_238695_2_, p_238695_3_, advancementtabgui == this.field_191940_s); } -@@ -135,6 +149,7 @@ +@@ -136,6 +150,7 @@ RenderSystem.defaultBlendFunc(); for(AdvancementTabGui advancementtabgui1 : this.field_191947_i.values()) { + if (advancementtabgui1.getPage() == tabPage) - advancementtabgui1.func_191796_a(p_191934_1_, p_191934_2_, this.itemRenderer); + advancementtabgui1.func_191796_a(p_238695_2_, p_238695_3_, this.field_230707_j_); } -@@ -157,7 +172,7 @@ +@@ -158,7 +173,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_); +- if (advancementtabgui.func_195627_a(p_238697_4_, p_238697_5_, (double)p_238697_2_, (double)p_238697_3_)) { ++ if (advancementtabgui.getPage() == tabPage && advancementtabgui.func_195627_a(p_238697_4_, p_238697_5_, (double)p_238697_2_, (double)p_238697_3_)) { + this.func_238652_a_(p_238697_1_, advancementtabgui.func_238685_d_(), p_238697_2_, p_238697_3_); } } diff --git a/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch b/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch index b51ace9ad..75d8e4bf0 100644 --- a/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/client/gui/overlay/BossOverlayGui.java +++ b/net/minecraft/client/gui/overlay/BossOverlayGui.java -@@ -30,6 +30,9 @@ +@@ -32,6 +32,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.func_228018_at_(), clientbossinfo, k, j, 10 + this.field_184059_f.field_71466_p.field_78288_b); ++ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(p_238484_1_, this.field_184059_f.func_228018_at_(), clientbossinfo, k, j, 10 + this.field_184059_f.field_71466_p.field_78288_b); + if (!event.isCanceled()) { RenderSystem.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 @@ + this.func_238485_a_(p_238484_1_, k, j, clientbossinfo); +@@ -40,7 +43,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); + this.field_184059_f.field_71466_p.func_238407_a_(p_238484_1_, itextcomponent, (float)i1, (float)j1, 16777215); - j += 10 + 9; + } + j += event.getIncrement(); -+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(this.field_184059_f.func_228018_at_()); ++ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(p_238484_1_, this.field_184059_f.func_228018_at_()); if (j >= this.field_184059_f.func_228018_at_().func_198087_p() / 3) { break; } diff --git a/patches/minecraft/net/minecraft/client/gui/overlay/DebugOverlayGui.java.patch b/patches/minecraft/net/minecraft/client/gui/overlay/DebugOverlayGui.java.patch index b978c51f8..de1d83c97 100644 --- a/patches/minecraft/net/minecraft/client/gui/overlay/DebugOverlayGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/overlay/DebugOverlayGui.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/overlay/DebugOverlayGui.java +++ b/net/minecraft/client/gui/overlay/DebugOverlayGui.java -@@ -357,7 +357,7 @@ +@@ -362,7 +362,7 @@ list.add(this.func_211534_a(entry)); } @@ -9,16 +9,16 @@ list.add("#" + resourcelocation); } } -@@ -373,7 +373,7 @@ +@@ -378,7 +378,7 @@ list.add(this.func_211534_a(entry1)); } -- for(ResourceLocation resourcelocation1 : this.field_175242_a.func_147114_u().func_199724_l().func_205704_c().func_199913_a(ifluidstate.func_206886_c())) { -+ for(ResourceLocation resourcelocation1 : ifluidstate.func_206886_c().getTags()) { +- for(ResourceLocation resourcelocation1 : this.field_175242_a.func_147114_u().func_199724_l().func_205704_c().func_199913_a(fluidstate.func_206886_c())) { ++ for(ResourceLocation resourcelocation1 : fluidstate.func_206886_c().getTags()) { list.add("#" + resourcelocation1); } } -@@ -383,6 +383,7 @@ +@@ -388,6 +388,7 @@ list.add(""); list.add(TextFormatting.UNDERLINE + "Targeted Entity"); list.add(String.valueOf((Object)Registry.field_212629_r.func_177774_c(entity.func_200600_R()))); diff --git a/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch b/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch index 2866211b7..8e2b3dfb9 100644 --- a/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/recipebook/RecipeBookGui.java +++ b/net/minecraft/client/gui/recipebook/RecipeBookGui.java -@@ -88,7 +88,7 @@ +@@ -92,7 +92,7 @@ this.func_205702_a(); this.field_193018_j.clear(); @@ -9,12 +9,12 @@ this.field_193018_j.add(new RecipeTabToggleWidget(recipebookcategories)); } -@@ -417,7 +417,7 @@ +@@ -425,7 +425,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/ControlsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/ControlsScreen.java.patch index 59f805f03..40b143b9b 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/ControlsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/ControlsScreen.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/client/gui/screen/ControlsScreen.java +++ b/net/minecraft/client/gui/screen/ControlsScreen.java -@@ -32,7 +32,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_) -> { +@@ -33,7 +33,7 @@ + this.field_230705_e_.add(this.field_146494_r); + this.field_146493_s = this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 155, this.field_230709_l_ - 29, 150, 20, new TranslationTextComponent("controls.resetAll"), (p_213125_1_) -> { for(KeyBinding keybinding : this.field_228183_b_.field_74324_K) { - keybinding.func_197979_b(keybinding.func_197977_i()); + keybinding.setToDefault(); } KeyBinding.func_74508_b(); -@@ -56,11 +56,14 @@ - public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) { +@@ -57,11 +57,14 @@ + public boolean func_231046_a_(int p_231046_1_, int p_231046_2_, int p_231046_3_) { if (this.field_146491_f != null) { - if (p_keyPressed_1_ == 256) { + if (p_231046_1_ == 256) { + this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.field_197958_a); this.field_228183_b_.func_198014_a(this.field_146491_f, InputMappings.field_197958_a); } else { -+ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_)); - this.field_228183_b_.func_198014_a(this.field_146491_f, InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_)); ++ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.func_197954_a(p_231046_1_, p_231046_2_)); + this.field_228183_b_.func_198014_a(this.field_146491_f, InputMappings.func_197954_a(p_231046_1_, p_231046_2_)); } + if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.field_146491_f.getKey())) diff --git a/patches/minecraft/net/minecraft/client/gui/screen/DeathScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/DeathScreen.java.patch index 0abcc618e..61c1f8518 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/DeathScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/DeathScreen.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/gui/screen/DeathScreen.java +++ b/net/minecraft/client/gui/screen/DeathScreen.java -@@ -34,6 +34,7 @@ +@@ -35,6 +35,7 @@ })); - Button button = this.addButton(new Button(this.width / 2 - 100, this.height / 4 + 96, 200, 20, I18n.func_135052_a("deathScreen.titleScreen"), (p_213020_1_) -> { + Button button = this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 100, this.field_230709_l_ / 4 + 96, 200, 20, new TranslationTextComponent("deathScreen.titleScreen"), (p_213020_1_) -> { if (this.field_213023_c) { + func_213022_a(true); this.func_228177_a_(); } else { - ConfirmScreen confirmscreen = new ConfirmScreen(this::func_213022_a, new TranslationTextComponent("deathScreen.quit.confirm"), new StringTextComponent(""), I18n.func_135052_a("deathScreen.titleScreen"), I18n.func_135052_a("deathScreen.respawn")); + ConfirmScreen confirmscreen = new ConfirmScreen(this::func_213022_a, new TranslationTextComponent("deathScreen.quit.confirm"), StringTextComponent.field_240750_d_, new TranslationTextComponent("deathScreen.titleScreen"), new TranslationTextComponent("deathScreen.respawn")); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch index 331787af5..005a64416 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch @@ -1,27 +1,28 @@ --- a/net/minecraft/client/gui/screen/EnchantmentScreen.java +++ b/net/minecraft/client/gui/screen/EnchantmentScreen.java -@@ -155,7 +155,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); +@@ -149,7 +149,7 @@ + int i2 = 86 - this.field_230712_o_.func_78256_a(s); + ITextProperties itextproperties = EnchantmentNameParts.func_178176_a().func_238816_a_(this.field_230712_o_, i2); 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); -@@ -195,10 +195,12 @@ +- if ((l < i1 + 1 || this.field_230706_i_.field_71439_g.field_71068_ca < l1) && !this.field_230706_i_.field_71439_g.field_71075_bZ.field_75098_d) { ++ if (((l < i1 + 1 || this.field_230706_i_.field_71439_g.field_71068_ca < l1) && !this.field_230706_i_.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.func_238474_b_(p_230450_1_, j1, j + 14 + 19 * i1, 0, 185, 108, 19); + this.func_238474_b_(p_230450_1_, j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16); + this.field_230712_o_.func_238418_a_(itextproperties, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1); +@@ -188,10 +188,13 @@ 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 (this.func_195359_a(60, 14 + 19 * j, 108, 17, (double)p_230430_2_, (double)p_230430_3_) && k > 0 && l >= 0 && enchantment != null) { ++ if (this.func_195359_a(60, 14 + 19 * j, 108, 17, (double)p_230430_2_, (double)p_230430_3_) && k > 0) { + List list = Lists.newArrayList(); +- list.add((new TranslationTextComponent("container.enchant.clue", enchantment.func_200305_d(l))).func_240699_a_(TextFormatting.WHITE)); - 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")); ++ list.add((new TranslationTextComponent("container.enchant.clue", enchantment == null ? "" : enchantment.func_200305_d(l))).func_240699_a_(TextFormatting.WHITE)); ++ if(enchantment == null) { ++ list.add(new StringTextComponent("")); ++ list.add(new TranslationTextComponent("forge.container.enchant.limitedEnchantability").func_240699_a_(TextFormatting.RED)); + } 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])); + list.add(StringTextComponent.field_240750_d_); + if (this.field_230706_i_.field_71439_g.field_71068_ca < k) { + list.add((new TranslationTextComponent("container.enchant.level.requirement", (this.field_147002_h).field_75167_g[j])).func_240699_a_(TextFormatting.RED)); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch index 2fe74e02a..e148c981d 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/gui/screen/LanguageScreen.java +++ b/net/minecraft/client/gui/screen/LanguageScreen.java -@@ -41,7 +41,7 @@ +@@ -43,7 +43,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_228183_b_.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_228183_b_)); +- this.field_230706_i_.func_213237_g(); ++ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_230706_i_, net.minecraftforge.resource.VanillaResourceType.LANGUAGES); + this.field_146452_r.func_238482_a_(DialogTexts.field_240632_c_); + this.field_211832_i.func_238482_a_(AbstractOption.field_216684_H.func_238152_c_(this.field_228183_b_)); + this.field_228183_b_.func_74303_b(); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch index b486a40d4..4925951ec 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screen/MainMenuScreen.java +++ b/net/minecraft/client/gui/screen/MainMenuScreen.java -@@ -45,6 +45,7 @@ +@@ -54,6 +54,7 @@ private final RenderSkybox field_209101_K = new RenderSkybox(field_213098_a); private final boolean field_213102_y; private long field_213103_z; @@ -8,66 +8,60 @@ public MainMenuScreen() { this(false); -@@ -88,10 +89,14 @@ - this.field_193979_N = this.width - this.field_193978_M - 2; +@@ -97,11 +98,16 @@ + this.field_193979_N = this.field_230708_k_ - this.field_193978_M - 2; int i = 24; - int j = this.height / 4 + 48; -+ Button modbutton = null; - if (this.minecraft.func_71355_q()) { + int j = this.field_230709_l_ / 4 + 48; ++ Button modButton = null; + if (this.field_230706_i_.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.screen.ModListScreen(this)); ++ modButton = this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 100, j + 24 * 2, 98, 20, new TranslationTextComponent("fml.menu.mods"), button -> { ++ this.field_230706_i_.func_147108_a(new net.minecraftforge.fml.client.gui.screen.ModListScreen(this)); + })); } ++ modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, modButton); - this.addButton(new ImageButton(this.width / 2 - 124, j + 72 + 12, 20, 20, 0, 106, 20, Button.WIDGETS_LOCATION, 256, 256, (p_213090_1_) -> { -@@ -116,6 +121,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); - - } - -@@ -131,7 +137,7 @@ - } - - })); -- 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_230480_a_(new ImageButton(this.field_230708_k_ / 2 - 124, j + 72 + 12, 20, 20, 0, 106, 20, Button.field_230687_i_, 256, 256, (p_213090_1_) -> { + this.field_230706_i_.func_147108_a(new LanguageScreen(this, this.field_230706_i_.field_71474_y, this.field_230706_i_.func_135016_M())); +@@ -143,7 +149,7 @@ + Screen screen = (Screen)(this.field_230706_i_.field_71474_y.field_230152_Z_ ? new MultiplayerScreen(this) : new MultiplayerWarningScreen(this)); + this.field_230706_i_.func_147108_a(screen); + }, button$itooltip))).field_230693_o_ = flag; +- (this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 200, 20, new TranslationTextComponent("menu.online"), (p_238661_1_) -> { ++ (this.func_230480_a_(new Button(this.field_230708_k_ / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, new TranslationTextComponent("menu.online"), (p_238661_1_) -> { this.func_140005_i(); - })); + }, button$itooltip))).field_230693_o_ = flag; } -@@ -195,6 +201,7 @@ +@@ -222,6 +228,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); + this.field_230706_i_.func_110434_K().func_110577_a(field_194400_H); + func_238463_a_(p_230430_1_, j + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16); ++ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_230430_1_, this.field_230712_o_, this.field_230708_k_, this.field_230709_l_); if (this.field_73975_c != null) { RenderSystem.pushMatrix(); - RenderSystem.translatef((float)(this.width / 2 + 90), 70.0F, 0.0F); -@@ -217,7 +224,13 @@ + RenderSystem.translatef((float)(this.field_230708_k_ / 2 + 90), 70.0F, 0.0F); +@@ -244,7 +251,13 @@ s = s + I18n.func_135052_a("menu.modded"); } -- this.drawString(this.font, s, 2, this.height - 10, 16777215 | l); +- this.func_238476_c_(p_230430_1_, this.field_230712_o_, s, 2, this.field_230709_l_ - 10, 16777215 | l); + net.minecraftforge.fml.BrandingControl.forEachLine(true, true, (brdline, brd) -> -+ this.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.field_78288_b + 1)), 16777215 | l) ++ this.func_238476_c_(p_230430_1_, this.field_230712_o_, brd, 2, this.field_230709_l_ - ( 10 + brdline * (this.field_230712_o_.field_78288_b + 1)), 16777215 | l) + ); + + net.minecraftforge.fml.BrandingControl.forEachAboveCopyrightLine((brdline, brd) -> -+ this.drawString(this.font, brd, this.width - font.func_78256_a(brd), this.height - (10 + (brdline + 1) * ( this.font.field_78288_b + 1)), 16777215 | l) ++ this.func_238476_c_(p_230430_1_, this.field_230712_o_, brd, this.field_230708_k_ - field_230712_o_.func_78256_a(brd), this.field_230709_l_ - (10 + (brdline + 1) * ( this.field_230712_o_.field_78288_b + 1)), 16777215 | l) + ); - this.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); -@@ -231,6 +244,7 @@ + this.func_238476_c_(p_230430_1_, this.field_230712_o_, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.field_230709_l_ - 10, 16777215 | l); + if (p_230430_2_ > this.field_193979_N && p_230430_2_ < this.field_193979_N + this.field_193978_M && p_230430_3_ > this.field_230709_l_ - 10 && p_230430_3_ < this.field_230709_l_) { + func_238467_a_(p_230430_1_, this.field_193979_N, this.field_230709_l_ - 1, this.field_193979_N + this.field_193978_M, this.field_230709_l_, 16777215 | l); +@@ -258,6 +271,7 @@ if (this.func_183501_a() && f1 >= 1.0F) { - this.field_183503_M.render(p_render_1_, p_render_2_, p_render_3_); + this.field_183503_M.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); } -+ modUpdateNotification.render(p_render_1_, p_render_2_, p_render_3_); ++ modUpdateNotification.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); } } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/MultiplayerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/MultiplayerScreen.java.patch index 19b3ca092..dac8aef40 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/MultiplayerScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/MultiplayerScreen.java.patch @@ -5,8 +5,8 @@ } + @Override -+ public void onClose() { -+ this.minecraft.func_147108_a(this.field_146798_g); ++ public void func_231175_as__() { ++ this.field_230706_i_.func_147108_a(this.field_146798_g); + } + public ServerPinger func_146789_i() { diff --git a/patches/minecraft/net/minecraft/client/gui/screen/OptionsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/OptionsScreen.java.patch index 7049508ea..c731c146d 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/OptionsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/OptionsScreen.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/gui/screen/OptionsScreen.java +++ b/net/minecraft/client/gui/screen/OptionsScreen.java -@@ -118,4 +118,12 @@ - this.drawCenteredString(this.font, this.title.func_150254_d(), this.width / 2, 15, 16777215); - super.render(p_render_1_, p_render_2_, p_render_3_); +@@ -146,4 +146,12 @@ + this.func_238472_a_(p_230430_1_, this.field_230712_o_, this.field_230704_d_, this.field_230708_k_ / 2, 15, 16777215); + super.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); } + -+ @Override -+ public void onClose() { -+ // We need to consider 2 potential parent screens here: -+ // 1. From the main menu, in which case display the main menu -+ // 2. From the pause menu, in which case exit back to game -+ this.minecraft.func_147108_a(this.field_146441_g instanceof IngameMenuScreen ? null : this.field_146441_g); -+ } ++ @Override ++ public void func_231175_as__() { ++ // We need to consider 2 potential parent screens here: ++ // 1. From the main menu, in which case display the main menu ++ // 2. From the pause menu, in which case exit back to game ++ this.field_230706_i_.func_147108_a(this.field_146441_g instanceof IngameMenuScreen ? null : this.field_146441_g); ++ } } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch index afe84ee03..023fb4db8 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch @@ -1,80 +1,83 @@ --- a/net/minecraft/client/gui/screen/Screen.java +++ b/net/minecraft/client/gui/screen/Screen.java -@@ -111,7 +111,10 @@ +@@ -113,7 +113,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.gui.GuiUtils.preItemToolTip(p_renderTooltip_1_); -+ this.renderTooltip(this.getTooltipFromItem(p_renderTooltip_1_), p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font)); + protected void func_230457_a_(MatrixStack p_230457_1_, ItemStack p_230457_2_, int p_230457_3_, int p_230457_4_) { +- this.func_238654_b_(p_230457_1_, this.func_231151_a_(p_230457_2_), p_230457_3_, p_230457_4_); ++ FontRenderer font = p_230457_2_.func_77973_b().getFontRenderer(p_230457_2_); ++ net.minecraftforge.fml.client.gui.GuiUtils.preItemToolTip(p_230457_2_); ++ this.func_238654_b_(p_230457_1_, this.func_231151_a_(p_230457_2_), p_230457_3_, p_230457_4_, (font == null ? this.field_230712_o_ : font)); + net.minecraftforge.fml.client.gui.GuiUtils.postItemToolTip(); } - public List getTooltipFromItem(ItemStack p_getTooltipFromItem_1_) { -@@ -130,7 +133,11 @@ + public List func_231151_a_(ItemStack p_231151_1_) { +@@ -125,7 +128,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 func_238654_b_(MatrixStack p_238654_1_, List p_238654_2_, int p_238654_3_, int p_238654_4_) { +- if (!p_238654_2_.isEmpty()) { ++ + } -+ public void renderTooltip(List p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_, FontRenderer font) { -+ net.minecraftforge.fml.client.gui.GuiUtils.drawHoveringText(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, width, height, -1, font); -+ if (false && !p_renderTooltip_1_.isEmpty()) { - RenderSystem.disableRescaleNormal(); - RenderSystem.disableDepthTest(); ++ public void func_238654_b_(MatrixStack p_238654_1_, List p_238654_2_, int p_238654_3_, int p_238654_4_, FontRenderer font) { ++ net.minecraftforge.fml.client.gui.GuiUtils.drawHoveringText(p_238654_1_, p_238654_2_, p_238654_3_, p_238654_4_, field_230708_k_, field_230709_l_, -1, font); ++ if (false && !p_238654_2_.isEmpty()) { int i = 0; -@@ -308,9 +315,12 @@ + + for(ITextProperties itextproperties : p_238654_2_) { +@@ -285,9 +292,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_); + public void func_231159_b_(String p_231159_1_, boolean p_231159_2_) { ++ p_231159_1_ = net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(p_231159_1_); ++ if (p_231159_1_.isEmpty()) return; + if (p_231159_2_) { + this.field_230706_i_.field_71456_v.func_146158_b().func_146239_a(p_231159_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_); + this.field_230706_i_.field_71439_g.func_71165_d(p_231159_1_); } -@@ -321,10 +331,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(); +@@ -298,10 +308,17 @@ + this.field_230712_o_ = p_231158_1_.field_71466_p; + this.field_230708_k_ = p_231158_2_; + this.field_230709_l_ = p_231158_3_; ++ java.util.function.Consumer remove = (b) -> { ++ field_230710_m_.remove(b); ++ field_230705_e_.remove(b); ++ }; ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.field_230710_m_, this::func_230480_a_, remove))) { + this.field_230710_m_.clear(); + this.field_230705_e_.clear(); + this.func_231035_a_((IGuiEventListener)null); + this.func_231160_c_(); + } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.buttons, this::addButton, remove)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.field_230710_m_, this::func_230480_a_, remove)); } - public void setSize(int p_setSize_1_, int p_setSize_2_) { -@@ -352,6 +366,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); + public List func_231039_at__() { +@@ -324,6 +341,7 @@ + public void func_238651_a_(MatrixStack p_238651_1_, int p_238651_2_) { + if (this.field_230706_i_.field_71441_e != null) { + this.func_238468_a_(p_238651_1_, 0, 0, this.field_230708_k_, this.field_230709_l_, -1072689136, -804253680); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this)); } else { - this.renderDirtBackground(p_renderBackground_1_); + this.func_231165_f_(p_238651_2_); } -@@ -370,6 +385,7 @@ - bufferbuilder.func_225582_a_((double)this.width, 0.0D, 0.0D).func_225583_a_((float)this.width / 32.0F, (float)p_renderDirtBackground_1_).func_225586_a_(64, 64, 64, 255).func_181675_d(); - bufferbuilder.func_225582_a_(0.0D, 0.0D, 0.0D).func_225583_a_(0.0F, (float)p_renderDirtBackground_1_).func_225586_a_(64, 64, 64, 255).func_181675_d(); +@@ -342,6 +360,7 @@ + bufferbuilder.func_225582_a_((double)this.field_230708_k_, 0.0D, 0.0D).func_225583_a_((float)this.field_230708_k_ / 32.0F, (float)p_231165_1_).func_225586_a_(64, 64, 64, 255).func_181675_d(); + bufferbuilder.func_225582_a_(0.0D, 0.0D, 0.0D).func_225583_a_(0.0F, (float)p_231165_1_).func_225586_a_(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() { -@@ -453,4 +469,8 @@ - public boolean isMouseOver(double p_isMouseOver_1_, double p_isMouseOver_3_) { - return true; + public boolean func_231177_au__() { +@@ -428,4 +447,8 @@ + + public void func_230476_a_(List p_230476_1_) { } + -+ public Minecraft getMinecraft() { -+ return this.minecraft; -+ } ++ public Minecraft getMinecraft() { ++ return this.field_230706_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 index 92144c481..75eef95a0 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/gui/screen/ServerSelectionList.java +++ b/net/minecraft/client/gui/screen/ServerSelectionList.java -@@ -294,6 +294,8 @@ - this.field_148303_c.func_146793_a(s); +@@ -302,6 +302,8 @@ + this.field_148303_c.func_238854_b_(list1); } -+ net.minecraftforge.fml.client.ClientHooks.drawForgePingInfo(this.field_148303_c, field_148301_e, p_render_3_, p_render_2_, p_render_4_, i1, j1); ++ net.minecraftforge.fml.client.ClientHooks.drawForgePingInfo(this.field_148303_c, field_148301_e, p_230432_1_, p_230432_4_, p_230432_3_, p_230432_5_, i1, j1); + - if (this.field_148300_d.field_71474_y.field_85185_A || p_render_8_) { + if (this.field_148300_d.field_71474_y.field_85185_A || p_230432_9_) { 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); + AbstractGui.func_238467_a_(p_230432_1_, p_230432_4_, p_230432_3_, p_230432_4_ + 32, p_230432_3_ + 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 deleted file mode 100644 index b64c8da18..000000000 --- a/patches/minecraft/net/minecraft/client/gui/screen/SleepInMultiplayerScreen.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/screen/inventory/ContainerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch index 0dd057932..f44679f56 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch @@ -1,152 +1,159 @@ --- a/net/minecraft/client/gui/screen/inventory/ContainerScreen.java +++ b/net/minecraft/client/gui/screen/inventory/ContainerScreen.java -@@ -71,6 +71,7 @@ +@@ -86,6 +86,7 @@ int i = this.field_147003_i; int j = this.field_147009_r; - 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_)); + this.func_230450_a_(p_230430_1_, p_230430_4_, p_230430_2_, p_230430_3_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawBackground(this, p_230430_1_, p_230430_2_, p_230430_3_)); RenderSystem.disableRescaleNormal(); RenderSystem.disableDepthTest(); - super.render(p_render_1_, p_render_2_, p_render_3_); -@@ -96,13 +97,15 @@ + super.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); +@@ -111,13 +112,15 @@ int j1 = slot.field_75223_e; int k1 = slot.field_75221_f; RenderSystem.colorMask(true, true, true, false); -- this.fillGradient(j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433); +- this.func_238468_a_(p_230430_1_, j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433); + int slotColor = this.getSlotColor(i1); -+ this.fillGradient(j1, k1, j1 + 16, k1 + 16, slotColor, slotColor); ++ this.func_238468_a_(p_230430_1_, j1, k1, j1 + 16, k1 + 16, slotColor, slotColor); RenderSystem.colorMask(true, true, true, true); RenderSystem.enableDepthTest(); } } - this.func_146979_b(p_render_1_, p_render_2_); -+ 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; + this.func_230451_b_(p_230430_1_, p_230430_2_, p_230430_3_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawForeground(this, p_230430_1_, p_230430_2_, p_230430_3_)); + PlayerInventory playerinventory = this.field_230706_i_.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()) { -@@ -152,8 +155,10 @@ +@@ -167,8 +170,10 @@ RenderSystem.translatef(0.0F, 0.0F, 32.0F); - this.setBlitOffset(200); - this.itemRenderer.field_77023_b = 200.0F; + this.func_230926_e_(200); + this.field_230707_j_.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 = 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.setBlitOffset(0); - this.itemRenderer.field_77023_b = 0.0F; ++ if (font == null) font = this.field_230712_o_; + this.field_230707_j_.func_180450_b(p_146982_1_, p_146982_2_, p_146982_3_); +- this.field_230707_j_.func_180453_a(this.field_230712_o_, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_); ++ this.field_230707_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.func_230926_e_(0); + this.field_230707_j_.field_77023_b = 0.0F; } -@@ -260,7 +265,8 @@ - if (super.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_)) { +@@ -278,7 +283,8 @@ + if (super.func_231044_a_(p_231044_1_, p_231044_3_, p_231044_5_)) { return true; } else { -- 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.minecraft.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey); - Slot slot = this.func_195360_a(p_mouseClicked_1_, p_mouseClicked_3_); +- boolean flag = this.field_230706_i_.field_71474_y.field_74322_I.func_197984_a(p_231044_5_); ++ InputMappings.Input mouseKey = InputMappings.Type.MOUSE.func_197944_a(p_231044_5_); ++ boolean flag = this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey); + Slot slot = this.func_195360_a(p_231044_1_, p_231044_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_; -@@ -269,6 +275,7 @@ + this.field_146993_M = this.field_146998_K == slot && i - this.field_146997_J < 250L && this.field_146992_L == p_231044_5_; +@@ -289,6 +295,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_); + boolean flag1 = this.func_195361_a(p_231044_1_, p_231044_3_, j, k, p_231044_5_); + if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries int l = -1; if (slot != null) { l = slot.field_75222_d; -@@ -294,7 +301,7 @@ +@@ -314,7 +321,7 @@ } } else if (!this.field_147007_t) { - 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); + if (this.field_230706_i_.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) { +- if (this.field_230706_i_.field_71474_y.field_74322_I.func_197984_a(p_231044_5_)) { ++ if (this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { + this.func_184098_a(slot, l, p_231044_5_, ClickType.CLONE); } else { boolean flag2 = l != -999 && (InputMappings.func_216506_a(Minecraft.func_71410_x().func_228018_at_().func_198092_i(), 340) || InputMappings.func_216506_a(Minecraft.func_71410_x().func_228018_at_().func_198092_i(), 344)); -@@ -318,7 +325,7 @@ +@@ -338,7 +345,7 @@ this.field_146987_F = 0; - } else if (p_mouseClicked_5_ == 1) { + } else if (p_231044_5_ == 1) { this.field_146987_F = 1; -- } 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)) { +- } else if (this.field_230706_i_.field_71474_y.field_74322_I.func_197984_a(p_231044_5_)) { ++ } else if (this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { this.field_146987_F = 2; } } -@@ -371,10 +378,13 @@ +@@ -407,10 +414,13 @@ } - public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) { -+ super.mouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_); //Forge, Call parent to release buttons - Slot slot = this.func_195360_a(p_mouseReleased_1_, p_mouseReleased_3_); + public boolean func_231048_c_(double p_231048_1_, double p_231048_3_, int p_231048_5_) { ++ super.func_231048_c_(p_231048_1_, p_231048_3_, p_231048_5_); //Forge, Call parent to release buttons + Slot slot = this.func_195360_a(p_231048_1_, p_231048_3_); int i = this.field_147003_i; int j = this.field_147009_r; - boolean flag = this.func_195361_a(p_mouseReleased_1_, p_mouseReleased_3_, i, j, p_mouseReleased_5_); + boolean flag = this.func_195361_a(p_231048_1_, p_231048_3_, i, j, p_231048_5_); + if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries -+ InputMappings.Input mouseKey = InputMappings.Type.MOUSE.func_197944_a(p_mouseReleased_5_); ++ InputMappings.Input mouseKey = InputMappings.Type.MOUSE.func_197944_a(p_231048_5_); int k = -1; if (slot != null) { k = slot.field_75222_d; -@@ -388,7 +398,7 @@ - if (hasShiftDown()) { +@@ -424,7 +434,7 @@ + if (func_231173_s_()) { 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.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); +- if (slot2 != null && slot2.func_82869_a(this.field_230706_i_.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_230706_i_.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_231048_5_, ClickType.QUICK_MOVE); } } -@@ -452,7 +462,7 @@ +@@ -488,7 +498,7 @@ this.func_184098_a((Slot)null, -999, Container.func_94534_d(2, this.field_146987_F), ClickType.QUICK_CRAFT); - } 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 if (!this.field_230706_i_.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) { +- if (this.field_230706_i_.field_71474_y.field_74322_I.func_197984_a(p_231048_5_)) { ++ if (this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { + this.func_184098_a(slot, k, p_231048_5_, ClickType.CLONE); } else { boolean flag1 = k != -999 && (InputMappings.func_216506_a(Minecraft.func_71410_x().func_228018_at_().func_198092_i(), 340) || InputMappings.func_216506_a(Minecraft.func_71410_x().func_228018_at_().func_198092_i(), 344)); -@@ -501,27 +511,34 @@ - if (super.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_)) { - return true; - } else { -- 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. - } +@@ -534,19 +544,26 @@ + } -- this.func_195363_d(p_keyPressed_1_, p_keyPressed_2_); -+ 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. + public boolean func_231046_a_(int p_231046_1_, int p_231046_2_, int p_231046_3_) { ++ InputMappings.Input mouseKey = InputMappings.func_197954_a(p_231046_1_, p_231046_2_); + if (super.func_231046_a_(p_231046_1_, p_231046_2_, p_231046_3_)) { + return true; +- } else if (p_231046_1_ != 256 && !this.field_230706_i_.field_71474_y.field_151445_Q.func_197976_a(p_231046_1_, p_231046_2_)) { +- this.func_195363_d(p_231046_1_, p_231046_2_); ++ } else if (p_231046_1_ != 256 && !this.field_230706_i_.field_71474_y.field_151445_Q.isActiveAndMatches(mouseKey)) { ++ boolean handled = false;// Forge MC-146650: Needs to return true when the key is handled. ++ if (this.func_195363_d(p_231046_1_, p_231046_2_)) ++ handled = true; if (this.field_147006_u != null && this.field_147006_u.func_75216_d()) { -- 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)) { +- if (this.field_230706_i_.field_71474_y.field_74322_I.func_197976_a(p_231046_1_, p_231046_2_)) { ++ if (this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, 0, ClickType.CLONE); -- } 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.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. +- } else if (this.field_230706_i_.field_71474_y.field_74316_C.func_197976_a(p_231046_1_, p_231046_2_)) { ++ handled = true; ++ } else if (this.field_230706_i_.field_71474_y.field_74316_C.isActiveAndMatches(mouseKey)) { + this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, func_231172_r_() ? 1 : 0, ClickType.THROW); ++ handled = true; } -+ } else if (this.minecraft.field_71474_y.field_74316_C.isActiveAndMatches(mouseKey)) { -+ return true; // Forge MC-146650: Emulate MC bug, so we don't drop from hotbar when pressing drop without hovering over a item. ++ } else if (this.field_230706_i_.field_71474_y.field_74316_C.isActiveAndMatches(mouseKey)) { ++ handled = true; // Forge MC-146650: Emulate MC bug, so we don't drop from hotbar when pressing drop without hovering over a item. } - return true; -+ return false; // Forge MC-146650: Needs to return false when the key is not handled. - } - } ++ return handled; + } else { + this.field_230706_i_.field_71439_g.func_71053_j(); + return true; +@@ -555,13 +572,13 @@ protected boolean func_195363_d(int p_195363_1_, int p_195363_2_) { - if (this.minecraft.field_71439_g.field_71071_by.func_70445_o().func_190926_b() && this.field_147006_u != null) { + if (this.field_230706_i_.field_71439_g.field_71071_by.func_70445_o().func_190926_b() && this.field_147006_u != null) { +- if (this.field_230706_i_.field_71474_y.field_186718_X.func_197976_a(p_195363_1_, p_195363_2_)) { ++ if (this.field_230706_i_.field_71474_y.field_186718_X.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, 40, ClickType.SWAP); + return true; + } + for(int i = 0; i < 9; ++i) { -- 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_))) { +- if (this.field_230706_i_.field_71474_y.field_151456_ac[i].func_197976_a(p_195363_1_, p_195363_2_)) { ++ if (this.field_230706_i_.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; } -@@ -552,4 +569,16 @@ +@@ -592,4 +609,16 @@ public T func_212873_a_() { return this.field_147002_h; } 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 index 796ead83f..b513aaef6 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/client/gui/screen/inventory/CreativeScreen.java +++ b/net/minecraft/client/gui/screen/inventory/CreativeScreen.java @@ -65,6 +65,8 @@ + private Slot field_147064_C; + private CreativeCraftingListener field_147059_E; 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; + private boolean field_199506_G; + private final Map> field_214085_w = Maps.newTreeMap(); - public CreativeScreen(PlayerEntity p_i1088_1_) { - super(new CreativeScreen.CreativeContainer(p_i1088_1_), p_i1088_1_.field_71071_by, new StringTextComponent("")); @@ -233,6 +235,12 @@ - if (this.minecraft.field_71442_b.func_78758_h()) { - super.init(); - this.minecraft.field_195559_v.func_197967_a(true); + + protected void func_231160_c_() { + if (this.field_230706_i_.field_71442_b.func_78758_h()) { + 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))); ++ func_230480_a_(new net.minecraft.client.gui.widget.button.Button(field_147003_i, field_147009_r - 50, 20, 20, new StringTextComponent("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))); ++ func_230480_a_(new net.minecraft.client.gui.widget.button.Button(field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, new StringTextComponent(">"), 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); -@@ -273,7 +281,7 @@ - public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_) { + super.func_231160_c_(); + this.field_230706_i_.field_195559_v.func_197967_a(true); + this.field_147062_A = new TextFieldWidget(this.field_230712_o_, this.field_147003_i + 82, this.field_147009_r + 6, 80, 9, new TranslationTextComponent("itemGroup.search")); +@@ -275,7 +283,7 @@ + public boolean func_231042_a_(char p_231042_1_, int p_231042_2_) { if (this.field_195377_F) { return false; - } else if (field_147058_w != ItemGroup.field_78027_g.func_78021_a()) { @@ -31,16 +31,16 @@ return false; } else { String s = this.field_147062_A.func_146179_b(); -@@ -291,7 +299,7 @@ +@@ -293,7 +301,7 @@ - public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) { + public boolean func_231046_a_(int p_231046_1_, int p_231046_2_, int p_231046_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_)) { + if (this.field_230706_i_.field_71474_y.field_74310_D.func_197976_a(p_231046_1_, p_231046_2_)) { this.field_195377_F = true; this.func_147050_b(ItemGroup.field_78027_g); -@@ -327,6 +335,32 @@ +@@ -330,6 +338,32 @@ private void func_147053_i() { (this.field_147002_h).field_148330_a.clear(); this.field_214085_w.clear(); @@ -55,7 +55,7 @@ + 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)) { ++ for (ITextComponent line : stack.func_82840_a(this.field_230706_i_.field_71439_g, this.field_230706_i_.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; @@ -73,20 +73,20 @@ String s = this.field_147062_A.func_146179_b(); if (s.isEmpty()) { for(Item item : Registry.field_212630_s) { -@@ -372,9 +406,9 @@ +@@ -375,9 +409,9 @@ - protected void func_146979_b(int p_146979_1_, int p_146979_2_) { + protected void func_230451_b_(MatrixStack p_230451_1_, int p_230451_2_, int p_230451_3_) { ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w]; - if (itemgroup.func_78019_g()) { + if (itemgroup != null && itemgroup.func_78019_g()) { RenderSystem.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()); +- this.field_230712_o_.func_238421_b_(p_230451_1_, I18n.func_135052_a(itemgroup.func_78024_c()), 8.0F, 6.0F, 4210752); ++ this.field_230712_o_.func_238421_b_(p_230451_1_, I18n.func_135052_a(itemgroup.func_78024_c()), 8.0F, 6.0F, itemgroup.getLabelColor()); } } -@@ -385,7 +419,7 @@ - double d1 = p_mouseClicked_3_ - (double)this.field_147009_r; +@@ -388,7 +422,7 @@ + double d1 = p_231044_3_ - (double)this.field_147009_r; for(ItemGroup itemgroup : ItemGroup.field_78032_a) { - if (this.func_195375_a(itemgroup, d0, d1)) { @@ -94,7 +94,7 @@ return true; } } -@@ -406,7 +440,7 @@ +@@ -409,7 +443,7 @@ this.field_147066_y = false; for(ItemGroup itemgroup : ItemGroup.field_78032_a) { @@ -103,7 +103,7 @@ this.func_147050_b(itemgroup); return true; } -@@ -417,12 +451,15 @@ +@@ -420,12 +454,15 @@ } private boolean func_147055_p() { @@ -119,7 +119,7 @@ this.field_147008_s.clear(); (this.field_147002_h).field_148330_a.clear(); if (p_147050_1_ == ItemGroup.field_192395_m) { -@@ -499,13 +536,15 @@ +@@ -502,13 +539,15 @@ } if (this.field_147062_A != null) { @@ -131,67 +131,67 @@ 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.field_147062_A.func_230991_b_(p_147050_1_.getSearchbarWidth()); ++ this.field_147062_A.field_230690_l_ = this.field_147003_i + (82 /*default left*/ + 89 /*default width*/) - this.field_147062_A.func_230998_h_(); this.func_147053_i(); } else { -@@ -565,16 +604,35 @@ - this.renderBackground(); - super.render(p_render_1_, p_render_2_, p_render_3_); +@@ -568,16 +607,35 @@ + this.func_230446_a_(p_230430_1_); + super.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); - for(ItemGroup itemgroup : ItemGroup.field_78032_a) { -- if (this.func_147052_b(itemgroup, p_render_1_, p_render_2_)) { +- if (this.func_238809_a_(p_230430_1_, itemgroup, p_230430_2_, p_230430_3_)) { + 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++) { ++ 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_)) { ++ if (itemgroup != null && this.func_238809_a_(p_230430_1_, itemgroup, p_230430_2_, p_230430_3_)) { + 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 (!rendered && !func_238809_a_(p_230430_1_, ItemGroup.field_78027_g, p_230430_2_, p_230430_3_)) ++ func_238809_a_(p_230430_1_, ItemGroup.field_78036_m, p_230430_2_, p_230430_3_); - 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 (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_230430_2_, (double)p_230430_3_)) { + this.func_238652_a_(p_230430_1_, new TranslationTextComponent("inventory.binSlot"), p_230430_2_, p_230430_3_); } + if (maxPages != 0) { -+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ RenderSystem.disableLighting(); -+ this.setBlitOffset(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.setBlitOffset(0); -+ this.itemRenderer.field_77023_b = 0.0F; ++ ITextComponent page = new StringTextComponent(String.format("%d / %d", tabPage + 1, maxPages + 1)); ++ RenderSystem.disableLighting(); ++ this.func_230926_e_(300); ++ this.field_230707_j_.field_77023_b = 300.0F; ++ field_230712_o_.func_238407_a_(p_230430_1_, page, field_147003_i + (field_146999_f / 2) - (field_230712_o_.func_238414_a_(page) / 2), field_147009_r - 44, -1); ++ this.func_230926_e_(0); ++ this.field_230707_j_.field_77023_b = 0.0F; + } + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.func_191948_b(p_render_1_, p_render_2_); + this.func_230459_a_(p_230430_1_, p_230430_2_, p_230430_3_); } -@@ -622,7 +680,10 @@ - } +@@ -612,7 +670,10 @@ + list1.add(1, (new TranslationTextComponent(itemgroup.func_78024_c())).func_240699_a_(TextFormatting.BLUE)); } -- 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.gui.GuiUtils.preItemToolTip(p_renderTooltip_1_); -+ this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font)); +- this.func_238654_b_(p_230457_1_, list1, p_230457_3_, p_230457_4_); ++ net.minecraft.client.gui.FontRenderer font = p_230457_2_.func_77973_b().getFontRenderer(p_230457_2_); ++ net.minecraftforge.fml.client.gui.GuiUtils.preItemToolTip(p_230457_2_); ++ this.func_238654_b_(p_230457_1_, list1, p_230457_3_, p_230457_4_, (font == null ? this.field_230712_o_ : font)); + net.minecraftforge.fml.client.gui.GuiUtils.postItemToolTip(); } else { - super.renderTooltip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_); + super.func_230457_a_(p_230457_1_, p_230457_2_, p_230457_3_, p_230457_4_); } -@@ -633,25 +694,44 @@ +@@ -623,25 +684,44 @@ RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); 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); +- this.field_230706_i_.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)); @@ -200,43 +200,43 @@ + 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.field_230706_i_.func_110434_K().func_110577_a(itemgroup1.getBackgroundImage()); + this.func_238808_a_(p_230450_1_, itemgroup1); } } -- this.minecraft.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + itemgroup.func_78015_f())); +- this.field_230706_i_.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); ++ this.field_230706_i_.func_110434_K().func_110577_a(ItemGroup.field_78027_g.getTabsImage()); ++ func_238808_a_(p_230450_1_, 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.field_230706_i_.func_110434_K().func_110577_a(ItemGroup.field_78036_m.getTabsImage()); ++ func_238808_a_(p_230450_1_, 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_); ++ this.field_230706_i_.func_110434_K().func_110577_a(itemgroup.getBackgroundImage()); + this.func_238474_b_(p_230450_1_, this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g); + this.field_147062_A.func_230430_a_(p_230450_1_, p_230450_3_, p_230450_4_, p_230450_2_); RenderSystem.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()); +- this.field_230706_i_.func_110434_K().func_110577_a(field_147061_u); ++ this.field_230706_i_.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); + this.func_238474_b_(p_230450_1_, 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); + this.func_238808_a_(p_230450_1_, itemgroup); if (itemgroup == ItemGroup.field_78036_m) { - InventoryScreen.func_228187_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); -@@ -660,6 +740,7 @@ + InventoryScreen.func_228187_a_(this.field_147003_i + 88, this.field_147009_r + 45, 20, (float)(this.field_147003_i + 88 - p_230450_3_), (float)(this.field_147009_r + 45 - 30 - p_230450_4_), this.field_230706_i_.field_71439_g); +@@ -650,6 +730,7 @@ } protected boolean func_195375_a(ItemGroup p_195375_1_, double p_195375_2_, double p_195375_4_) { @@ -244,16 +244,25 @@ int i = p_195375_1_.func_78020_k(); int j = 28 * i; int k = 0; -@@ -728,6 +809,8 @@ +@@ -718,6 +799,8 @@ i1 = i1 + (this.field_147000_g - 4); } + RenderSystem.color3f(1F, 1F, 1F); //Forge: Reset color in case Items change it. + RenderSystem.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. - this.blit(l, i1, j, k, 28, 32); - this.setBlitOffset(100); - this.itemRenderer.field_77023_b = 100.0F; -@@ -896,6 +979,22 @@ + this.func_238474_b_(p_238808_1_, l, i1, j, k, 28, 32); + this.field_230707_j_.field_77023_b = 100.0F; + l = l + 6; +@@ -769,6 +852,8 @@ + for(int i = 0; i < 5; ++i) { + for(int j = 0; j < 9; ++j) { + this.func_75146_a(new CreativeScreen.LockedSlot(CreativeScreen.field_195378_x, i * 9 + j, 9 + j * 18, 18 + i * 18)); ++ RenderSystem.color3f(1F, 1F, 1F); //Forge: Reset color in case Items change it. ++ RenderSystem.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. + } + } + +@@ -884,6 +969,22 @@ public boolean func_82869_a(PlayerEntity p_82869_1_) { return this.field_148332_b.func_82869_a(p_82869_1_); } diff --git a/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch b/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch deleted file mode 100644 index 3a19cf306..000000000 --- a/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/gui/toasts/RecipeToast.java -+++ b/net/minecraft/client/gui/toasts/RecipeToast.java -@@ -34,7 +34,7 @@ - p_193653_1_.blit(0, 0, 0, 32, 160, 32); - 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); -- 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(); - RenderSystem.pushMatrix(); - RenderSystem.scalef(0.6F, 0.6F, 1.0F); diff --git a/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch b/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch index 454df2fa2..bba5b1a7a 100644 --- a/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch @@ -1,39 +1,39 @@ --- a/net/minecraft/client/gui/widget/Widget.java +++ b/net/minecraft/client/gui/widget/Widget.java @@ -111,7 +111,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 = this.active ? 16777215 : 10526880; + this.func_238474_b_(p_230431_1_, this.field_230690_l_, this.field_230691_m_, 0, 46 + i * 20, this.field_230688_j_ / 2, this.field_230689_k_); + this.func_238474_b_(p_230431_1_, this.field_230690_l_ + this.field_230688_j_ / 2, this.field_230691_m_, 200 - this.field_230688_j_ / 2, 46 + i * 20, this.field_230688_j_ / 2, this.field_230689_k_); + this.func_230441_a_(p_230431_1_, minecraft, p_230431_2_, p_230431_3_); +- int j = this.field_230693_o_ ? 16777215 : 10526880; + int j = getFGColor(); - this.drawCenteredString(fontrenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, j | MathHelper.func_76123_f(this.alpha * 255.0F) << 24); + this.func_238472_a_(p_230431_1_, fontrenderer, this.func_230458_i_(), this.field_230690_l_ + this.field_230688_j_ / 2, this.field_230691_m_ + (this.field_230689_k_ - 8) / 2, j | MathHelper.func_76123_f(this.field_230695_q_ * 255.0F) << 24); } @@ -206,6 +206,14 @@ - this.width = p_setWidth_1_; + this.field_230688_j_ = p_230991_1_; } + public int getHeight() { -+ return this.height; ++ return this.field_230689_k_; + } + + public void setHeight(int value) { -+ this.height = value; ++ this.field_230689_k_ = value; + } + - public void setAlpha(float p_setAlpha_1_) { - this.alpha = p_setAlpha_1_; + public void func_230986_a_(float p_230986_1_) { + this.field_230695_q_ = p_230986_1_; } @@ -233,4 +241,17 @@ - protected void setFocused(boolean p_setFocused_1_) { - this.focused = p_setFocused_1_; + protected void func_230996_d_(boolean p_230996_1_) { + this.field_230686_c_ = p_230996_1_; } + + public static final int UNSET_FG_COLOR = -1; + protected int packedFGColor = UNSET_FG_COLOR; + public int getFGColor() { + if (packedFGColor != UNSET_FG_COLOR) return packedFGColor; -+ return this.active ? 16777215 : 10526880; // White : Light Grey ++ return this.field_230693_o_ ? 16777215 : 10526880; // White : Light Grey + } + 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 index 3f358803d..5a6d82c87 100644 --- a/patches/minecraft/net/minecraft/client/gui/widget/list/AbstractList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/widget/list/AbstractList.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/gui/widget/list/AbstractList.java +++ b/net/minecraft/client/gui/widget/list/AbstractList.java -@@ -450,6 +450,13 @@ - return flag; +@@ -471,6 +471,13 @@ + p_238480_1_.field_230666_a_ = this; } -+ 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.x0; } -+ public int getRight() { return this.x1; } ++ public int getWidth() { return this.field_230670_d_; } ++ public int getHeight() { return this.field_230671_e_; } ++ public int getTop() { return this.field_230672_i_; } ++ public int getBottom() { return this.field_230673_j_; } ++ public int getLeft() { return this.field_230674_k_; } ++ public int getRight() { return this.field_230675_l_; } + @OnlyIn(Dist.CLIENT) public abstract static class AbstractListEntry> implements IGuiEventListener { 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 index 62adf284f..73332c680 100644 --- a/patches/minecraft/net/minecraft/client/gui/widget/list/KeyBindingList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/widget/list/KeyBindingList.java.patch @@ -1,60 +1,60 @@ --- a/net/minecraft/client/gui/widget/list/KeyBindingList.java +++ b/net/minecraft/client/gui/widget/list/KeyBindingList.java -@@ -45,7 +45,7 @@ +@@ -50,7 +50,7 @@ } - protected int getScrollbarPosition() { -- return super.getScrollbarPosition() + 15; -+ return super.getScrollbarPosition() + 15 + 20; + protected int func_230952_d_() { +- return super.func_230952_d_() + 15; ++ return super.func_230952_d_() + 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_; + public int func_230949_c_() { +@@ -94,7 +94,7 @@ + private KeyEntry(final KeyBinding p_i232281_2_, final ITextComponent p_i232281_3_) { + this.field_148282_b = p_i232281_2_; + this.field_148283_c = p_i232281_3_; +- this.field_148280_d = new Button(0, 0, 75, 20, p_i232281_3_, (p_214386_2_) -> { ++ this.field_148280_d = new Button(0, 0, 75 + 20 /*Forge: add space*/, 20, p_i232281_3_, (p_214386_2_) -> { + KeyBindingList.this.field_148191_k.field_146491_f = p_i232281_2_; }) { - protected String getNarrationMessage() { -@@ -97,6 +97,7 @@ + protected IFormattableTextComponent func_230442_c_() { +@@ -102,6 +102,7 @@ } }; - this.field_148281_e = new Button(0, 0, 50, 20, I18n.func_135052_a("controls.reset"), (p_214387_2_) -> { + this.field_148281_e = new Button(0, 0, 50, 20, new TranslationTextComponent("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()); + KeyBindingList.this.field_230668_b_.field_71474_y.func_198014_a(p_i232281_2_, p_i232281_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_) { +@@ -114,7 +115,7 @@ + public void func_230432_a_(MatrixStack p_230432_1_, int p_230432_2_, int p_230432_3_, int p_230432_4_, int p_230432_5_, int p_230432_6_, int p_230432_7_, int p_230432_8_, boolean p_230432_9_, float p_230432_10_) { 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()); + KeyBindingList.this.field_230668_b_.field_71466_p.func_238422_b_(p_230432_1_, this.field_148283_c, (float)(p_230432_4_ + 90 - KeyBindingList.this.field_148188_n), (float)(p_230432_3_ + p_230432_6_ / 2 - 9 / 2), 16777215); +- this.field_148281_e.field_230690_l_ = p_230432_4_ + 190; ++ this.field_148281_e.field_230690_l_ = p_230432_4_ + 190 + 20; + this.field_148281_e.field_230691_m_ = p_230432_3_; + this.field_148281_e.field_230693_o_ = !this.field_148282_b.func_197985_l(); + this.field_148281_e.func_230430_a_(p_230432_1_, p_230432_7_, p_230432_8_, p_230432_10_); +@@ -122,11 +123,12 @@ + this.field_148280_d.field_230691_m_ = p_230432_3_; + this.field_148280_d.func_238482_a_(this.field_148282_b.func_238171_j_()); 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) { + for(KeyBinding keybinding : KeyBindingList.this.field_230668_b_.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); ++ keyCodeModifierConflict &= keybinding.hasKeyCodeModifierConflict(keybinding); } } } -@@ -129,7 +131,7 @@ +@@ -134,7 +136,7 @@ if (flag) { - this.field_148280_d.setMessage(TextFormatting.WHITE + "> " + TextFormatting.YELLOW + this.field_148280_d.getMessage() + TextFormatting.WHITE + " <"); + this.field_148280_d.func_238482_a_((new StringTextComponent("> ")).func_230529_a_(this.field_148280_d.func_230458_i_().func_230532_e_().func_240699_a_(TextFormatting.YELLOW)).func_240702_b_(" <").func_240699_a_(TextFormatting.YELLOW)); } 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.func_238482_a_(this.field_148280_d.func_230458_i_().func_230532_e_().func_240699_a_(TextFormatting.RED)); ++ this.field_148280_d.func_238482_a_(this.field_148280_d.func_230458_i_().func_230532_e_().func_240699_a_(keyCodeModifierConflict ? TextFormatting.GOLD : TextFormatting.RED)); } - this.field_148280_d.render(p_render_6_, p_render_7_, p_render_9_); + this.field_148280_d.func_230430_a_(p_230432_1_, p_230432_7_, p_230432_8_, p_230432_10_); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch index db56d12c5..ab9b9644a 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/PlayerController.java +++ b/net/minecraft/client/multiplayer/PlayerController.java -@@ -92,6 +92,7 @@ +@@ -94,6 +94,7 @@ } public boolean func_187103_a(BlockPos p_187103_1_) { @@ -8,7 +8,7 @@ if (this.field_78776_a.field_71439_g.func_223729_a(this.field_78776_a.field_71441_e, p_187103_1_, this.field_78779_k)) { return false; } else { -@@ -103,12 +104,11 @@ +@@ -105,12 +106,11 @@ 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; @@ -17,18 +17,18 @@ return false; } else { - block.func_176208_a(world, p_187103_1_, blockstate, 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); -+ boolean flag = blockstate.removedByPlayer(world, p_187103_1_, field_78776_a.field_71439_g, false, ifluidstate); + FluidState fluidstate = world.func_204610_c(p_187103_1_); +- boolean flag = world.func_180501_a(p_187103_1_, fluidstate.func_206883_i(), 11); ++ boolean flag = blockstate.removedByPlayer(world, p_187103_1_, field_78776_a.field_71439_g, false, fluidstate); if (flag) { block.func_176206_d(world, p_187103_1_, blockstate); } -@@ -129,21 +129,25 @@ +@@ -131,21 +131,25 @@ BlockState blockstate = 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_, blockstate, 1.0F); this.func_225324_a(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_).isCanceled()) - func_178891_a(this.field_78776_a, this, p_180511_1_, p_180511_2_); + this.func_187103_a(p_180511_1_); this.field_78781_i = 5; } else if (!this.field_78778_j || !this.func_178893_a(p_180511_1_)) { if (this.field_78778_j) { @@ -50,12 +50,12 @@ if (flag && blockstate1.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 { -@@ -183,22 +187,24 @@ +@@ -185,22 +189,24 @@ BlockState blockstate1 = this.field_78776_a.field_71441_e.func_180495_p(p_180512_1_); this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180512_1_, blockstate1, 1.0F); this.func_225324_a(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180512_1_, p_180512_2_); + if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180512_1_, p_180512_2_).isCanceled()) - func_178891_a(this.field_78776_a, this, p_180512_1_, p_180512_2_); + this.func_187103_a(p_180512_1_); 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_); @@ -77,7 +77,7 @@ if (this.field_78770_f >= 1.0F) { this.field_78778_j = false; this.func_225324_a(CPlayerDiggingPacket.Action.STOP_DESTROY_BLOCK, p_180512_1_, p_180512_2_); -@@ -217,7 +223,8 @@ +@@ -219,7 +225,8 @@ } public float func_78757_d() { @@ -87,7 +87,7 @@ } public void func_78765_e() { -@@ -234,7 +241,7 @@ +@@ -236,7 +243,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()) { @@ -96,7 +96,7 @@ } return p_178893_1_.equals(this.field_178895_c) && flag; -@@ -256,13 +263,27 @@ +@@ -258,13 +265,27 @@ return ActionResultType.FAIL; } else { ItemStack itemstack = p_217292_1_.func_184586_b(p_217292_3_); @@ -126,7 +126,7 @@ ActionResultType actionresulttype = p_217292_2_.func_180495_p(blockpos).func_227031_a_(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_); if (actionresulttype.func_226246_a_()) { this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); -@@ -271,8 +292,8 @@ +@@ -273,8 +294,8 @@ } this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); @@ -136,7 +136,7 @@ ActionResultType actionresulttype1; if (this.field_78779_k.func_77145_d()) { int i = itemstack.func_190916_E(); -@@ -300,11 +321,14 @@ +@@ -302,11 +323,14 @@ if (p_187101_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { return ActionResultType.PASS; } else { @@ -145,29 +145,29 @@ 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) { + if (itemstack1 != itemstack) { 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(); -@@ -329,6 +353,9 @@ +@@ -335,6 +359,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_)); + this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187097_2_, p_187097_3_, p_187097_1_.func_225608_bj_())); + 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_); } -@@ -336,6 +363,9 @@ +@@ -342,6 +369,9 @@ this.func_78750_j(); - Vec3d vec3d = p_187102_3_.func_216347_e().func_178786_a(p_187102_2_.func_226277_ct_(), p_187102_2_.func_226278_cu_(), p_187102_2_.func_226281_cx_()); - this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187102_2_, p_187102_4_, vec3d)); + Vector3d vector3d = p_187102_3_.func_216347_e().func_178786_a(p_187102_2_.func_226277_ct_(), p_187102_2_.func_226278_cu_(), p_187102_2_.func_226281_cx_()); + this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187102_2_, p_187102_4_, vector3d, p_187102_1_.func_225608_bj_())); + 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_); + return this.field_78779_k == GameType.SPECTATOR ? ActionResultType.PASS : p_187102_2_.func_184199_a(p_187102_1_, vector3d, 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 334cd67c3..fdd38d17e 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/multiplayer/ServerData.java +++ b/net/minecraft/client/multiplayer/ServerData.java -@@ -22,6 +22,7 @@ - private ServerData.ServerResourceMode field_152587_j = ServerData.ServerResourceMode.PROMPT; +@@ -26,6 +26,7 @@ + @Nullable private String field_147411_m; private boolean field_181042_l; + public net.minecraftforge.fml.client.ExtendedServerListData forgeData = null; diff --git a/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch b/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch index 112890700..9a1e9b52e 100644 --- a/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/network/ServerPinger.java +++ b/net/minecraft/client/network/ServerPinger.java -@@ -120,6 +120,8 @@ - p_147224_1_.func_147407_a((String)null); +@@ -116,6 +116,8 @@ + p_147224_2_.run(); } + net.minecraftforge.fml.client.ClientHooks.processForgeListPingData(serverstatusresponse, p_147224_1_); diff --git a/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch b/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch index 1d23d4117..b6a04ebbc 100644 --- a/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/network/play/ClientPlayNetHandler.java +++ b/net/minecraft/client/network/play/ClientPlayNetHandler.java -@@ -361,6 +361,7 @@ +@@ -388,6 +388,7 @@ this.field_147299_f.field_184132_p.func_217737_a(); this.field_147299_f.field_71439_g.func_70065_x(); @@ -8,38 +8,18 @@ int i = p_147282_1_.func_149197_c(); this.field_147300_g.func_217408_a(i, this.field_147299_f.field_71439_g); this.field_147299_f.field_71439_g.field_71158_b = new MovementInputFromOptions(this.field_147299_f.field_71474_y); -@@ -372,6 +373,7 @@ - this.field_147299_f.field_71439_g.func_175150_k(p_147282_1_.func_179744_h()); +@@ -399,6 +400,7 @@ this.field_147299_f.field_71439_g.func_228355_a_(p_147282_1_.func_229743_k_()); this.field_147299_f.field_71442_b.func_78746_a(p_147282_1_.func_149198_e()); + this.field_147299_f.field_71442_b.func_241675_a_(p_147282_1_.func_241786_f_()); + net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(field_147302_e, "PLAY_TO_SERVER"); this.field_147299_f.field_71474_y.func_82879_c(); this.field_147302_e.func_179290_a(new CCustomPayloadPacket(CCustomPayloadPacket.field_210344_a, (new PacketBuffer(Unpooled.buffer())).func_180714_a(ClientBrandRetriever.getClientModName()))); this.field_147299_f.func_213229_ar().func_216814_a(); -@@ -727,7 +729,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); - } +@@ -1034,8 +1036,10 @@ + clientplayerentity1.func_233645_dx_().func_233784_a_(clientplayerentity.func_233645_dx_()); } -@@ -803,7 +805,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_) { -@@ -983,8 +987,10 @@ - this.field_147299_f.field_175622_Z = clientplayerentity1; - clientplayerentity1.func_184212_Q().func_187218_a(clientplayerentity.func_184212_Q().func_187231_c()); - clientplayerentity1.func_110140_aT().func_226303_a_(clientplayerentity.func_110140_aT()); + clientplayerentity1.updateSyncFields(clientplayerentity); // Forge: fix MC-10657 clientplayerentity1.func_70065_x(); clientplayerentity1.func_175158_f(s); @@ -47,20 +27,20 @@ this.field_147300_g.func_217408_a(i, clientplayerentity1); clientplayerentity1.field_70177_z = -180.0F; clientplayerentity1.field_71158_b = new MovementInputFromOptions(this.field_147299_f.field_71474_y); -@@ -1105,6 +1111,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 || i == 14 && tileentity instanceof BeehiveTileEntity) { - 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_); - } +@@ -1161,6 +1165,12 @@ - if (flag && this.field_147299_f.field_71462_r instanceof CommandBlockScreen) { -@@ -1276,6 +1288,7 @@ + if (flag && this.field_147299_f.field_71462_r instanceof CommandBlockScreen) { + ((CommandBlockScreen)this.field_147299_f.field_71462_r).func_184075_a(); ++ } else { ++ if(tileentity == null) { ++ field_147301_d.error("Received invalid update packet for null tile entity at {} with data: {}", p_147273_1_.func_179823_a(), p_147273_1_.func_148857_g()); ++ return; ++ } ++ tileentity.onDataPacket(field_147302_e, p_147273_1_); + } + + } +@@ -1329,6 +1339,7 @@ clientrecipebook.func_199644_c(); clientrecipebook.func_199642_d().forEach(imutablesearchtree::func_217872_a); imutablesearchtree.func_194040_a(); @@ -68,7 +48,7 @@ } public void func_200232_a(SPlayerLookPacket p_200232_1_) { -@@ -1356,7 +1369,7 @@ +@@ -1409,7 +1420,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) { @@ -77,7 +57,7 @@ if (effect != null) { EffectInstance effectinstance = new EffectInstance(effect, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h()); effectinstance.func_100012_b(p_147260_1_.func_149429_c()); -@@ -1376,6 +1389,7 @@ +@@ -1426,6 +1437,7 @@ } this.field_147299_f.func_213253_a(SearchTreeManager.field_215360_b).func_194040_a(); @@ -85,9 +65,9 @@ } public void func_175098_a(SCombatPacket p_175098_1_) { -@@ -1851,10 +1865,12 @@ +@@ -1909,10 +1921,12 @@ int l5 = packetbuffer.readInt(); - this.field_147299_f.field_184132_p.field_229018_q_.func_229022_a_(blockpos7, l3, s10, l5); + this.field_147299_f.field_184132_p.field_229018_q_.func_229022_a_(blockpos8, l3, s10, l5); } else { - field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation); + if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147240_1_, this.field_147302_e)) @@ -99,12 +79,3 @@ packetbuffer.release(); } -@@ -1994,7 +2010,7 @@ - for(SEntityPropertiesPacket.Snapshot sentitypropertiespacket$snapshot : p_147290_1_.func_149441_d()) { - IAttributeInstance iattributeinstance = abstractattributemap.func_111152_a(sentitypropertiespacket$snapshot.func_151409_a()); - if (iattributeinstance == null) { -- iattributeinstance = abstractattributemap.func_111150_b(new RangedAttribute((IAttribute)null, sentitypropertiespacket$snapshot.func_151409_a(), 0.0D, Double.MIN_NORMAL, Double.MAX_VALUE)); -+ iattributeinstance = abstractattributemap.func_111150_b(new RangedAttribute((IAttribute)null, sentitypropertiespacket$snapshot.func_151409_a(), 0.0D, -Double.MAX_VALUE, Double.MAX_VALUE)); // FORGE: fix invalid value range (MC-150405) - } - - iattributeinstance.func_111128_a(sentitypropertiespacket$snapshot.func_151410_b()); diff --git a/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch b/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch index 8c8a24ecc..8b6872bea 100644 --- a/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/client/particle/DiggingParticle.java +++ b/net/minecraft/client/particle/DiggingParticle.java -@@ -37,6 +37,7 @@ +@@ -36,6 +36,7 @@ } public DiggingParticle func_174846_a(BlockPos p_174846_1_) { + updateSprite(p_174846_1_); this.field_181019_az = p_174846_1_; - if (this.field_174847_a.func_177230_c() == Blocks.field_196658_i) { + if (this.field_174847_a.func_203425_a(Blocks.field_196658_i)) { return this; -@@ -94,7 +95,13 @@ +@@ -92,7 +93,13 @@ public static class Factory implements IParticleFactory { - public Particle func_199234_a(BlockParticleData p_199234_1_, World p_199234_2_, double p_199234_3_, double p_199234_5_, double p_199234_7_, double p_199234_9_, double p_199234_11_, double p_199234_13_) { + public Particle func_199234_a(BlockParticleData p_199234_1_, ClientWorld p_199234_2_, double p_199234_3_, double p_199234_5_, double p_199234_7_, double p_199234_9_, double p_199234_11_, double p_199234_13_) { BlockState blockstate = p_199234_1_.func_197584_c(); -- return !blockstate.func_196958_f() && blockstate.func_177230_c() != Blocks.field_196603_bb ? (new DiggingParticle(p_199234_2_, p_199234_3_, p_199234_5_, p_199234_7_, p_199234_9_, p_199234_11_, p_199234_13_, blockstate)).func_174845_l() : null; -+ return !blockstate.func_196958_f() && blockstate.func_177230_c() != Blocks.field_196603_bb ? (new DiggingParticle(p_199234_2_, p_199234_3_, p_199234_5_, p_199234_7_, p_199234_9_, p_199234_11_, p_199234_13_, blockstate)).func_174845_l().updateSprite(p_199234_1_.getPos()) : null; +- return !blockstate.func_196958_f() && !blockstate.func_203425_a(Blocks.field_196603_bb) ? (new DiggingParticle(p_199234_2_, p_199234_3_, p_199234_5_, p_199234_7_, p_199234_9_, p_199234_11_, p_199234_13_, blockstate)).func_174845_l() : null; ++ return !blockstate.func_196958_f() && !blockstate.func_203425_a(Blocks.field_196603_bb) ? (new DiggingParticle(p_199234_2_, p_199234_3_, p_199234_5_, p_199234_7_, p_199234_9_, p_199234_11_, p_199234_13_, blockstate)).func_174845_l().updateSprite(p_199234_1_.getPos()) : null; } } + -+ private Particle updateSprite(BlockPos pos) { //FORGE: we cannot assume that the x y z of the particles match the block pos of the block. -+ if (pos != null) // There are cases where we are not able to obtain the correct source pos, and need to fallback to the non-model data version -+ this.func_217567_a(Minecraft.func_71410_x().func_175602_ab().func_175023_a().getTexture(field_174847_a, field_187122_b, pos)); -+ return this; -+ } ++ private Particle updateSprite(BlockPos pos) { //FORGE: we cannot assume that the x y z of the particles match the block pos of the block. ++ if (pos != null) // There are cases where we are not able to obtain the correct source pos, and need to fallback to the non-model data version ++ this.func_217567_a(Minecraft.func_71410_x().func_175602_ab().func_175023_a().getTexture(field_174847_a, field_187122_b, pos)); ++ return this; ++ } } diff --git a/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch b/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch index 86d55a8e5..7ba703dc6 100644 --- a/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch @@ -9,7 +9,7 @@ private final Queue field_187241_h = Queues.newArrayDeque(); private final Map field_215242_i = Maps.newHashMap(); private final AtlasTexture field_215243_j = new AtlasTexture(AtlasTexture.field_215262_g); -@@ -143,13 +143,13 @@ +@@ -153,13 +153,13 @@ } public void func_199283_a(ParticleType p_199283_1_, IParticleFactory p_199283_2_) { @@ -25,21 +25,16 @@ } public 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_) { -@@ -238,11 +238,12 @@ +@@ -248,7 +248,7 @@ @Nullable private Particle func_199927_b(T p_199927_1_, double p_199927_2_, double p_199927_4_, double p_199927_6_, double p_199927_8_, double p_199927_10_, double p_199927_12_) { -- IParticleFactory iparticlefactory = (IParticleFactory) this.field_178932_g.get(Registry.field_212632_u.func_148757_b(p_199927_1_.func_197554_b())); -+ IParticleFactory iparticlefactory = (IParticleFactory) this.field_178932_g.get(Registry.field_212632_u.func_177774_c(p_199927_1_.func_197554_b())); +- IParticleFactory iparticlefactory = (IParticleFactory)this.field_178932_g.get(Registry.field_212632_u.func_148757_b(p_199927_1_.func_197554_b())); ++ IParticleFactory iparticlefactory = (IParticleFactory)this.field_178932_g.get(Registry.field_212632_u.func_177774_c(p_199927_1_.func_197554_b())); return iparticlefactory == null ? null : iparticlefactory.func_199234_a(p_199927_1_, this.field_78878_a, p_199927_2_, p_199927_4_, p_199927_6_, p_199927_8_, p_199927_10_, p_199927_12_); } - public void func_78873_a(Particle p_78873_1_) { -+ if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. - this.field_187241_h.add(p_78873_1_); - } - -@@ -305,14 +306,18 @@ +@@ -315,14 +315,18 @@ public void func_228345_a_(MatrixStack p_228345_1_, IRenderTypeBuffer.Impl p_228345_2_, LightTexture p_228345_3_, ActiveRenderInfo p_228345_4_, float p_228345_5_) { p_228345_3_.func_205109_c(); @@ -59,7 +54,7 @@ Iterable iterable = this.field_78876_b.get(iparticlerendertype); if (iterable != null) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); -@@ -351,7 +356,7 @@ +@@ -362,7 +366,7 @@ } public void func_180533_a(BlockPos p_180533_1_, BlockState p_180533_2_) { @@ -68,7 +63,7 @@ VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_); double d0 = 0.25D; voxelshape.func_197755_b((p_228348_3_, p_228348_5_, p_228348_7_, p_228348_9_, p_228348_11_, p_228348_13_) -> { -@@ -423,6 +428,12 @@ +@@ -434,6 +438,12 @@ return String.valueOf(this.field_78876_b.values().stream().mapToInt(Collection::size).sum()); } diff --git a/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch b/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch index ade014f8c..a6705c99e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/ActiveRenderInfo.java +++ b/net/minecraft/client/renderer/ActiveRenderInfo.java -@@ -168,4 +168,16 @@ +@@ -170,4 +170,16 @@ this.field_216791_c = null; this.field_216789_a = false; } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch index d8db3857a..145d7371e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -1,101 +1,105 @@ --- a/net/minecraft/client/renderer/BlockModelRenderer.java +++ b/net/minecraft/client/renderer/BlockModelRenderer.java -@@ -37,13 +37,18 @@ +@@ -37,65 +37,78 @@ this.field_187499_a = p_i46575_1_; } + @Deprecated //Forge: Model data argument - public boolean func_228802_a_(ILightReader p_228802_1_, IBakedModel p_228802_2_, BlockState p_228802_3_, BlockPos p_228802_4_, MatrixStack p_228802_5_, IVertexBuilder p_228802_6_, boolean p_228802_7_, Random p_228802_8_, long p_228802_9_, int p_228802_11_) { + public boolean func_228802_a_(IBlockDisplayReader p_228802_1_, IBakedModel p_228802_2_, BlockState p_228802_3_, BlockPos p_228802_4_, MatrixStack p_228802_5_, IVertexBuilder p_228802_6_, boolean p_228802_7_, Random p_228802_8_, long p_228802_9_, int p_228802_11_) { - boolean flag = Minecraft.func_71379_u() && p_228802_3_.func_185906_d() == 0 && p_228802_2_.func_177555_b(); -+ return renderModel(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); +- Vector3d vector3d = p_228802_3_.func_191059_e(p_228802_1_, p_228802_4_); +- p_228802_5_.func_227861_a_(vector3d.field_72450_a, vector3d.field_72448_b, vector3d.field_72449_c); ++ return renderModel(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } -+ public boolean renderModel(ILightReader p_228802_1_, IBakedModel p_228802_2_, BlockState p_228802_3_, BlockPos p_228802_4_, MatrixStack p_228802_5_, IVertexBuilder p_228802_6_, boolean p_228802_7_, Random p_228802_8_, long p_228802_9_, int p_228802_11_, net.minecraftforge.client.model.data.IModelData modelData) { -+ boolean flag = Minecraft.func_71379_u() && p_228802_3_.getLightValue(p_228802_1_, p_228802_4_) == 0 && p_228802_2_.func_177555_b(); - Vec3d vec3d = p_228802_3_.func_191059_e(p_228802_1_, p_228802_4_); - p_228802_5_.func_227861_a_(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c); -+ modelData = p_228802_2_.getModelData(p_228802_1_, p_228802_4_, p_228802_3_, modelData); ++ public boolean renderModel(IBlockDisplayReader worldIn, IBakedModel modelIn, BlockState stateIn, BlockPos posIn, MatrixStack matrixIn, IVertexBuilder buffer, boolean checkSides, Random randomIn, long rand, int combinedOverlayIn, net.minecraftforge.client.model.data.IModelData modelData) { ++ boolean flag = Minecraft.func_71379_u() && stateIn.getLightValue(worldIn, posIn) == 0 && modelIn.func_177555_b(); ++ Vector3d vector3d = stateIn.func_191059_e(worldIn, posIn); ++ matrixIn.func_227861_a_(vector3d.field_72450_a, vector3d.field_72448_b, vector3d.field_72449_c); ++ modelData = modelIn.getModelData(worldIn, posIn, stateIn, modelData); try { - return flag ? this.func_228805_b_(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_) : this.func_228806_c_(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_); -+ return flag ? this.renderModelSmooth(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_, modelData) : this.renderModelFlat(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_, modelData); ++ return flag ? this.renderModelSmooth(worldIn, modelIn, stateIn, posIn, matrixIn, buffer, checkSides, randomIn, rand, combinedOverlayIn, modelData) : this.renderModelFlat(worldIn, modelIn, stateIn, posIn, matrixIn, buffer, checkSides, randomIn, rand, combinedOverlayIn, modelData); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.func_85055_a(throwable, "Tesselating block model"); CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block model being tesselated"); -@@ -53,7 +58,11 @@ +- CrashReportCategory.func_175750_a(crashreportcategory, p_228802_4_, p_228802_3_); ++ CrashReportCategory.func_175750_a(crashreportcategory, posIn, stateIn); + crashreportcategory.func_71507_a("Using AO", flag); + throw new ReportedException(crashreport); } } + @Deprecated //Forge: Model data argument - public boolean func_228805_b_(ILightReader p_228805_1_, IBakedModel p_228805_2_, BlockState p_228805_3_, BlockPos p_228805_4_, MatrixStack p_228805_5_, IVertexBuilder p_228805_6_, boolean p_228805_7_, Random p_228805_8_, long p_228805_9_, int p_228805_11_) { -+ return renderModelSmooth(p_228805_1_, p_228805_2_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, p_228805_7_, p_228805_8_, p_228805_9_, p_228805_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public boolean func_228805_b_(IBlockDisplayReader p_228805_1_, IBakedModel p_228805_2_, BlockState p_228805_3_, BlockPos p_228805_4_, MatrixStack p_228805_5_, IVertexBuilder p_228805_6_, boolean p_228805_7_, Random p_228805_8_, long p_228805_9_, int p_228805_11_) { ++ return renderModelSmooth(p_228805_1_, p_228805_2_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, p_228805_7_, p_228805_8_, p_228805_9_, p_228805_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } -+ public boolean renderModelSmooth(ILightReader p_228805_1_, IBakedModel p_228805_2_, BlockState p_228805_3_, BlockPos p_228805_4_, MatrixStack p_228805_5_, IVertexBuilder p_228805_6_, boolean p_228805_7_, Random p_228805_8_, long p_228805_9_, int p_228805_11_, net.minecraftforge.client.model.data.IModelData modelData) { ++ public boolean renderModelSmooth(IBlockDisplayReader worldIn, IBakedModel modelIn, BlockState stateIn, BlockPos posIn, MatrixStack matrixStackIn, IVertexBuilder buffer, boolean checkSides, Random randomIn, long rand, int combinedOverlayIn, net.minecraftforge.client.model.data.IModelData modelData) { boolean flag = false; float[] afloat = new float[Direction.values().length * 2]; BitSet bitset = new BitSet(3); -@@ -61,7 +70,7 @@ + BlockModelRenderer.AmbientOcclusionFace blockmodelrenderer$ambientocclusionface = new BlockModelRenderer.AmbientOcclusionFace(); for(Direction direction : Direction.values()) { - p_228805_8_.setSeed(p_228805_9_); +- p_228805_8_.setSeed(p_228805_9_); - List list = p_228805_2_.func_200117_a(p_228805_3_, direction, p_228805_8_); -+ List list = p_228805_2_.getQuads(p_228805_3_, direction, p_228805_8_, modelData); - if (!list.isEmpty() && (!p_228805_7_ || Block.func_176225_a(p_228805_3_, p_228805_1_, p_228805_4_, direction))) { - this.func_228799_a_(p_228805_1_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, list, afloat, bitset, blockmodelrenderer$ambientocclusionface, p_228805_11_); +- if (!list.isEmpty() && (!p_228805_7_ || Block.func_176225_a(p_228805_3_, p_228805_1_, p_228805_4_, direction))) { +- this.func_228799_a_(p_228805_1_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, list, afloat, bitset, blockmodelrenderer$ambientocclusionface, p_228805_11_); ++ randomIn.setSeed(rand); ++ List list = modelIn.getQuads(stateIn, direction, randomIn, modelData); ++ if (!list.isEmpty() && (!checkSides || Block.func_176225_a(stateIn, worldIn, posIn, direction))) { ++ this.func_228799_a_(worldIn, stateIn, posIn, matrixStackIn, buffer, list, afloat, bitset, blockmodelrenderer$ambientocclusionface, combinedOverlayIn); flag = true; -@@ -69,7 +78,7 @@ + } } - p_228805_8_.setSeed(p_228805_9_); +- p_228805_8_.setSeed(p_228805_9_); - List list1 = p_228805_2_.func_200117_a(p_228805_3_, (Direction)null, p_228805_8_); -+ List list1 = p_228805_2_.getQuads(p_228805_3_, (Direction)null, p_228805_8_, modelData); ++ randomIn.setSeed(rand); ++ List list1 = modelIn.getQuads(stateIn, (Direction)null, randomIn, modelData); if (!list1.isEmpty()) { - this.func_228799_a_(p_228805_1_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface, p_228805_11_); +- this.func_228799_a_(p_228805_1_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface, p_228805_11_); ++ this.func_228799_a_(worldIn, stateIn, posIn, matrixStackIn, buffer, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface, combinedOverlayIn); flag = true; -@@ -78,13 +87,18 @@ + } + return flag; } + @Deprecated //Forge: Model data argument - public boolean func_228806_c_(ILightReader p_228806_1_, IBakedModel p_228806_2_, BlockState p_228806_3_, BlockPos p_228806_4_, MatrixStack p_228806_5_, IVertexBuilder p_228806_6_, boolean p_228806_7_, Random p_228806_8_, long p_228806_9_, int p_228806_11_) { -+ return renderModelFlat(p_228806_1_, p_228806_2_, p_228806_3_, p_228806_4_, p_228806_5_, p_228806_6_, p_228806_7_, p_228806_8_, p_228806_9_, p_228806_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public boolean func_228806_c_(IBlockDisplayReader p_228806_1_, IBakedModel p_228806_2_, BlockState p_228806_3_, BlockPos p_228806_4_, MatrixStack p_228806_5_, IVertexBuilder p_228806_6_, boolean p_228806_7_, Random p_228806_8_, long p_228806_9_, int p_228806_11_) { ++ return renderModelFlat(p_228806_1_, p_228806_2_, p_228806_3_, p_228806_4_, p_228806_5_, p_228806_6_, p_228806_7_, p_228806_8_, p_228806_9_, p_228806_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } -+ -+ public boolean renderModelFlat(ILightReader p_228806_1_, IBakedModel p_228806_2_, BlockState p_228806_3_, BlockPos p_228806_4_, MatrixStack p_228806_5_, IVertexBuilder p_228806_6_, boolean p_228806_7_, Random p_228806_8_, long p_228806_9_, int p_228806_11_, net.minecraftforge.client.model.data.IModelData modelData) { ++ public boolean renderModelFlat(IBlockDisplayReader worldIn, IBakedModel modelIn, BlockState stateIn, BlockPos posIn, MatrixStack matrixStackIn, IVertexBuilder buffer, boolean checkSides, Random randomIn, long rand, int combinedOverlayIn, net.minecraftforge.client.model.data.IModelData modelData) { boolean flag = false; BitSet bitset = new BitSet(3); for(Direction direction : Direction.values()) { - p_228806_8_.setSeed(p_228806_9_); +- p_228806_8_.setSeed(p_228806_9_); - List list = p_228806_2_.func_200117_a(p_228806_3_, direction, p_228806_8_); -+ List list = p_228806_2_.getQuads(p_228806_3_, direction, p_228806_8_, modelData); - if (!list.isEmpty() && (!p_228806_7_ || Block.func_176225_a(p_228806_3_, p_228806_1_, p_228806_4_, direction))) { - int i = WorldRenderer.func_228420_a_(p_228806_1_, p_228806_3_, p_228806_4_.func_177972_a(direction)); - this.func_228798_a_(p_228806_1_, p_228806_3_, p_228806_4_, i, p_228806_11_, false, p_228806_5_, p_228806_6_, list, bitset); -@@ -93,7 +107,7 @@ +- if (!list.isEmpty() && (!p_228806_7_ || Block.func_176225_a(p_228806_3_, p_228806_1_, p_228806_4_, direction))) { +- int i = WorldRenderer.func_228420_a_(p_228806_1_, p_228806_3_, p_228806_4_.func_177972_a(direction)); +- this.func_228798_a_(p_228806_1_, p_228806_3_, p_228806_4_, i, p_228806_11_, false, p_228806_5_, p_228806_6_, list, bitset); ++ randomIn.setSeed(rand); ++ List list = modelIn.func_200117_a(stateIn, direction, randomIn); ++ if (!list.isEmpty() && (!checkSides || Block.func_176225_a(stateIn, worldIn, posIn, direction))) { ++ int i = WorldRenderer.func_228420_a_(worldIn, stateIn, posIn.func_177972_a(direction)); ++ this.func_228798_a_(worldIn, stateIn, posIn, i, combinedOverlayIn, false, matrixStackIn, buffer, list, bitset); + flag = true; + } } - p_228806_8_.setSeed(p_228806_9_); +- p_228806_8_.setSeed(p_228806_9_); - List list1 = p_228806_2_.func_200117_a(p_228806_3_, (Direction)null, p_228806_8_); -+ List list1 = p_228806_2_.getQuads(p_228806_3_, (Direction)null, p_228806_8_, modelData); ++ randomIn.setSeed(rand); ++ List list1 = modelIn.getQuads(stateIn, (Direction)null, randomIn, modelData); if (!list1.isEmpty()) { - this.func_228798_a_(p_228806_1_, p_228806_3_, p_228806_4_, -1, p_228806_11_, true, p_228806_5_, p_228806_6_, list1, bitset); +- this.func_228798_a_(p_228806_1_, p_228806_3_, p_228806_4_, -1, p_228806_11_, true, p_228806_5_, p_228806_6_, list1, bitset); ++ this.func_228798_a_(worldIn, stateIn, posIn, -1, combinedOverlayIn, true, matrixStackIn, buffer, list1, bitset); flag = true; -@@ -125,6 +139,14 @@ - f1 = 1.0F; - f2 = 1.0F; } -+ // FORGE: Apply diffuse lighting at render-time instead of baking it in -+ if (p_228800_6_.shouldApplyDiffuseLighting()) { -+ // TODO this should be handled by the forge lighting pipeline -+ float l = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(p_228800_6_.func_178210_d()); -+ f *= l; -+ f1 *= l; -+ f2 *= l; -+ } - p_228800_4_.func_227890_a_(p_228800_5_, p_228800_6_, new float[]{p_228800_7_, p_228800_8_, p_228800_9_, p_228800_10_}, f, f1, f2, new int[]{p_228800_11_, p_228800_12_, p_228800_13_, p_228800_14_}, p_228800_15_, true); - } -@@ -208,17 +230,21 @@ +@@ -209,17 +222,21 @@ } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch index 51fd0a60b..02648cf47 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/BlockRendererDispatcher.java +++ b/net/minecraft/client/renderer/BlockRendererDispatcher.java -@@ -32,7 +32,7 @@ +@@ -33,7 +33,7 @@ public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_) { this.field_175028_a = p_i46577_1_; this.field_228790_e_ = p_i46577_2_; @@ -9,36 +9,45 @@ this.field_175025_e = new FluidBlockRenderer(); } -@@ -40,18 +40,26 @@ +@@ -41,22 +41,30 @@ return this.field_175028_a; } + @Deprecated //Forge: Model parameter - public void func_228792_a_(BlockState p_228792_1_, BlockPos p_228792_2_, ILightReader p_228792_3_, MatrixStack p_228792_4_, IVertexBuilder p_228792_5_) { -+ renderModel(p_228792_1_, p_228792_2_, p_228792_3_, p_228792_4_, p_228792_5_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); -+ } -+ public void renderModel(BlockState p_228792_1_, BlockPos p_228792_2_, ILightReader p_228792_3_, MatrixStack p_228792_4_, IVertexBuilder p_228792_5_, net.minecraftforge.client.model.data.IModelData modelData) { - if (p_228792_1_.func_185901_i() == BlockRenderType.MODEL) { - IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_228792_1_); - long i = p_228792_1_.func_209533_a(p_228792_2_); + public void func_228792_a_(BlockState p_228792_1_, BlockPos p_228792_2_, IBlockDisplayReader p_228792_3_, MatrixStack p_228792_4_, IVertexBuilder p_228792_5_) { +- if (p_228792_1_.func_185901_i() == BlockRenderType.MODEL) { +- IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_228792_1_); +- long i = p_228792_1_.func_209533_a(p_228792_2_); - this.field_175027_c.func_228802_a_(p_228792_3_, ibakedmodel, p_228792_1_, p_228792_2_, p_228792_4_, p_228792_5_, true, this.field_195476_e, i, OverlayTexture.field_229196_a_); -+ this.field_175027_c.renderModel(p_228792_3_, ibakedmodel, p_228792_1_, p_228792_2_, p_228792_4_, p_228792_5_, true, this.field_195476_e, i, OverlayTexture.field_229196_a_, modelData); ++ renderBlockDamage(p_228792_1_,p_228792_2_, p_228792_3_, p_228792_4_, p_228792_5_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ } ++ public void renderBlockDamage(BlockState blockStateIn, BlockPos posIn, IBlockDisplayReader lightReaderIn, MatrixStack matrixStackIn, IVertexBuilder vertexBuilderIn, net.minecraftforge.client.model.data.IModelData modelData) { ++ if (blockStateIn.func_185901_i() == BlockRenderType.MODEL) { ++ IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(blockStateIn); ++ long i = blockStateIn.func_209533_a(posIn); ++ this.field_175027_c.renderModel(lightReaderIn, ibakedmodel, blockStateIn, posIn, matrixStackIn, vertexBuilderIn, true, this.field_195476_e, i, OverlayTexture.field_229196_a_, modelData); } } + @Deprecated //Forge: Model parameter - public boolean func_228793_a_(BlockState p_228793_1_, BlockPos p_228793_2_, ILightReader p_228793_3_, MatrixStack p_228793_4_, IVertexBuilder p_228793_5_, boolean p_228793_6_, Random p_228793_7_) { -+ return renderModel(p_228793_1_, p_228793_2_, p_228793_3_, p_228793_4_, p_228793_5_, p_228793_6_, p_228793_7_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public boolean func_228793_a_(BlockState p_228793_1_, BlockPos p_228793_2_, IBlockDisplayReader p_228793_3_, MatrixStack p_228793_4_, IVertexBuilder p_228793_5_, boolean p_228793_6_, Random p_228793_7_) { ++ return renderModel(p_228793_1_, p_228793_2_, p_228793_3_, p_228793_4_, p_228793_5_, p_228793_6_, p_228793_7_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } -+ public boolean renderModel(BlockState p_228793_1_, BlockPos p_228793_2_, ILightReader p_228793_3_, MatrixStack p_228793_4_, IVertexBuilder p_228793_5_, boolean p_228793_6_, Random p_228793_7_, net.minecraftforge.client.model.data.IModelData modelData) { ++ public boolean renderModel(BlockState blockStateIn, BlockPos posIn, IBlockDisplayReader lightReaderIn, MatrixStack matrixStackIn, IVertexBuilder vertexBuilderIn, boolean checkSides, Random rand, net.minecraftforge.client.model.data.IModelData modelData) { try { - BlockRenderType blockrendertype = p_228793_1_.func_185901_i(); +- BlockRenderType blockrendertype = p_228793_1_.func_185901_i(); - return blockrendertype != BlockRenderType.MODEL ? false : this.field_175027_c.func_228802_a_(p_228793_3_, this.func_184389_a(p_228793_1_), p_228793_1_, p_228793_2_, p_228793_4_, p_228793_5_, p_228793_6_, p_228793_7_, p_228793_1_.func_209533_a(p_228793_2_), OverlayTexture.field_229196_a_); -+ return blockrendertype != BlockRenderType.MODEL ? false : this.field_175027_c.renderModel(p_228793_3_, this.func_184389_a(p_228793_1_), p_228793_1_, p_228793_2_, p_228793_4_, p_228793_5_, p_228793_6_, p_228793_7_, p_228793_1_.func_209533_a(p_228793_2_), OverlayTexture.field_229196_a_, modelData); ++ BlockRenderType blockrendertype = blockStateIn.func_185901_i(); ++ return blockrendertype != BlockRenderType.MODEL ? false : this.field_175027_c.renderModel(lightReaderIn, this.func_184389_a(blockStateIn), blockStateIn, posIn, matrixStackIn, vertexBuilderIn, checkSides, rand, blockStateIn.func_209533_a(posIn), OverlayTexture.field_229196_a_, modelData); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.func_85055_a(throwable, "Tesselating block in world"); CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block being tesselated"); -@@ -79,7 +87,11 @@ +- CrashReportCategory.func_175750_a(crashreportcategory, p_228793_2_, p_228793_1_); ++ CrashReportCategory.func_175750_a(crashreportcategory, posIn, blockStateIn); + throw new ReportedException(crashreport); + } + } +@@ -80,7 +88,11 @@ return this.field_175028_a.func_178125_b(p_184389_1_); } @@ -50,21 +59,21 @@ BlockRenderType blockrendertype = p_228791_1_.func_185901_i(); if (blockrendertype != BlockRenderType.INVISIBLE) { switch(blockrendertype) { -@@ -89,10 +101,11 @@ +@@ -90,10 +102,11 @@ float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; -- this.field_175027_c.func_228804_a_(p_228791_2_.func_227866_c_(), p_228791_3_.getBuffer(RenderTypeLookup.func_228394_b_(p_228791_1_)), p_228791_1_, ibakedmodel, f, f1, f2, p_228791_4_, p_228791_5_); -+ this.field_175027_c.renderModel(p_228791_2_.func_227866_c_(), p_228791_3_.getBuffer(RenderTypeLookup.func_228394_b_(p_228791_1_)), p_228791_1_, ibakedmodel, f, f1, f2, p_228791_4_, p_228791_5_, modelData); +- this.field_175027_c.func_228804_a_(p_228791_2_.func_227866_c_(), p_228791_3_.getBuffer(RenderTypeLookup.func_239220_a_(p_228791_1_, false)), p_228791_1_, ibakedmodel, f, f1, f2, p_228791_4_, p_228791_5_); ++ this.field_175027_c.renderModel(p_228791_2_.func_227866_c_(), p_228791_3_.getBuffer(RenderTypeLookup.func_239220_a_(p_228791_1_, false)), p_228791_1_, ibakedmodel, f, f1, f2, p_228791_4_, p_228791_5_, modelData); break; case ENTITYBLOCK_ANIMATED: -- ItemStackTileEntityRenderer.field_147719_a.func_228364_a_(new ItemStack(p_228791_1_.func_177230_c()), p_228791_2_, p_228791_3_, p_228791_4_, p_228791_5_); +- ItemStackTileEntityRenderer.field_147719_a.func_239207_a_(new ItemStack(p_228791_1_.func_177230_c()), ItemCameraTransforms.TransformType.NONE, p_228791_2_, p_228791_3_, p_228791_4_, p_228791_5_); + ItemStack stack = new ItemStack(p_228791_1_.func_177230_c()); -+ stack.func_77973_b().getItemStackTileEntityRenderer().func_228364_a_(stack, p_228791_2_, p_228791_3_, p_228791_4_, p_228791_5_); ++ stack.func_77973_b().getItemStackTileEntityRenderer().func_239207_a_(stack, ItemCameraTransforms.TransformType.NONE, p_228791_2_, p_228791_3_, p_228791_4_, p_228791_5_); } } -@@ -101,4 +114,9 @@ +@@ -102,4 +115,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 69313c71b..2aec2d971 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 -@@ -122,7 +122,6 @@ +@@ -121,7 +121,6 @@ bitset.set(l); } @@ -8,7 +8,7 @@ } private void func_227829_a_(FloatBuffer p_227829_1_, int p_227829_2_) { -@@ -298,6 +297,7 @@ +@@ -297,6 +296,7 @@ } ByteBuffer bytebuffer = this.field_179001_a.slice(); @@ -16,7 +16,7 @@ ((Buffer)this.field_179001_a).clear(); return Pair.of(bufferbuilder$drawstate, bytebuffer); } -@@ -365,4 +365,15 @@ +@@ -364,4 +364,15 @@ this.field_179018_e = p_i225907_2_; } } diff --git a/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch index 929d364a5..4bf34e73b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch @@ -1,6 +1,15 @@ --- a/net/minecraft/client/renderer/FirstPersonRenderer.java +++ b/net/minecraft/client/renderer/FirstPersonRenderer.java -@@ -208,7 +208,7 @@ +@@ -25,6 +25,8 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + ++import java.util.Objects; ++ + @OnlyIn(Dist.CLIENT) + public class FirstPersonRenderer { + private static final RenderType field_230010_a_ = RenderType.func_228658_l_(new ResourceLocation("textures/map/map_background.png")); +@@ -208,7 +210,7 @@ boolean flag1 = true; if (p_228396_4_.func_184587_cr()) { ItemStack itemstack = p_228396_4_.func_184607_cu(); @@ -9,7 +18,7 @@ flag = p_228396_4_.func_184600_cs() == Hand.MAIN_HAND; flag1 = !flag; } -@@ -216,18 +216,18 @@ +@@ -216,18 +218,18 @@ Hand hand1 = p_228396_4_.func_184600_cs(); if (hand1 == Hand.MAIN_HAND) { ItemStack itemstack1 = p_228396_4_.func_184592_cb(); @@ -31,7 +40,7 @@ flag = !itemstack2.func_190926_b(); flag1 = !flag; } -@@ -240,12 +240,14 @@ +@@ -240,12 +242,14 @@ if (flag) { float f5 = hand == Hand.MAIN_HAND ? f : 0.0F; float f2 = 1.0F - MathHelper.func_219799_g(p_228396_1_, this.field_187470_g, this.field_187469_f); @@ -46,7 +55,7 @@ this.func_228405_a_(p_228396_4_, p_228396_1_, f1, Hand.OFF_HAND, f6, this.field_187468_e, f7, p_228396_2_, p_228396_3_, p_228396_5_); } -@@ -260,13 +262,13 @@ +@@ -260,13 +264,13 @@ if (flag && !p_228405_1_.func_82150_aj()) { this.func_228401_a_(p_228405_8_, p_228405_9_, p_228405_10_, p_228405_7_, p_228405_5_, handside); } @@ -62,26 +71,26 @@ boolean flag1 = CrossbowItem.func_220012_d(p_228405_6_); boolean flag2 = handside == HandSide.RIGHT; int i = flag2 ? 1 : -1; -@@ -402,8 +404,16 @@ +@@ -410,8 +414,16 @@ this.field_187471_h = MathHelper.func_76131_a(this.field_187471_h - 0.4F, 0.0F, 1.0F); } else { float f = clientplayerentity.func_184825_o(1.0F); -- this.field_187469_f += MathHelper.func_76131_a((Objects.equals(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); -- this.field_187471_h += MathHelper.func_76131_a((float)(Objects.equals(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); -+ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, clientplayerentity.field_71071_by.field_70461_c); -+ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1); +- this.field_187469_f += MathHelper.func_76131_a((this.field_187467_d == itemstack ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); +- this.field_187471_h += MathHelper.func_76131_a((float)(this.field_187468_e == itemstack1 ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); ++ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, clientplayerentity.field_71071_by.field_70461_c); ++ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1); + -+ if (!requipM && !Objects.equals(this.field_187467_d, itemstack)) -+ this.field_187467_d = itemstack; -+ if (!requipO && !Objects.equals(this.field_187468_e, itemstack1)) -+ this.field_187468_e = itemstack1; ++ if (!requipM && this.field_187467_d != itemstack) ++ this.field_187467_d = itemstack; ++ if (!requipO && this.field_187468_e != itemstack1) ++ this.field_187468_e = itemstack1; + -+ this.field_187469_f += MathHelper.func_76131_a((!requipM ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); -+ this.field_187471_h += MathHelper.func_76131_a((float)(!requipO ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); ++ this.field_187469_f += MathHelper.func_76131_a((!requipM ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); ++ this.field_187471_h += MathHelper.func_76131_a((float)(!requipO ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); } if (this.field_187469_f < 0.1F) { -@@ -422,6 +432,5 @@ +@@ -430,6 +442,5 @@ } else { this.field_187471_h = 0.0F; } diff --git a/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch index d411af522..20c99725d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/client/renderer/FluidBlockRenderer.java +++ b/net/minecraft/client/renderer/FluidBlockRenderer.java -@@ -57,8 +57,9 @@ +@@ -70,9 +70,10 @@ - public boolean func_228796_a_(ILightReader p_228796_1_, BlockPos p_228796_2_, IVertexBuilder p_228796_3_, IFluidState p_228796_4_) { + public boolean func_228796_a_(IBlockDisplayReader p_228796_1_, BlockPos p_228796_2_, IVertexBuilder p_228796_3_, FluidState p_228796_4_) { boolean flag = p_228796_4_.func_206884_a(FluidTags.field_206960_b); - TextureAtlasSprite[] atextureatlassprite = flag ? this.field_178272_a : this.field_178271_b; -- int i = flag ? 16777215 : BiomeColors.func_228363_c_(p_228796_1_, p_228796_2_); + TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_228796_1_, p_228796_2_, p_228796_4_); -+ int i = p_228796_4_.func_206886_c().getAttributes().getColor(p_228796_1_, p_228796_2_); + BlockState blockstate = p_228796_1_.func_180495_p(p_228796_2_); + int i = flag ? 16777215 : BiomeColors.func_228363_c_(p_228796_1_, p_228796_2_); + float alpha = (float)(i >> 24 & 255) / 255.0F; float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; -@@ -143,15 +144,15 @@ - float f25 = 1.0F * f; - float f26 = 1.0F * f1; - float f27 = 1.0F * f2; +@@ -157,15 +158,15 @@ + float f25 = f4 * f; + float f26 = f4 * f1; + float f27 = f4 * f2; - this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j); - this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j); - this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j); @@ -36,10 +36,10 @@ } } -@@ -164,10 +165,10 @@ - float f40 = 0.5F * f; - float f41 = 0.5F * f1; - float f42 = 0.5F * f2; +@@ -178,10 +179,10 @@ + float f40 = f3 * f; + float f41 = f3 * f1; + float f42 = f3 * f2; - this.func_228797_a_(p_228796_3_, d0, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, f34, f39, i1); - this.func_228797_a_(p_228796_3_, d0, d1 + (double)f12, d2, f40, f41, f42, f34, f37, i1); - this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2, f40, f41, f42, f35, f37, i1); @@ -51,13 +51,13 @@ flag7 = true; } -@@ -222,10 +223,9 @@ +@@ -236,10 +237,9 @@ flag7 = true; BlockPos blockpos = p_228796_2_.func_177972_a(direction); TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1]; - if (!flag) { - Block block = p_228796_1_.func_180495_p(blockpos).func_177230_c(); -- if (block == Blocks.field_150359_w || block instanceof StainedGlassBlock) { +- if (block instanceof BreakableBlock || block instanceof LeavesBlock) { - textureatlassprite2 = this.field_187501_d; + if (atextureatlassprite[2] != null) { + if (p_228796_1_.func_180495_p(blockpos).shouldDisplayFluidOverlay(p_228796_1_, blockpos, p_228796_4_)) { @@ -65,10 +65,10 @@ } } -@@ -239,15 +239,15 @@ - float f31 = 1.0F * f30 * f; - float f32 = 1.0F * f30 * f1; - float f33 = 1.0F * f30 * f2; +@@ -253,15 +253,15 @@ + float f31 = f4 * f30 * f; + float f32 = f4 * f30 * f1; + float f33 = f4 * f30 * f2; - this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, f48, f50, k); - this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, f49, f28, k); - this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, f49, f29, k); @@ -90,7 +90,7 @@ } } } -@@ -256,10 +256,15 @@ +@@ -270,10 +270,15 @@ } } @@ -104,6 +104,6 @@ + p_228797_1_.func_225582_a_(p_228797_2_, p_228797_4_, p_228797_6_).func_227885_a_(p_228797_8_, p_228797_9_, p_228797_10_, alpha).func_225583_a_(p_228797_11_, p_228797_12_).func_227886_a_(p_228797_13_).func_225584_a_(0.0F, 1.0F, 0.0F).func_181675_d(); + } + - private int func_228795_a_(ILightReader p_228795_1_, BlockPos p_228795_2_) { + private int func_228795_a_(IBlockDisplayReader p_228795_1_, BlockPos p_228795_2_) { int i = WorldRenderer.func_228421_a_(p_228795_1_, p_228795_2_); int j = WorldRenderer.func_228421_a_(p_228795_1_, p_228795_2_.func_177984_a()); diff --git a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch index 04b37f3a4..6d2907ef9 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 -@@ -150,17 +150,28 @@ +@@ -158,17 +158,28 @@ } float f9 = Math.min(1.0F / field_205093_c, Math.min(1.0F / field_205094_d, 1.0F / field_205095_e)); @@ -29,26 +29,27 @@ RenderSystem.clearColor(field_205093_c, field_205094_d, field_205095_e, 0.0F); } -@@ -169,10 +180,18 @@ +@@ -177,10 +188,18 @@ RenderSystem.fogMode(GlStateManager.FogMode.EXP2); } -+ @Deprecated // FORGE: Pass in partialTicks - public static void func_228372_a_(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_) { -+ setupFog(p_228372_0_, p_228372_1_, p_228372_2_, p_228372_3_, 0); -+ } +- public static void func_228372_a_(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_) { ++ @Deprecated // FORGE: Pass in partialTicks ++ public static void func_228372_a_(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_) { ++ setupFog(p_228372_0_, p_228372_1_, p_228372_2_, p_228372_3_, 0); ++ } + -+ public static void setupFog(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_, float partialTicks) { - IFluidState ifluidstate = p_228372_0_.func_216771_k(); ++ public static void setupFog(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_, float partialTicks) { + FluidState fluidstate = p_228372_0_.func_216771_k(); Entity entity = p_228372_0_.func_216773_g(); - boolean flag = ifluidstate.func_206886_c() != Fluids.field_204541_a; + boolean flag = fluidstate.func_206886_c() != Fluids.field_204541_a; + float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(p_228372_1_, p_228372_0_, partialTicks, 0.1F); + if (hook >= 0) RenderSystem.fogDensity(hook); + else - if (flag) { + if (fluidstate.func_206884_a(FluidTags.field_206959_a)) { float f = 1.0F; - if (ifluidstate.func_206884_a(FluidTags.field_206959_a)) { -@@ -219,8 +238,8 @@ + f = 0.05F; +@@ -231,8 +250,8 @@ RenderSystem.fogEnd(f3); RenderSystem.fogMode(GlStateManager.FogMode.LINEAR); RenderSystem.setupNvFogDistance(); diff --git a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch index bdfb8afd0..4e96f16b2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/GameRenderer.java +++ b/net/minecraft/client/renderer/GameRenderer.java -@@ -131,6 +131,8 @@ +@@ -132,6 +132,8 @@ this.func_175069_a(new ResourceLocation("shaders/post/spider.json")); } else if (p_175066_1_ instanceof EndermanEntity) { this.func_175069_a(new ResourceLocation("shaders/post/invert.json")); @@ -9,7 +9,7 @@ } } -@@ -306,7 +308,7 @@ +@@ -307,7 +309,7 @@ d0 = d0 * 60.0D / 70.0D; } @@ -18,16 +18,15 @@ } } -@@ -475,7 +477,7 @@ - } +@@ -477,6 +479,7 @@ } else if (this.field_78531_r.field_71462_r != null) { try { -- 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()); + this.field_78531_r.field_71462_r.func_230430_a_(matrixstack, i, j, this.field_78531_r.func_193989_ak()); ++ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.field_78531_r.field_71462_r, matrixstack, i, j, this.field_78531_r.func_193989_ak()); } catch (Throwable throwable) { CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Rendering screen"); CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Screen render details"); -@@ -588,9 +590,16 @@ +@@ -589,9 +592,16 @@ Matrix4f matrix4f = matrixstack.func_227866_c_().func_227870_a_(); this.func_228379_a_(matrix4f); activerenderinfo.func_216772_a(this.field_78531_r.field_71441_e, (Entity)(this.field_78531_r.func_175606_aa() == null ? this.field_78531_r.field_71439_g : this.field_78531_r.func_175606_aa()), this.field_78531_r.field_71474_y.field_74320_O > 0, this.field_78531_r.field_71474_y.field_74320_O == 2, p_228378_1_); @@ -44,7 +43,7 @@ this.field_78531_r.func_213239_aq().func_219895_b("hand"); if (this.field_175074_C) { RenderSystem.clear(256, Minecraft.field_142025_a); -@@ -670,4 +679,9 @@ +@@ -671,4 +681,9 @@ public OverlayTexture func_228385_m_() { return this.field_228375_t_; } diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch index dd1f616eb..e60b3afb5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -6,7 +6,7 @@ IBakedModel ibakedmodel = this.func_178089_a(p_199309_1_); - return ibakedmodel == this.field_178090_d.func_174951_a() && 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() && 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).getParticleTexture(net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ return ibakedmodel == this.field_178090_d.func_174951_a() && 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_239290_a_(ibakedmodel, p_199309_1_, null, null).getParticleTexture(net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); } 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 2c016c87b..dc962cb9c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/ItemRenderer.java +++ b/net/minecraft/client/renderer/ItemRenderer.java -@@ -54,7 +54,7 @@ +@@ -59,7 +59,7 @@ public ItemRenderer(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) { this.field_175057_n = p_i46552_1_; @@ -9,25 +9,25 @@ for(Item item : Registry.field_212630_s) { if (!field_195411_c.contains(item)) { -@@ -91,7 +91,7 @@ +@@ -95,7 +95,7 @@ p_229111_8_ = this.field_175059_m.func_178083_a().func_174953_a(new ModelResourceLocation("minecraft:trident#inventory")); } - p_229111_8_.func_177552_f().func_181688_b(p_229111_2_).func_228830_a_(p_229111_3_, p_229111_4_); + p_229111_8_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_229111_4_, p_229111_8_, p_229111_2_, p_229111_3_); p_229111_4_.func_227861_a_(-0.5D, -0.5D, -0.5D); - if (!p_229111_8_.func_188618_c() && (p_229111_1_.func_77973_b() != Items.field_203184_eO || flag1)) { - RenderType rendertype = RenderTypeLookup.func_228389_a_(p_229111_1_); -@@ -105,7 +105,7 @@ - IVertexBuilder ivertexbuilder = func_229113_a_(p_229111_5_, rendertype1, true, p_229111_1_.func_77962_s()); + if (!p_229111_8_.func_188618_c() && (p_229111_1_.func_77973_b() != Items.field_203184_eO || flag)) { + boolean flag1; +@@ -132,7 +132,7 @@ + this.func_229114_a_(p_229111_8_, p_229111_1_, p_229111_6_, p_229111_7_, p_229111_4_, ivertexbuilder); } else { -- ItemStackTileEntityRenderer.field_147719_a.func_228364_a_(p_229111_1_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); -+ p_229111_1_.func_77973_b().getItemStackTileEntityRenderer().func_228364_a_(p_229111_1_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); +- ItemStackTileEntityRenderer.field_147719_a.func_239207_a_(p_229111_1_, p_229111_2_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); ++ p_229111_1_.func_77973_b().getItemStackTileEntityRenderer().func_239207_a_(p_229111_1_, p_229111_2_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); } p_229111_4_.func_227865_b_(); -@@ -129,7 +129,7 @@ +@@ -172,7 +172,7 @@ float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; @@ -36,15 +36,15 @@ } } -@@ -215,6 +215,7 @@ +@@ -263,6 +263,7 @@ crashreportcategory.func_189529_a("Item Type", () -> { - return String.valueOf((Object)p_184391_2_.func_77973_b()); + return String.valueOf((Object)p_239387_2_.func_77973_b()); }); -+ crashreportcategory.func_189529_a("Registry Name", () -> String.valueOf(p_184391_2_.func_77973_b().getRegistryName())); ++ crashreportcategory.func_189529_a("Registry Name", () -> String.valueOf(p_239387_2_.func_77973_b().getRegistryName())); crashreportcategory.func_189529_a("Item Damage", () -> { - return String.valueOf(p_184391_2_.func_77952_i()); + return String.valueOf(p_239387_2_.func_77952_i()); }); -@@ -246,18 +247,16 @@ +@@ -294,18 +295,16 @@ irendertypebuffer$impl.func_228461_a_(); } @@ -67,7 +67,7 @@ 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); RenderSystem.enableBlend(); -@@ -295,4 +294,9 @@ +@@ -343,4 +342,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 65eef187c..4923796a9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch @@ -1,15 +1,16 @@ --- a/net/minecraft/client/renderer/LightTexture.java +++ b/net/minecraft/client/renderer/LightTexture.java -@@ -123,6 +123,8 @@ +@@ -123,6 +123,9 @@ } } -+ clientworld.func_201675_m().getLightmapColors(p_205106_1_, f, f4, f5, vector3f1); ++ //TODO ++ //clientworld.getDimension().getLightmapColors(partialTicks, f, f4, f5, vector3f1); + vector3f1.func_195901_a(0.0F, 1.0F); if (f2 > 0.0F) { float f10 = Math.max(vector3f1.func_195899_a(), Math.max(vector3f1.func_195900_b(), vector3f1.func_195902_c())); -@@ -169,7 +171,7 @@ +@@ -169,7 +172,7 @@ } public static int func_228450_a_(int p_228450_0_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/Matrix3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/Matrix3f.java.patch deleted file mode 100644 index 308cd9c2f..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/Matrix3f.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/minecraft/client/renderer/Matrix3f.java -+++ b/net/minecraft/client/renderer/Matrix3f.java -@@ -406,4 +406,11 @@ - public Matrix3f func_226121_d_() { - return new Matrix3f(this); - } -+ -+ // Forge start -+ public void multiplyBackward(Matrix3f other) { -+ Matrix3f copy = other.func_226121_d_(); -+ copy.func_226118_b_(this); -+ this.func_226114_a_(copy); -+ } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/Matrix4f.java.patch b/patches/minecraft/net/minecraft/client/renderer/Matrix4f.java.patch deleted file mode 100644 index a0d6d0991..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/Matrix4f.java.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- a/net/minecraft/client/renderer/Matrix4f.java -+++ b/net/minecraft/client/renderer/Matrix4f.java -@@ -373,4 +373,78 @@ - matrix4f.field_226586_l_ = p_226599_2_; - return matrix4f; - } -+ -+ // Forge start -+ public Matrix4f(float[] values) { -+ field_226575_a_ = values[0]; -+ field_226576_b_ = values[1]; -+ field_226577_c_ = values[2]; -+ field_226578_d_ = values[3]; -+ field_226579_e_ = values[4]; -+ field_226580_f_ = values[5]; -+ field_226581_g_ = values[6]; -+ field_226582_h_ = values[7]; -+ field_226583_i_ = values[8]; -+ field_226584_j_ = values[9]; -+ field_226585_k_ = values[10]; -+ field_226586_l_ = values[11]; -+ field_226587_m_ = values[12]; -+ field_226588_n_ = values[13]; -+ field_226589_o_ = values[14]; -+ field_226590_p_ = values[15]; -+ } -+ -+ public void set(Matrix4f mat) { -+ this.field_226575_a_ = mat.field_226575_a_; -+ this.field_226576_b_ = mat.field_226576_b_; -+ this.field_226577_c_ = mat.field_226577_c_; -+ this.field_226578_d_ = mat.field_226578_d_; -+ this.field_226579_e_ = mat.field_226579_e_; -+ this.field_226580_f_ = mat.field_226580_f_; -+ this.field_226581_g_ = mat.field_226581_g_; -+ this.field_226582_h_ = mat.field_226582_h_; -+ this.field_226583_i_ = mat.field_226583_i_; -+ this.field_226584_j_ = mat.field_226584_j_; -+ this.field_226585_k_ = mat.field_226585_k_; -+ this.field_226586_l_ = mat.field_226586_l_; -+ this.field_226587_m_ = mat.field_226587_m_; -+ this.field_226588_n_ = mat.field_226588_n_; -+ this.field_226589_o_ = mat.field_226589_o_; -+ this.field_226590_p_ = mat.field_226590_p_; -+ } -+ -+ public void add(Matrix4f other) { -+ field_226575_a_ += other.field_226575_a_; -+ field_226576_b_ += other.field_226576_b_; -+ field_226577_c_ += other.field_226577_c_; -+ field_226578_d_ += other.field_226578_d_; -+ field_226579_e_ += other.field_226579_e_; -+ field_226580_f_ += other.field_226580_f_; -+ field_226581_g_ += other.field_226581_g_; -+ field_226582_h_ += other.field_226582_h_; -+ field_226583_i_ += other.field_226583_i_; -+ field_226584_j_ += other.field_226584_j_; -+ field_226585_k_ += other.field_226585_k_; -+ field_226586_l_ += other.field_226586_l_; -+ field_226587_m_ += other.field_226587_m_; -+ field_226588_n_ += other.field_226588_n_; -+ field_226589_o_ += other.field_226589_o_; -+ field_226590_p_ += other.field_226590_p_; -+ } -+ -+ public void multiplyBackward(Matrix4f other) { -+ Matrix4f copy = other.func_226601_d_(); -+ copy.func_226595_a_(this); -+ this.set(copy); -+ } -+ -+ public void setTranslation(float x, float y, float z) { -+ this.field_226575_a_ = 1.0F; -+ this.field_226580_f_ = 1.0F; -+ this.field_226585_k_ = 1.0F; -+ this.field_226590_p_ = 1.0F; -+ this.field_226578_d_ = x; -+ this.field_226582_h_ = y; -+ this.field_226586_l_ = z; -+ } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch index a116d6049..46a56e08b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/OverlayRenderer.java +++ b/net/minecraft/client/renderer/OverlayRenderer.java -@@ -25,18 +25,21 @@ +@@ -27,18 +27,21 @@ RenderSystem.disableAlphaTest(); PlayerEntity playerentity = p_228734_0_.field_71439_g; if (!playerentity.field_70145_X) { @@ -25,7 +25,7 @@ func_228737_c_(p_228734_0_, p_228734_1_); } } -@@ -46,6 +49,11 @@ +@@ -48,6 +51,11 @@ @Nullable private static BlockState func_230018_a_(PlayerEntity p_230018_0_) { @@ -37,7 +37,7 @@ BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(); for(int i = 0; i < 8; ++i) { -@@ -55,7 +63,7 @@ +@@ -57,7 +65,7 @@ blockpos$mutable.func_189532_c(d0, d1, d2); BlockState blockstate = p_230018_0_.field_70170_p.func_180495_p(blockpos$mutable); if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE && blockstate.func_215696_m(p_230018_0_.field_70170_p, blockpos$mutable)) { diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderState.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderState.java.patch index 731cfa3d6..2291a22fe 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderState.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderState.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/renderer/RenderState.java +++ b/net/minecraft/client/renderer/RenderState.java -@@ -360,7 +360,7 @@ - private final OptionalDouble field_228587_Q_; +@@ -255,7 +255,7 @@ + private final float field_228574_Q_; - public LineState(OptionalDouble p_i225982_1_) { + public AlphaState(float p_i225974_1_) { - super("alpha", () -> { + super("line_width", () -> { // FORGE: fix MC-167447 - if (!Objects.equals(p_i225982_1_, OptionalDouble.of(1.0D))) { - if (p_i225982_1_.isPresent()) { - RenderSystem.lineWidth((float)p_i225982_1_.getAsDouble()); + if (p_i225974_1_ > 0.0F) { + RenderSystem.enableAlphaTest(); + RenderSystem.alphaFunc(516, p_i225974_1_); diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch index fe8b0e71b..96844c9fd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/client/renderer/RenderTypeLookup.java +++ b/net/minecraft/client/renderer/RenderTypeLookup.java -@@ -18,6 +18,7 @@ +@@ -19,6 +19,7 @@ @OnlyIn(Dist.CLIENT) public class RenderTypeLookup { + @Deprecated private static final Map field_228386_a_ = Util.func_200696_a(Maps.newHashMap(), (p_228395_0_) -> { - RenderType rendertype = RenderType.func_228641_d_(); - p_228395_0_.put(Blocks.field_196658_i, rendertype); -@@ -238,6 +239,7 @@ - p_228395_0_.put(Blocks.field_185778_de, rendertype2); - p_228395_0_.put(Blocks.field_203203_C, rendertype2); + RenderType rendertype = RenderType.func_241715_r_(); + p_228395_0_.put(Blocks.field_150473_bD, rendertype); +@@ -263,6 +264,7 @@ + p_228395_0_.put(Blocks.field_185778_de, rendertype3); + p_228395_0_.put(Blocks.field_203203_C, rendertype3); }); + @Deprecated private static final Map field_228387_b_ = Util.func_200696_a(Maps.newHashMap(), (p_228392_0_) -> { RenderType rendertype = RenderType.func_228645_f_(); p_228392_0_.put(Fluids.field_207212_b, rendertype); -@@ -245,6 +247,7 @@ +@@ -270,6 +272,7 @@ }); private static boolean field_228388_c_; @@ -24,74 +24,67 @@ public static RenderType func_228390_a_(BlockState p_228390_0_) { Block block = p_228390_0_.func_177230_c(); if (block instanceof LeavesBlock) { -@@ -256,8 +259,7 @@ - } - - public static RenderType func_228394_b_(BlockState p_228394_0_) { -- RenderType rendertype = func_228390_a_(p_228394_0_); -- return rendertype == RenderType.func_228645_f_() ? Atlases.func_228784_i_() : Atlases.func_228783_h_(); -+ return canRenderInLayer(p_228394_0_, RenderType.func_228645_f_()) ? Atlases.func_228784_i_() : Atlases.func_228783_h_(); - } - - public static RenderType func_228389_a_(ItemStack p_228389_0_) { -@@ -270,11 +272,60 @@ +@@ -317,12 +320,62 @@ } } + @Deprecated - public static RenderType func_228391_a_(IFluidState p_228391_0_) { + public static RenderType func_228391_a_(FluidState p_228391_0_) { RenderType rendertype = field_228387_b_.get(p_228391_0_.func_206886_c()); return rendertype != null ? rendertype : RenderType.func_228639_c_(); } -+ // FORGE START +- public static void func_228393_a_(boolean p_228393_0_) { + -+ private static final Map, java.util.function.Predicate> blockRenderChecks = Maps.newHashMap(); -+ private static final Map, java.util.function.Predicate> fluidRenderChecks = Maps.newHashMap(); -+ static { -+ field_228386_a_.forEach(RenderTypeLookup::setRenderLayer); -+ field_228387_b_.forEach(RenderTypeLookup::setRenderLayer); -+ } ++ // FORGE START + -+ public static boolean canRenderInLayer(BlockState state, RenderType type) { -+ Block block = state.func_177230_c(); -+ if (block instanceof LeavesBlock) { -+ return field_228388_c_ ? type == RenderType.func_228641_d_() : type == RenderType.func_228639_c_(); -+ } else { -+ java.util.function.Predicate rendertype; -+ synchronized (RenderTypeLookup.class) { -+ rendertype = blockRenderChecks.get(block.delegate); -+ } -+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); -+ } -+ } ++ private static final Map, java.util.function.Predicate> blockRenderChecks = Maps.newHashMap(); ++ private static final Map, java.util.function.Predicate> fluidRenderChecks = Maps.newHashMap(); ++ static { ++ field_228386_a_.forEach(RenderTypeLookup::setRenderLayer); ++ field_228387_b_.forEach(RenderTypeLookup::setRenderLayer); ++ } + -+ public static boolean canRenderInLayer(IFluidState fluid, RenderType type) { -+ java.util.function.Predicate rendertype; -+ synchronized (RenderTypeLookup.class) { -+ rendertype = fluidRenderChecks.get(fluid.func_206886_c().delegate); -+ } -+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); -+ } ++ public static boolean canRenderInLayer(BlockState state, RenderType type) { ++ Block block = state.func_177230_c(); ++ if (block instanceof LeavesBlock) { ++ return field_228388_c_ ? type == RenderType.func_228641_d_() : type == RenderType.func_228639_c_(); ++ } else { ++ java.util.function.Predicate rendertype; ++ synchronized (RenderTypeLookup.class) { ++ rendertype = blockRenderChecks.get(block.delegate); ++ } ++ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); ++ } ++ } + -+ public static void setRenderLayer(Block block, RenderType type) { -+ java.util.Objects.requireNonNull(type); -+ setRenderLayer(block, type::equals); -+ } ++ public static boolean canRenderInLayer(FluidState fluid, RenderType type) { ++ java.util.function.Predicate rendertype; ++ synchronized (RenderTypeLookup.class) { ++ rendertype = fluidRenderChecks.get(fluid.func_206886_c().delegate); ++ } ++ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); ++ } + -+ public static synchronized void setRenderLayer(Block block, java.util.function.Predicate predicate) { -+ blockRenderChecks.put(block.delegate, predicate); -+ } ++ public static void setRenderLayer(Block block, RenderType type) { ++ java.util.Objects.requireNonNull(type); ++ setRenderLayer(block, type::equals); ++ } + -+ public static void setRenderLayer(Fluid fluid, RenderType type) { -+ java.util.Objects.requireNonNull(type); -+ setRenderLayer(fluid, type::equals); -+ } ++ public static synchronized void setRenderLayer(Block block, java.util.function.Predicate predicate) { ++ blockRenderChecks.put(block.delegate, predicate); ++ } + -+ public static synchronized void setRenderLayer(Fluid fluid, java.util.function.Predicate predicate) { -+ fluidRenderChecks.put(fluid.delegate, predicate); -+ } ++ public static void setRenderLayer(Fluid fluid, RenderType type) { ++ java.util.Objects.requireNonNull(type); ++ setRenderLayer(fluid, type::equals); ++ } + - public static void func_228393_a_(boolean p_228393_0_) { ++ public static synchronized void setRenderLayer(Fluid fluid, java.util.function.Predicate predicate) { ++ fluidRenderChecks.put(fluid.delegate, predicate); ++ } ++ ++ public static void func_228393_a_(boolean p_228393_0_) { field_228388_c_ = p_228393_0_; } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/TransformationMatrix.java.patch b/patches/minecraft/net/minecraft/client/renderer/TransformationMatrix.java.patch deleted file mode 100644 index 4bcfe84eb..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/TransformationMatrix.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/net/minecraft/client/renderer/TransformationMatrix.java -+++ b/net/minecraft/client/renderer/TransformationMatrix.java -@@ -9,7 +9,7 @@ - import org.apache.commons.lang3.tuple.Triple; - - @OnlyIn(Dist.CLIENT) --public final class TransformationMatrix { -+public final class TransformationMatrix implements net.minecraftforge.client.extensions.IForgeTransformationMatrix { - private final Matrix4f field_227976_a_; - private boolean field_227977_b_; - @Nullable -@@ -133,4 +133,32 @@ - public int hashCode() { - return Objects.hash(this.field_227976_a_); - } -+ -+ // FORGE START -+ public Vector3f getTranslation() { -+ func_227990_e_(); -+ return field_227978_c_.func_229195_e_(); -+ } -+ public Vector3f getScale() { -+ func_227990_e_(); -+ return field_227980_e_.func_229195_e_(); -+ } -+ -+ public Quaternion getRightRot() { -+ func_227990_e_(); -+ return field_227981_f_.func_227068_g_(); -+ } -+ -+ private Matrix3f normalTransform = null; -+ public Matrix3f getNormalMatrix() { -+ checkNormalTransform(); -+ return normalTransform; -+ } -+ private void checkNormalTransform() { -+ if (normalTransform == null) { -+ normalTransform = new Matrix3f(field_227976_a_); -+ normalTransform.func_226123_f_(); -+ normalTransform.func_226110_a_(); -+ } -+ } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/Vector3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/Vector3f.java.patch deleted file mode 100644 index da4314838..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/Vector3f.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/client/renderer/Vector3f.java -+++ b/net/minecraft/client/renderer/Vector3f.java -@@ -198,4 +198,17 @@ - public String toString() { - return "[" + this.field_229184_g_ + ", " + this.field_229185_h_ + ", " + this.field_229186_i_ + "]"; - } -+ -+ // Forge start -+ public Vector3f(float[] values) { -+ set(values); -+ } -+ public void set(float[] values) { -+ this.field_229184_g_ = values[0]; -+ this.field_229185_h_ = values[1]; -+ this.field_229186_i_ = values[2]; -+ } -+ public void setX(float x) { this.field_229184_g_ = x; } -+ public void setY(float y) { this.field_229185_h_ = y; } -+ public void setZ(float z) { this.field_229186_i_ = z; } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/Vector4f.java.patch b/patches/minecraft/net/minecraft/client/renderer/Vector4f.java.patch deleted file mode 100644 index 2cce28530..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/Vector4f.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/client/renderer/Vector4f.java -+++ b/net/minecraft/client/renderer/Vector4f.java -@@ -129,4 +129,16 @@ - public String toString() { - return "[" + this.field_229368_a_ + ", " + this.field_229369_b_ + ", " + this.field_229370_c_ + ", " + this.field_229371_d_ + "]"; - } -+ -+ // Forge start -+ public void set(float[] values) { -+ this.field_229368_a_ = values[0]; -+ this.field_229369_b_ = values[1]; -+ this.field_229370_c_ = values[2]; -+ this.field_229371_d_ = values[3]; -+ } -+ public void setX(float x) { this.field_229368_a_ = x; } -+ public void setY(float y) { this.field_229369_b_ = y; } -+ public void setZ(float z) { this.field_229370_c_ = z; } -+ public void setW(float z) { this.field_229371_d_ = z; } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch b/patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch index 7570c781e..213ad4686 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch @@ -1,11 +1,10 @@ --- a/net/minecraft/client/renderer/ViewFrustum.java +++ b/net/minecraft/client/renderer/ViewFrustum.java -@@ -7,7 +7,9 @@ - import net.minecraft.world.World; +@@ -8,6 +8,8 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -+import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher.ChunkRender; ++import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher.ChunkRender; + @OnlyIn(Dist.CLIENT) public class ViewFrustum { diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index 34c92f74a..d2c41d487 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/renderer/WorldRenderer.java +++ b/net/minecraft/client/renderer/WorldRenderer.java -@@ -203,6 +203,11 @@ +@@ -221,6 +221,11 @@ } private void func_228438_a_(LightTexture p_228438_1_, float p_228438_2_, double p_228438_3_, double p_228438_5_, double p_228438_7_) { -+ net.minecraftforge.client.IRenderHandler renderer = this.field_72777_q.field_71441_e.func_201675_m().getWeatherRenderer(); ++ net.minecraftforge.client.IRenderHandler renderer = null;//this.mc.world.getDimension().getWeatherRenderer(); //TODO FIX THIS + if (renderer != null) { + renderer.render(this.field_72773_u, p_228438_2_, this.field_72777_q.field_71441_e, this.field_72777_q); + return; @@ -12,18 +12,18 @@ float f = this.field_72777_q.field_71441_e.func_72867_j(p_228438_2_); if (!(f <= 0.0F)) { p_228438_1_.func_205109_c(); -@@ -772,7 +777,7 @@ +@@ -812,7 +817,7 @@ this.field_147595_R = true; BlockPos blockpos2 = chunkrenderdispatcher$chunkrender4.func_178568_j().func_177982_a(8, 8, 8); - boolean flag2 = blockpos2.func_177951_i(blockpos) < 768.0D; -- if (!chunkrenderdispatcher$chunkrender4.func_188281_o() && !flag2) { -+ if (net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() || !chunkrenderdispatcher$chunkrender4.func_188281_o() && !flag2) { + boolean flag1 = blockpos2.func_177951_i(blockpos) < 768.0D; +- if (!chunkrenderdispatcher$chunkrender4.func_188281_o() && !flag1) { ++ if (net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() || !chunkrenderdispatcher$chunkrender4.func_188281_o() && !flag1) { this.field_175009_l.add(chunkrenderdispatcher$chunkrender4); } else { this.field_72777_q.func_213239_aq().func_76320_a("build near"); -@@ -871,13 +876,13 @@ +@@ -897,13 +902,13 @@ float f = p_228426_7_.func_205001_m(); - boolean flag1 = this.field_72777_q.field_71441_e.field_73011_w.func_76568_b(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d1)) || this.field_72777_q.field_71456_v.func_184046_j().func_184056_f(); + boolean flag1 = this.field_72777_q.field_71441_e.func_239132_a_().func_230493_a_(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d1)) || this.field_72777_q.field_71456_v.func_184046_j().func_184056_f(); if (this.field_72777_q.field_71474_y.field_151451_c >= 4) { - FogRenderer.func_228372_a_(p_228426_6_, FogRenderer.FogType.FOG_SKY, f, flag1); + FogRenderer.setupFog(p_228426_6_, FogRenderer.FogType.FOG_SKY, f, flag1, p_228426_2_); @@ -35,9 +35,9 @@ - FogRenderer.func_228372_a_(p_228426_6_, FogRenderer.FogType.FOG_TERRAIN, Math.max(f - 16.0F, 32.0F), flag1); + FogRenderer.setupFog(p_228426_6_, FogRenderer.FogType.FOG_TERRAIN, Math.max(f - 16.0F, 32.0F), flag1, p_228426_2_); iprofiler.func_219895_b("terrain_setup"); - this.func_228437_a_(p_228426_6_, clippinghelperimpl, flag, this.field_228409_ai_++, this.field_72777_q.field_71439_g.func_175149_v()); + this.func_228437_a_(p_228426_6_, clippinghelper, flag, this.field_228409_ai_++, this.field_72777_q.field_71439_g.func_175149_v()); iprofiler.func_219895_b("updatechunks"); -@@ -898,7 +903,9 @@ +@@ -924,7 +929,9 @@ this.func_174967_a(p_228426_3_ + l1); iprofiler.func_219895_b("terrain"); this.func_228441_a_(RenderType.func_228639_c_(), p_228426_1_, d0, d1, d2); @@ -45,25 +45,25 @@ this.func_228441_a_(RenderType.func_228641_d_(), p_228426_1_, d0, d1, d2); + this.field_72777_q.func_209506_al().func_229356_a_(AtlasTexture.field_110575_b).restoreLastBlurMipmap(); this.func_228441_a_(RenderType.func_228643_e_(), p_228426_1_, d0, d1, d2); - RenderHelper.func_227781_a_(p_228426_1_.func_227866_c_().func_227870_a_()); - iprofiler.func_219895_b("entities"); -@@ -953,6 +960,7 @@ + if (this.field_72769_h.func_239132_a_().func_239217_c_()) { + RenderHelper.func_237533_a_(p_228426_1_.func_227866_c_().func_227870_a_()); +@@ -994,6 +1001,7 @@ List list = worldrenderer$localrenderinformationcontainer.field_178036_a.func_178571_g().func_178485_b(); if (!list.isEmpty()) { for(TileEntity tileentity1 : list) { -+ if(!clippinghelperimpl.func_228957_a_(tileentity1.getRenderBoundingBox())) continue; ++ if(!clippinghelper.func_228957_a_(tileentity1.getRenderBoundingBox())) continue; BlockPos blockpos3 = tileentity1.func_174877_v(); IRenderTypeBuffer irendertypebuffer1 = irendertypebuffer$impl; p_228426_1_.func_227860_a_(); -@@ -977,6 +985,7 @@ +@@ -1019,6 +1027,7 @@ synchronized(this.field_181024_n) { for(TileEntity tileentity : this.field_181024_n) { -+ if(!clippinghelperimpl.func_228957_a_(tileentity.getRenderBoundingBox())) continue; ++ if(!clippinghelper.func_228957_a_(tileentity.getRenderBoundingBox())) continue; BlockPos blockpos2 = tileentity.func_174877_v(); p_228426_1_.func_227860_a_(); p_228426_1_.func_227861_a_((double)blockpos2.func_177958_n() - d0, (double)blockpos2.func_177956_o() - d1, (double)blockpos2.func_177952_p() - d2); -@@ -1026,7 +1035,8 @@ +@@ -1069,7 +1078,8 @@ iprofiler.func_219895_b("outline"); BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).func_216350_a(); BlockState blockstate = this.field_72769_h.func_180495_p(blockpos); @@ -73,39 +73,39 @@ IVertexBuilder ivertexbuilder2 = irendertypebuffer$impl.getBuffer(RenderType.func_228659_m_()); this.func_228429_a_(p_228426_1_, ivertexbuilder2, p_228426_6_.func_216773_g(), d0, d1, d2, blockpos, blockstate); } -@@ -1380,6 +1390,15 @@ +@@ -1461,6 +1471,15 @@ } public void func_228424_a_(MatrixStack p_228424_1_, float p_228424_2_) { -+ net.minecraftforge.client.IRenderHandler renderer = this.field_72769_h.func_201675_m().getSkyRenderer(); -+ if (renderer != null) { -+ if (renderer instanceof net.minecraftforge.client.SkyRenderHandler) { -+ ((net.minecraftforge.client.SkyRenderHandler) renderer).render(this.field_72773_u, p_228424_2_, p_228424_1_, this.field_72769_h, this.field_72777_q); -+ } else { -+ renderer.render(this.field_72773_u, p_228424_2_, this.field_72769_h, this.field_72777_q); -+ } -+ return; -+ } - if (this.field_72777_q.field_71441_e.field_73011_w.func_186058_p() == DimensionType.field_223229_c_) { ++ net.minecraftforge.client.IRenderHandler renderer = null;//this.world.getDimension().getSkyRenderer(); //TODO FIX THIS ++ if (renderer != null) { ++ if (renderer instanceof net.minecraftforge.client.SkyRenderHandler) { ++ ((net.minecraftforge.client.SkyRenderHandler) renderer).render(this.field_72773_u, p_228424_2_, p_228424_1_, this.field_72769_h, this.field_72777_q); ++ } else { ++ renderer.render(this.field_72773_u, p_228424_2_, this.field_72769_h, this.field_72777_q); ++ } ++ return; ++ } + if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.END) { this.func_228444_b_(p_228424_1_); - } else if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { -@@ -1508,6 +1527,15 @@ + } else if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.NORMAL) { +@@ -1589,6 +1608,15 @@ } public void func_228425_a_(MatrixStack p_228425_1_, float p_228425_2_, double p_228425_3_, double p_228425_5_, double p_228425_7_) { -+ net.minecraftforge.client.IRenderHandler renderer = this.field_72769_h.func_201675_m().getCloudRenderer(); -+ if (renderer != null) { -+ if (renderer instanceof net.minecraftforge.client.CloudRenderHandler) { -+ ((net.minecraftforge.client.CloudRenderHandler) renderer).render(this.field_72773_u, p_228425_2_, p_228425_1_, this.field_72769_h, this.field_72777_q); -+ } else { -+ renderer.render(this.field_72773_u, p_228425_2_, this.field_72769_h, this.field_72777_q); -+ } -+ return; -+ } - if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { ++ net.minecraftforge.client.IRenderHandler renderer = null;//this.world.getDimension().getCloudRenderer(); //TODO FIX THIS ++ if (renderer != null) { ++ if (renderer instanceof net.minecraftforge.client.CloudRenderHandler) { ++ ((net.minecraftforge.client.CloudRenderHandler) renderer).render(this.field_72773_u, p_228425_2_, p_228425_1_, this.field_72769_h, this.field_72777_q); ++ } else { ++ renderer.render(this.field_72773_u, p_228425_2_, this.field_72769_h, this.field_72777_q); ++ } ++ return; ++ } + float f = this.field_72769_h.func_239132_a_().func_239213_a_(); + if (!Float.isNaN(f)) { RenderSystem.disableCull(); - RenderSystem.enableBlend(); -@@ -1977,7 +2005,12 @@ +@@ -2056,7 +2084,12 @@ this.field_175008_n.func_217628_a(p_215319_1_, p_215319_2_, p_215319_3_, p_215319_4_); } @@ -118,16 +118,16 @@ ISound isound = this.field_147593_P.get(p_184377_2_); if (isound != null) { this.field_72777_q.func_147118_V().func_147683_b(isound); -@@ -1985,7 +2018,7 @@ +@@ -2064,7 +2097,7 @@ } if (p_184377_1_ != null) { - MusicDiscItem musicdiscitem = MusicDiscItem.func_185074_a(p_184377_1_); + MusicDiscItem musicdiscitem = musicDiscItem; if (musicdiscitem != null) { - this.field_72777_q.field_71456_v.func_73833_a(musicdiscitem.func_200299_h().func_150254_d()); + this.field_72777_q.field_71456_v.func_238451_a_(musicdiscitem.func_234801_g_()); } -@@ -2133,7 +2166,7 @@ +@@ -2212,7 +2245,7 @@ break; case 1010: if (Item.func_150899_d(p_180439_4_) instanceof MusicDiscItem) { @@ -136,7 +136,7 @@ } else { this.func_184377_a((SoundEvent)null, p_180439_3_); } -@@ -2283,8 +2316,8 @@ +@@ -2362,8 +2395,8 @@ break; case 2001: BlockState blockstate = Block.func_196257_b(p_180439_4_); @@ -147,7 +147,7 @@ this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false); } -@@ -2432,7 +2465,7 @@ +@@ -2511,7 +2544,7 @@ } else { int i = p_228420_0_.func_226658_a_(LightType.SKY, p_228420_2_); int j = p_228420_0_.func_226658_a_(LightType.BLOCK, p_228420_2_); @@ -156,8 +156,8 @@ if (j < k) { j = k; } -@@ -2445,6 +2478,11 @@ - return this.field_175015_z; +@@ -2550,6 +2583,11 @@ + return this.field_239226_J_; } + @Override 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 fdcf1cf3b..e6b55430d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java +++ b/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java @@ -68,12 +68,15 @@ - private Vec3d field_217672_l = Vec3d.field_186680_a; + private Vector3d field_217672_l = Vector3d.field_186680_a; public ChunkRenderDispatcher(World p_i226020_1_, WorldRenderer p_i226020_2_, Executor p_i226020_3_, boolean p_i226020_4_, RegionRenderCacheBuilder p_i226020_5_) { + this(p_i226020_1_, p_i226020_2_, p_i226020_3_, p_i226020_4_, p_i226020_5_, -1); @@ -96,7 +96,7 @@ visgraph.func_178606_a(blockpos2); } -- if (block.func_149716_u()) { +- if (block.func_235695_q_()) { + if (blockstate.hasTileEntity()) { TileEntity tileentity = chunkrendercache.func_212399_a(blockpos2, Chunk.CreateEntityType.CHECK); if (tileentity != null) { @@ -104,13 +104,13 @@ @@ -478,8 +500,10 @@ } - IFluidState ifluidstate = chunkrendercache.func_204610_c(blockpos2); -- if (!ifluidstate.func_206888_e()) { -- RenderType rendertype = RenderTypeLookup.func_228391_a_(ifluidstate); -+ net.minecraftforge.client.model.data.IModelData modelData = getModelData(blockpos2); + FluidState fluidstate = chunkrendercache.func_204610_c(blockpos2); +- if (!fluidstate.func_206888_e()) { +- RenderType rendertype = RenderTypeLookup.func_228391_a_(fluidstate); ++ net.minecraftforge.client.model.data.IModelData modelData = getModelData(blockpos2); + for (RenderType rendertype : RenderType.func_228661_n_()) { + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(rendertype); -+ if (!ifluidstate.func_206888_e() && RenderTypeLookup.canRenderInLayer(ifluidstate, rendertype)) { ++ if (!fluidstate.func_206888_e() && RenderTypeLookup.canRenderInLayer(fluidstate, rendertype)) { BufferBuilder bufferbuilder = p_228940_5_.func_228366_a_(rendertype); if (p_228940_4_.field_178501_c.add(rendertype)) { ChunkRender.this.func_228923_a_(bufferbuilder); 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 ebd60c721..e3177b376 100644 --- a/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch @@ -7,7 +7,7 @@ - private final ObjectIntIdentityMap field_186725_a = new ObjectIntIdentityMap<>(32); + // FORGE: Use RegistryDelegates as non-Vanilla block ids are not constant + private final java.util.Map, IBlockColor> field_186725_a = new java.util.HashMap<>(); - private final Map>> field_225311_b = Maps.newHashMap(); + private final Map>> field_225311_b = Maps.newHashMap(); public static BlockColors func_186723_a() { @@ -72,11 +73,12 @@ @@ -22,12 +22,12 @@ - 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_, (ILightReader)null, (BlockPos)null, 0); + return iblockcolor.getColor(p_189991_1_, (IBlockDisplayReader)null, (BlockPos)null, 0); } else { @@ -86,13 +88,13 @@ } - public int func_228054_a_(BlockState p_228054_1_, @Nullable ILightReader p_228054_2_, @Nullable BlockPos p_228054_3_, int p_228054_4_) { + public int func_228054_a_(BlockState p_228054_1_, @Nullable IBlockDisplayReader p_228054_2_, @Nullable BlockPos p_228054_3_, int p_228054_4_) { - IBlockColor iblockcolor = this.field_186725_a.func_148745_a(Registry.field_212618_g.func_148757_b(p_228054_1_.func_177230_c())); + IBlockColor iblockcolor = this.field_186725_a.get(p_228054_1_.func_177230_c().delegate); return iblockcolor == null ? -1 : iblockcolor.getColor(p_228054_1_, p_228054_2_, p_228054_3_, p_228054_4_); 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 4eff1c423..1fa154239 100644 --- a/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch @@ -10,7 +10,7 @@ public static ItemColors func_186729_a(BlockColors p_186729_0_) { ItemColors itemcolors = new ItemColors(); -@@ -80,17 +81,18 @@ +@@ -82,17 +83,18 @@ itemcolors.func_199877_a((p_210237_0_, p_210237_1_) -> { return p_210237_1_ == 0 ? -1 : FilledMapItem.func_190907_h(p_210237_0_); }, Items.field_151098_aY); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch index a8576ef5d..fdf723bf3 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/client/renderer/entity/EntityRenderer.java +++ b/net/minecraft/client/renderer/entity/EntityRenderer.java -@@ -54,8 +54,10 @@ +@@ -60,8 +60,10 @@ } public void func_225623_a_(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { - if (this.func_177070_b(p_225623_1_)) { -- this.func_225629_a_(p_225623_1_, p_225623_1_.func_145748_c_().func_150254_d(), p_225623_4_, p_225623_5_, p_225623_6_); -+ net.minecraftforge.client.event.RenderNameplateEvent renderNameplateEvent = new net.minecraftforge.client.event.RenderNameplateEvent(p_225623_1_, p_225623_1_.func_145748_c_().func_150254_d(), this, p_225623_4_, p_225623_5_, p_225623_6_); +- this.func_225629_a_(p_225623_1_, p_225623_1_.func_145748_c_(), p_225623_4_, p_225623_5_, p_225623_6_); ++ net.minecraftforge.client.event.RenderNameplateEvent renderNameplateEvent = new net.minecraftforge.client.event.RenderNameplateEvent(p_225623_1_, p_225623_1_.func_145748_c_(), this, p_225623_4_, p_225623_5_, p_225623_6_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(renderNameplateEvent); + if (renderNameplateEvent.getResult() != net.minecraftforge.eventbus.api.Event.Result.DENY && (renderNameplateEvent.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || this.func_177070_b(p_225623_1_))) { + this.func_225629_a_(p_225623_1_, renderNameplateEvent.getContent(), p_225623_4_, p_225623_5_, p_225623_6_); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch index 268b1a4d0..81f0fdcfa 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/EntityRendererManager.java +++ b/net/minecraft/client/renderer/entity/EntityRendererManager.java -@@ -183,13 +183,15 @@ +@@ -187,13 +187,15 @@ 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)); @@ -17,7 +17,7 @@ } public EntityRenderer func_78713_a(T p_78713_1_) { -@@ -445,4 +447,8 @@ +@@ -449,4 +451,8 @@ public FontRenderer func_78716_a() { return this.field_78736_p; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch index d914f1ffa..c695ddcf9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch @@ -4,12 +4,12 @@ BlockPos blockpos = new BlockPos(p_225623_1_.func_226277_ct_(), p_225623_1_.func_174813_aQ().field_72337_e, p_225623_1_.func_226281_cx_()); p_225623_4_.func_227861_a_(-0.5D, 0.0D, -0.5D); BlockRendererDispatcher blockrendererdispatcher = Minecraft.func_71410_x().func_175602_ab(); -- blockrendererdispatcher.func_175019_b().func_228802_a_(world, blockrendererdispatcher.func_184389_a(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(RenderTypeLookup.func_228390_a_(blockstate)), false, new Random(), blockstate.func_209533_a(p_225623_1_.func_184531_j()), OverlayTexture.field_229196_a_); +- blockrendererdispatcher.func_175019_b().func_228802_a_(world, blockrendererdispatcher.func_184389_a(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(RenderTypeLookup.func_239221_b_(blockstate)), false, new Random(), blockstate.func_209533_a(p_225623_1_.func_184531_j()), OverlayTexture.field_229196_a_); + for (net.minecraft.client.renderer.RenderType type : net.minecraft.client.renderer.RenderType.func_228661_n_()) { -+ if (RenderTypeLookup.canRenderInLayer(blockstate, type)) { -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(type); -+ blockrendererdispatcher.func_175019_b().func_228802_a_(world, blockrendererdispatcher.func_184389_a(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(type), false, new Random(), blockstate.func_209533_a(p_225623_1_.func_184531_j()), OverlayTexture.field_229196_a_); -+ } ++ if (RenderTypeLookup.canRenderInLayer(blockstate, type)) { ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(type); ++ blockrendererdispatcher.func_175019_b().func_228802_a_(world, blockrendererdispatcher.func_184389_a(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(RenderTypeLookup.func_239221_b_(blockstate)), false, new Random(), blockstate.func_209533_a(p_225623_1_.func_184531_j()), OverlayTexture.field_229196_a_); ++ } + } + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null); p_225623_4_.func_227865_b_(); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch index 8e790e54c..edf1c90d1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch @@ -1,24 +1,30 @@ --- a/net/minecraft/client/renderer/entity/ItemFrameRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemFrameRenderer.java -@@ -47,23 +47,23 @@ - p_225623_4_.func_227863_a_(Vector3f.field_229181_d_.func_229187_a_(180.0F - p_225623_1_.field_70177_z)); - BlockRendererDispatcher blockrendererdispatcher = this.field_147917_g.func_175602_ab(); - ModelManager modelmanager = blockrendererdispatcher.func_175023_a().func_178126_b(); -- ModelResourceLocation modelresourcelocation = p_225623_1_.func_82335_i().func_77973_b() == Items.field_151098_aY ? field_209586_g : field_209585_f; -+ ModelResourceLocation modelresourcelocation = p_225623_1_.func_82335_i().func_77973_b() instanceof FilledMapItem ? field_209586_g : field_209585_f; - p_225623_4_.func_227860_a_(); - p_225623_4_.func_227861_a_(-0.5D, -0.5D, -0.5D); - blockrendererdispatcher.func_175019_b().func_228804_a_(p_225623_4_.func_227866_c_(), p_225623_5_.getBuffer(Atlases.func_228782_g_()), (BlockState)null, modelmanager.func_174953_a(modelresourcelocation), 1.0F, 1.0F, 1.0F, p_225623_6_, OverlayTexture.field_229196_a_); - p_225623_4_.func_227865_b_(); +@@ -50,7 +50,7 @@ + if (!flag) { + BlockRendererDispatcher blockrendererdispatcher = this.field_147917_g.func_175602_ab(); + ModelManager modelmanager = blockrendererdispatcher.func_175023_a().func_178126_b(); +- ModelResourceLocation modelresourcelocation = p_225623_1_.func_82335_i().func_77973_b() == Items.field_151098_aY ? field_209586_g : field_209585_f; ++ ModelResourceLocation modelresourcelocation = p_225623_1_.func_82335_i().func_77973_b() instanceof FilledMapItem ? field_209586_g : field_209585_f; + p_225623_4_.func_227860_a_(); + p_225623_4_.func_227861_a_(-0.5D, -0.5D, -0.5D); + blockrendererdispatcher.func_175019_b().func_228804_a_(p_225623_4_.func_227866_c_(), p_225623_5_.getBuffer(Atlases.func_228782_g_()), (BlockState)null, modelmanager.func_174953_a(modelresourcelocation), 1.0F, 1.0F, 1.0F, p_225623_6_, OverlayTexture.field_229196_a_); +@@ -59,21 +59,21 @@ + ItemStack itemstack = p_225623_1_.func_82335_i(); if (!itemstack.func_190926_b()) { -- boolean flag = itemstack.func_77973_b() == Items.field_151098_aY; +- boolean flag1 = itemstack.func_77973_b() == Items.field_151098_aY; + MapData mapdata = FilledMapItem.func_195950_a(itemstack, p_225623_1_.field_70170_p); - p_225623_4_.func_227861_a_(0.0D, 0.0D, 0.4375D); -- int i = flag ? p_225623_1_.func_82333_j() % 4 * 2 : p_225623_1_.func_82333_j(); + if (flag) { + p_225623_4_.func_227861_a_(0.0D, 0.0D, 0.5D); + } else { + p_225623_4_.func_227861_a_(0.0D, 0.0D, 0.4375D); + } + +- int i = flag1 ? p_225623_1_.func_82333_j() % 4 * 2 : p_225623_1_.func_82333_j(); + int i = mapdata != null ? p_225623_1_.func_82333_j() % 4 * 2 : p_225623_1_.func_82333_j(); p_225623_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_((float)i * 360.0F / 8.0F)); -- if (flag) { +- if (flag1) { + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderItemInFrameEvent(p_225623_1_, this, p_225623_4_, p_225623_5_, p_225623_6_))) { + if (mapdata != null) { p_225623_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_(180.0F)); @@ -29,7 +35,7 @@ p_225623_4_.func_227861_a_(0.0D, 0.0D, -1.0D); if (mapdata != null) { this.field_147917_g.field_71460_t.func_147701_i().func_228086_a_(p_225623_4_, p_225623_5_, mapdata, true, p_225623_6_); -@@ -72,6 +72,7 @@ +@@ -82,6 +82,7 @@ p_225623_4_.func_227862_a_(0.5F, 0.5F, 0.5F); this.field_177074_h.func_229110_a_(itemstack, ItemCameraTransforms.TransformType.FIXED, p_225623_6_, OverlayTexture.field_229196_a_, p_225623_4_, p_225623_5_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch index 3196c360a..ccab8b99e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch @@ -1,14 +1,13 @@ --- a/net/minecraft/client/renderer/entity/ItemRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemRenderer.java -@@ -53,18 +53,15 @@ - boolean flag = ibakedmodel.func_177556_c(); +@@ -54,17 +54,14 @@ int j = this.func_177078_a(itemstack); float f = 0.25F; -- float f1 = MathHelper.func_76126_a(((float)p_225623_1_.func_174872_o() + p_225623_3_) / 10.0F + p_225623_1_.field_70290_d) * 0.1F + 0.1F; -+ float f1 = shouldBob() ? MathHelper.func_76126_a(((float)p_225623_1_.func_174872_o() + p_225623_3_) / 10.0F + p_225623_1_.field_70290_d) * 0.1F + 0.1F : 0; - float f2 = ibakedmodel.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.func_195900_b(); + float f1 = MathHelper.func_76126_a(((float)p_225623_1_.func_174872_o() + p_225623_3_) / 10.0F + p_225623_1_.field_70290_d) * 0.1F + 0.1F; +- float f2 = ibakedmodel.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.func_195900_b(); ++ float f2 = shouldBob() ? ibakedmodel.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.func_195900_b() : 0; p_225623_4_.func_227861_a_(0.0D, (double)(f1 + 0.25F * f2), 0.0D); - float f3 = ((float)p_225623_1_.func_174872_o() + p_225623_3_) / 20.0F + p_225623_1_.field_70290_d; + float f3 = p_225623_1_.func_234272_a_(p_225623_3_); p_225623_4_.func_227863_a_(Vector3f.field_229181_d_.func_229193_c_(f3)); - float f4 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195899_a(); - float f5 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195900_b(); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch index d8fed0747..7adc7abce 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch @@ -29,7 +29,7 @@ f8 = MathHelper.func_219799_g(p_225623_3_, p_225623_1_.field_184618_aE, p_225623_1_.field_70721_aZ); f5 = p_225623_1_.field_184619_aG - p_225623_1_.field_70721_aZ * (1.0F - p_225623_3_); if (p_225623_1_.func_70631_g_()) { -@@ -123,6 +126,7 @@ +@@ -125,6 +128,7 @@ p_225623_4_.func_227865_b_(); super.func_225623_a_(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch index 3f9fb40fc..e0bae32d6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/PlayerRenderer.java +++ b/net/minecraft/client/renderer/entity/PlayerRenderer.java -@@ -58,7 +58,9 @@ +@@ -60,7 +60,9 @@ public void func_225623_a_(AbstractClientPlayerEntity p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { this.func_177137_d(p_225623_1_); @@ -9,4 +9,4 @@ + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_225623_1_, this, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_)); } - public Vec3d func_225627_b_(AbstractClientPlayerEntity p_225627_1_, float p_225627_2_) { + public Vector3d func_225627_b_(AbstractClientPlayerEntity p_225627_1_, float p_225627_2_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/ArmorLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/ArmorLayer.java.patch deleted file mode 100644 index 52d16f687..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/ArmorLayer.java.patch +++ /dev/null @@ -1,99 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/layers/ArmorLayer.java -+++ b/net/minecraft/client/renderer/entity/layers/ArmorLayer.java -@@ -45,21 +45,22 @@ - ArmorItem armoritem = (ArmorItem)itemstack.func_77973_b(); - if (armoritem.func_185083_B_() == p_229129_10_) { - A a = this.func_215337_a(p_229129_10_); -+ a = getArmorModelHook(p_229129_3_, itemstack, p_229129_10_, a); - ((BipedModel)this.func_215332_c()).func_217148_a(a); - a.func_212843_a_(p_229129_3_, p_229129_4_, p_229129_5_, p_229129_6_); - this.func_188359_a(a, p_229129_10_); - a.func_225597_a_(p_229129_3_, p_229129_4_, p_229129_5_, p_229129_7_, p_229129_8_, p_229129_9_); - boolean flag = this.func_188363_b(p_229129_10_); - boolean flag1 = itemstack.func_77962_s(); -- if (armoritem instanceof DyeableArmorItem) { -- int i = ((DyeableArmorItem)armoritem).func_200886_f(itemstack); -+ if (armoritem instanceof net.minecraft.item.IDyeableArmorItem) { // Allow this for anything, not only cloth -+ int i = ((net.minecraft.item.IDyeableArmorItem)armoritem).func_200886_f(itemstack); - float f = (float)(i >> 16 & 255) / 255.0F; - float f1 = (float)(i >> 8 & 255) / 255.0F; - float f2 = (float)(i & 255) / 255.0F; -- this.func_229128_a_(p_229129_1_, p_229129_2_, p_229129_11_, armoritem, flag1, a, flag, f, f1, f2, (String)null); -- this.func_229128_a_(p_229129_1_, p_229129_2_, p_229129_11_, armoritem, flag1, a, flag, 1.0F, 1.0F, 1.0F, "overlay"); -+ renderArmor(p_229129_1_, p_229129_2_, p_229129_11_, flag1, a, f, f1, f2, this.getArmorResource(p_229129_3_, itemstack, p_229129_10_, null)); -+ renderArmor(p_229129_1_, p_229129_2_, p_229129_11_, flag1, a, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_229129_3_, itemstack, p_229129_10_, "overlay")); - } else { -- this.func_229128_a_(p_229129_1_, p_229129_2_, p_229129_11_, armoritem, flag1, a, flag, 1.0F, 1.0F, 1.0F, (String)null); -+ renderArmor(p_229129_1_, p_229129_2_, p_229129_11_, flag1, a, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_229129_3_, itemstack, p_229129_10_, null)); - } - - } -@@ -67,7 +68,10 @@ - } - - private void func_229128_a_(MatrixStack p_229128_1_, IRenderTypeBuffer p_229128_2_, int p_229128_3_, ArmorItem p_229128_4_, boolean p_229128_5_, A p_229128_6_, boolean p_229128_7_, float p_229128_8_, float p_229128_9_, float p_229128_10_, @Nullable String p_229128_11_) { -- IVertexBuilder ivertexbuilder = ItemRenderer.func_229113_a_(p_229128_2_, RenderType.func_228640_c_(this.func_177178_a(p_229128_4_, p_229128_7_, p_229128_11_)), false, p_229128_5_); -+ renderArmor(p_229128_1_, p_229128_2_, p_229128_3_, p_229128_5_, p_229128_6_, p_229128_8_, p_229128_9_, p_229128_10_, this.func_177178_a(p_229128_4_, p_229128_7_, p_229128_11_)); -+ } -+ private void renderArmor(MatrixStack p_229128_1_, IRenderTypeBuffer p_229128_2_, int p_229128_3_, boolean p_229128_5_, A p_229128_6_, float p_229128_8_, float p_229128_9_, float p_229128_10_, ResourceLocation armorResource) { -+ IVertexBuilder ivertexbuilder = ItemRenderer.func_229113_a_(p_229128_2_, RenderType.func_228640_c_(armorResource), false, p_229128_5_); - p_229128_6_.func_225598_a_(p_229128_1_, ivertexbuilder, p_229128_3_, OverlayTexture.field_229196_a_, p_229128_8_, p_229128_9_, p_229128_10_, 1.0F); - } - -@@ -79,6 +83,7 @@ - return p_188363_1_ == EquipmentSlotType.LEGS; - } - -+ @Deprecated //Use the more sensitive version getArmorResource below - 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); -@@ -87,4 +92,48 @@ - protected abstract void func_188359_a(A p_188359_1_, EquipmentSlotType p_188359_2_); - - protected abstract void func_177194_a(A p_177194_1_); -+ -+ -+ /*=================================== FORGE START =========================================*/ -+ -+ /** -+ * Hook to allow item-sensitive armor model. for LayerBipedArmor. -+ */ -+ protected A getArmorModelHook(T entity, ItemStack itemStack, EquipmentSlotType slot, A model) { -+ return model; -+ } -+ -+ /** -+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * -+ * @param entity Entity wearing the armor -+ * @param stack ItemStack for the armor -+ * @param slot Slot ID that the item is in -+ * @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, 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(':'); -+ if (idx != -1) -+ { -+ domain = texture.substring(0, idx); -+ texture = texture.substring(idx + 1); -+ } -+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (func_188363_b(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type)); -+ -+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = field_177191_j.get(s1); -+ -+ if (resourcelocation == null) -+ { -+ resourcelocation = new ResourceLocation(s1); -+ field_177191_j.put(s1, resourcelocation); -+ } -+ -+ return resourcelocation; -+ } -+ /*=================================== FORGE END ===========================================*/ - } 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 index c214801d4..8e2b0e781 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch @@ -1,12 +1,93 @@ --- 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); +@@ -44,19 +44,20 @@ + if (itemstack.func_77973_b() instanceof ArmorItem) { + ArmorItem armoritem = (ArmorItem)itemstack.func_77973_b(); + if (armoritem.func_185083_B_() == p_241739_4_) { ++ p_241739_6_ = getArmorModelHook(p_241739_3_, itemstack, p_241739_4_, p_241739_6_); + this.func_215332_c().func_217148_a(p_241739_6_); + this.func_188359_a(p_241739_6_, p_241739_4_); + boolean flag = this.func_188363_b(p_241739_4_); + boolean flag1 = itemstack.func_77962_s(); +- if (armoritem instanceof DyeableArmorItem) { +- int i = ((DyeableArmorItem)armoritem).func_200886_f(itemstack); ++ if (armoritem instanceof net.minecraft.item.IDyeableArmorItem) { ++ int i = ((net.minecraft.item.IDyeableArmorItem)armoritem).func_200886_f(itemstack); + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; +- this.func_241738_a_(p_241739_1_, p_241739_2_, p_241739_5_, armoritem, flag1, p_241739_6_, flag, f, f1, f2, (String)null); +- this.func_241738_a_(p_241739_1_, p_241739_2_, p_241739_5_, armoritem, flag1, p_241739_6_, flag, 1.0F, 1.0F, 1.0F, "overlay"); ++ this.func_241738_a_(p_241739_1_, p_241739_2_, p_241739_5_, flag1, p_241739_6_, f, f1, f2, this.getArmorResource(p_241739_3_, itemstack, p_241739_4_, null)); ++ this.func_241738_a_(p_241739_1_, p_241739_2_, p_241739_5_, flag1, p_241739_6_, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_241739_3_, itemstack, p_241739_4_, "overlay")); + } else { +- this.func_241738_a_(p_241739_1_, p_241739_2_, p_241739_5_, armoritem, flag1, p_241739_6_, flag, 1.0F, 1.0F, 1.0F, (String)null); ++ this.func_241738_a_(p_241739_1_, p_241739_2_, p_241739_5_, flag1, p_241739_6_, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_241739_3_, itemstack, p_241739_4_, null)); + } + + } +@@ -88,7 +89,10 @@ } -+ -+ @Override -+ protected A getArmorModelHook(T entity, net.minecraft.item.ItemStack itemStack, EquipmentSlotType slot, A model) { + + private void func_241738_a_(MatrixStack p_241738_1_, IRenderTypeBuffer p_241738_2_, int p_241738_3_, ArmorItem p_241738_4_, boolean p_241738_5_, A p_241738_6_, boolean p_241738_7_, float p_241738_8_, float p_241738_9_, float p_241738_10_, @Nullable String p_241738_11_) { +- IVertexBuilder ivertexbuilder = ItemRenderer.func_239386_a_(p_241738_2_, RenderType.func_239263_a_(this.func_241737_a_(p_241738_4_, p_241738_7_, p_241738_11_)), false, p_241738_5_); ++ func_241738_a_(p_241738_1_, p_241738_2_, p_241738_3_, p_241738_5_, p_241738_6_, p_241738_8_, p_241738_9_, p_241738_10_, this.func_241737_a_(p_241738_4_, p_241738_7_, p_241738_11_)); ++ } ++ private void func_241738_a_(MatrixStack p_241738_1_, IRenderTypeBuffer p_241738_2_, int p_241738_3_, boolean p_241738_5_, A p_241738_6_, float p_241738_8_, float p_241738_9_, float p_241738_10_, ResourceLocation armorResource) { ++ IVertexBuilder ivertexbuilder = ItemRenderer.func_239386_a_(p_241738_2_, RenderType.func_239263_a_(armorResource), false, p_241738_5_); + p_241738_6_.func_225598_a_(p_241738_1_, ivertexbuilder, p_241738_3_, OverlayTexture.field_229196_a_, p_241738_8_, p_241738_9_, p_241738_10_, 1.0F); + } + +@@ -100,8 +104,52 @@ + return p_188363_1_ == EquipmentSlotType.LEGS; + } + ++ @Deprecated //Use the more sensitive version getArmorResource below + private ResourceLocation func_241737_a_(ArmorItem p_241737_1_, boolean p_241737_2_, @Nullable String p_241737_3_) { + String s = "textures/models/armor/" + p_241737_1_.func_200880_d().func_200897_d() + "_layer_" + (p_241737_2_ ? 2 : 1) + (p_241737_3_ == null ? "" : "_" + p_241737_3_) + ".png"; + return field_177191_j.computeIfAbsent(s, ResourceLocation::new); + } ++ ++ /*=================================== FORGE START =========================================*/ ++ ++ /** ++ * Hook to allow item-sensitive armor model. for LayerBipedArmor. ++ */ ++ protected A getArmorModelHook(T entity, ItemStack itemStack, EquipmentSlotType slot, A model) { + return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model); + } ++ ++ /** ++ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. ++ * ++ * @param entity Entity wearing the armor ++ * @param stack ItemStack for the armor ++ * @param slot Slot ID that the item is in ++ * @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, EquipmentSlotType slot, @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(':'); ++ if (idx != -1) ++ { ++ domain = texture.substring(0, idx); ++ texture = texture.substring(idx + 1); ++ } ++ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (func_188363_b(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ ++ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); ++ ResourceLocation resourcelocation = field_177191_j.get(s1); ++ ++ if (resourcelocation == null) ++ { ++ resourcelocation = new ResourceLocation(s1); ++ field_177191_j.put(s1, resourcelocation); ++ } ++ ++ return resourcelocation; ++ } ++ /*=================================== FORGE END ===========================================*/ } 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 index fd6f18443..a465ae2c7 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/model/SkeletonModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/model/SkeletonModel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/model/SkeletonModel.java +++ b/net/minecraft/client/renderer/entity/model/SkeletonModel.java -@@ -43,7 +43,7 @@ +@@ -44,7 +44,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); @@ -9,7 +9,7 @@ if (p_212843_1_.func_184591_cq() == HandSide.RIGHT) { this.field_187076_m = BipedModel.ArmPose.BOW_AND_ARROW; } else { -@@ -57,7 +57,7 @@ +@@ -58,7 +58,7 @@ public void func_225597_a_(T p_225597_1_, float p_225597_2_, float p_225597_3_, float p_225597_4_, float p_225597_5_, float p_225597_6_) { super.func_225597_a_(p_225597_1_, p_225597_2_, p_225597_3_, p_225597_4_, p_225597_5_, p_225597_6_); ItemStack itemstack = p_225597_1_.func_184614_ca(); 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 aef18704e..d5dcda1f0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/model/BakedQuad.java +++ b/net/minecraft/client/renderer/model/BakedQuad.java -@@ -6,13 +6,22 @@ +@@ -6,7 +6,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) @@ -9,29 +9,10 @@ protected final int[] field_178215_a; protected final int field_178213_b; 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_, Direction p_i46574_3_, TextureAtlasSprite p_i46574_4_) { -+ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, true); -+ } -+ -+ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, Direction p_i46574_3_, TextureAtlasSprite p_i46574_4_, boolean applyDiffuseLighting) { -+ this.applyDiffuseLighting = applyDiffuseLighting; - this.field_178215_a = p_i46574_1_; - this.field_178213_b = p_i46574_2_; - this.field_178214_c = p_i46574_3_; -@@ -34,4 +43,20 @@ - public Direction func_178210_d() { +@@ -37,6 +37,15 @@ return this.field_178214_c; } -+ -+ // Forge start -+ protected final boolean applyDiffuseLighting; -+ + + @Override + public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { + net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); @@ -41,7 +22,6 @@ + return field_187509_d; + } + -+ public boolean shouldApplyDiffuseLighting() { -+ return applyDiffuseLighting; -+ } - } + public boolean func_239287_f_() { + return this.field_239286_e_; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch index 9e6766585..ee95301a1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch @@ -32,7 +32,7 @@ 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); } -+ public ItemOverrideList getOverrides(ModelBakery p_217646_1_, BlockModel p_217646_2_, Function textureGetter) { ++ public ItemOverrideList getOverrides(ModelBakery p_217646_1_, BlockModel p_217646_2_, Function textureGetter) { + return this.field_187968_k.isEmpty() ? ItemOverrideList.field_188022_a : new ItemOverrideList(p_217646_1_, p_217646_2_, p_217646_1_::func_209597_a, textureGetter, this.field_187968_k); + } + @@ -41,29 +41,29 @@ @@ -143,6 +153,9 @@ - Set set1 = Sets.newHashSet(this.func_228816_c_("particle")); + Set set1 = Sets.newHashSet(this.func_228816_c_("particle")); + if(customData.hasCustomGeometry()) + set1.addAll(customData.getTextureDependencies(p_225614_1_, p_225614_2_)); + else for(BlockPart blockpart : this.func_178298_a()) { for(BlockPartFace blockpartface : blockpart.field_178240_c.values()) { - Material material = this.func_228816_c_(blockpartface.field_178242_d); + RenderMaterial rendermaterial = this.func_228816_c_(blockpartface.field_178242_d); @@ -169,11 +182,17 @@ return set1; } + @Deprecated //Forge: Use Boolean variant - public IBakedModel func_225613_a_(ModelBakery p_225613_1_, Function p_225613_2_, IModelTransform p_225613_3_, ResourceLocation p_225613_4_) { + public IBakedModel func_225613_a_(ModelBakery p_225613_1_, Function p_225613_2_, IModelTransform p_225613_3_, ResourceLocation p_225613_4_) { return this.func_228813_a_(p_225613_1_, this, p_225613_2_, p_225613_3_, p_225613_4_, true); } - public IBakedModel func_228813_a_(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_, boolean p_228813_6_) { -+ return net.minecraftforge.client.model.ModelLoaderRegistry.bakeHelper(this, p_228813_1_, p_228813_2_, p_228813_3_, p_228813_4_, p_228813_5_, p_228813_6_); + public IBakedModel func_228813_a_(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_, boolean p_228813_6_) { ++ return net.minecraftforge.client.model.ModelLoaderRegistry.bakeHelper(this, p_228813_1_, p_228813_2_, p_228813_3_, p_228813_4_, p_228813_5_, p_228813_6_); + } + + @Deprecated //Forge: exposed for our callbacks only. Use the above function. -+ public IBakedModel bakeVanilla(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_, boolean p_228813_6_) { ++ public IBakedModel bakeVanilla(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_, boolean p_228813_6_) { TextureAtlasSprite textureatlassprite = p_228813_3_.apply(this.func_228816_c_("particle")); if (this.func_178310_f() == ModelBakery.field_177616_r) { return new BuiltInModel(this.func_181682_g(), this.func_217646_a(p_228813_1_, p_228813_2_), textureatlassprite, this.func_230176_c_().func_230178_a_()); 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 a21fdb8a8..e489cef56 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch @@ -1,32 +1,21 @@ --- a/net/minecraft/client/renderer/model/FaceBakery.java +++ b/net/minecraft/client/renderer/model/FaceBakery.java -@@ -36,14 +36,16 @@ - blockfaceuv.field_178351_a[2] = MathHelper.func_219799_g(f, blockfaceuv.field_178351_a[2], f1); - blockfaceuv.field_178351_a[1] = MathHelper.func_219799_g(f, blockfaceuv.field_178351_a[1], f2); - blockfaceuv.field_178351_a[3] = MathHelper.func_219799_g(f, blockfaceuv.field_178351_a[3], f2); -- int[] aint = this.func_228820_a_(blockfaceuv, p_228824_4_, p_228824_5_, this.func_199337_a(p_228824_1_, p_228824_2_), p_228824_6_.func_225615_b_(), p_228824_7_, p_228824_8_); -+ // FORGE: Apply diffuse lighting at render-time instead of baking it in -+ int[] aint = this.func_228820_a_(blockfaceuv, p_228824_4_, p_228824_5_, this.func_199337_a(p_228824_1_, p_228824_2_), p_228824_6_.func_225615_b_(), p_228824_7_, false); - Direction direction = func_178410_a(aint); - System.arraycopy(afloat, 0, blockfaceuv.field_178351_a, 0, afloat.length); - if (p_228824_7_ == null) { +@@ -43,6 +43,7 @@ this.func_178408_a(aint, direction); } -- return new BakedQuad(aint, p_228824_3_.field_178245_c, direction, p_228824_4_); + net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction); -+ return new BakedQuad(aint, p_228824_3_.field_178245_c, direction, p_228824_4_, p_228824_8_); + return new BakedQuad(aint, p_228824_3_.field_178245_c, direction, p_228824_4_, p_228824_8_); } - public static BlockFaceUV func_228821_a_(BlockFaceUV p_228821_0_, Direction p_228821_1_, TransformationMatrix p_228821_2_, ResourceLocation p_228821_3_) { -@@ -150,8 +152,8 @@ - p_228826_1_[i + 1] = Float.floatToRawIntBits(p_228826_3_.func_195900_b()); - p_228826_1_[i + 2] = Float.floatToRawIntBits(p_228826_3_.func_195902_c()); - p_228826_1_[i + 3] = p_228826_4_; -- p_228826_1_[i + 4] = Float.floatToRawIntBits(p_228826_5_.func_94214_a((double)p_228826_6_.func_178348_a(p_228826_2_))); -- p_228826_1_[i + 4 + 1] = Float.floatToRawIntBits(p_228826_5_.func_94207_b((double)p_228826_6_.func_178346_b(p_228826_2_))); -+ p_228826_1_[i + 4] = Float.floatToRawIntBits(p_228826_5_.func_94214_a((double)p_228826_6_.func_178348_a(p_228826_2_) * .999 + p_228826_6_.func_178348_a((p_228826_2_ + 2) % 4) * .001)); -+ p_228826_1_[i + 4 + 1] = Float.floatToRawIntBits(p_228826_5_.func_94207_b((double)p_228826_6_.func_178346_b(p_228826_2_) * .999 + p_228826_6_.func_178346_b((p_228826_2_ + 2) % 4) * .001)); +@@ -125,8 +126,8 @@ + p_239288_1_[i + 1] = Float.floatToRawIntBits(p_239288_3_.func_195900_b()); + p_239288_1_[i + 2] = Float.floatToRawIntBits(p_239288_3_.func_195902_c()); + p_239288_1_[i + 3] = -1; +- p_239288_1_[i + 4] = Float.floatToRawIntBits(p_239288_4_.func_94214_a((double)p_239288_5_.func_178348_a(p_239288_2_))); +- p_239288_1_[i + 4 + 1] = Float.floatToRawIntBits(p_239288_4_.func_94207_b((double)p_239288_5_.func_178346_b(p_239288_2_))); ++ p_239288_1_[i + 4] = Float.floatToRawIntBits(p_239288_4_.func_94214_a((double)p_239288_5_.func_178348_a(p_239288_2_) * .999 + p_239288_5_.func_178348_a((p_239288_2_ + 2) % 4) * .001)); ++ p_239288_1_[i + 4 + 1] = Float.floatToRawIntBits(p_239288_4_.func_94207_b((double)p_239288_5_.func_178346_b(p_239288_2_) * .999 + p_239288_5_.func_178346_b((p_239288_2_ + 2) % 4) * .001)); } private void func_199336_a(Vector3f p_199336_1_, @Nullable BlockPartRotation p_199336_2_) { 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 5308701d9..105cd9b64 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch @@ -8,4 +8,4 @@ +public interface IUnbakedModel extends net.minecraftforge.client.extensions.IForgeUnbakedModel { Collection func_187965_e(); - Collection func_225614_a_(Function p_225614_1_, Set> p_225614_2_); + Collection func_225614_a_(Function p_225614_1_, Set> p_225614_2_); 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 2d4f114db..49d460547 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch @@ -8,7 +8,7 @@ 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_1_.getSpriteMap()::func_229151_a_, p_i50984_4_); + } -+ public ItemOverrideList(ModelBakery p_i50984_1_, IUnbakedModel p_i50984_2_, Function p_i50984_3_, Function textureGetter, List p_i50984_4_) { ++ public ItemOverrideList(ModelBakery p_i50984_1_, IUnbakedModel p_i50984_2_, Function p_i50984_3_, Function textureGetter, List p_i50984_4_) { 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); @@ -18,7 +18,7 @@ @@ -55,4 +59,8 @@ - return p_209581_1_; + return p_239290_1_; } + + public com.google.common.collect.ImmutableList getOverrides() { 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 fe1d0ff12..5c2fad002 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.minecraft.client.renderer.TransformationMatrix} through {@link net.minecraftforge.client.extensions.IForgeBakedModel#handlePerspective} ++ * @deprecated use {@link net.minecraft.util.math.vector.TransformationMatrix} through {@link net.minecraftforge.client.extensions.IForgeBakedModel#handlePerspective} + */ @OnlyIn(Dist.CLIENT) +@Deprecated 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 355ed3264..d1e30afd8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch @@ -26,11 +26,11 @@ p_i226056_3_.func_219895_b("special"); this.func_217843_a(new ModelResourceLocation("minecraft:trident_in_hand#inventory")); + for (ResourceLocation rl : getSpecialModels()) { -+ addModelToCache(rl); ++ addModelToCache(rl); + } p_i226056_3_.func_219895_b("textures"); Set> set = Sets.newLinkedHashSet(); - Set set1 = this.field_217851_H.values().stream().flatMap((p_229342_2_) -> { + Set set1 = this.field_217851_H.values().stream().flatMap((p_229342_2_) -> { return p_229342_2_.func_225614_a_(this::func_209597_a, set).stream(); }).collect(Collectors.toSet()); set1.addAll(field_177602_b); @@ -46,7 +46,7 @@ field_177603_c.warn("Unable to bake model: '{}': {}", p_229350_1_, exception); } -@@ -443,6 +458,13 @@ +@@ -442,6 +457,13 @@ this.field_217848_D.addAll(p_209593_2_.func_187965_e()); } @@ -60,7 +60,7 @@ private void func_217843_a(ModelResourceLocation p_217843_1_) { IUnbakedModel iunbakedmodel = this.func_209597_a(p_217843_1_); this.field_217849_F.put(p_217843_1_, iunbakedmodel); -@@ -457,7 +479,13 @@ +@@ -456,7 +478,13 @@ } @Nullable @@ -70,11 +70,11 @@ + } + + @Nullable -+ public IBakedModel getBakedModel(ResourceLocation p_217845_1_, IModelTransform p_217845_2_, java.util.function.Function textureGetter) { ++ public IBakedModel getBakedModel(ResourceLocation p_217845_1_, IModelTransform p_217845_2_, java.util.function.Function textureGetter) { Triple triple = Triple.of(p_217845_1_, p_217845_2_.func_225615_b_(), p_217845_2_.func_188049_c()); if (this.field_217850_G.containsKey(triple)) { return this.field_217850_G.get(triple); -@@ -468,11 +496,11 @@ +@@ -467,11 +495,11 @@ if (iunbakedmodel instanceof BlockModel) { BlockModel blockmodel = (BlockModel)iunbakedmodel; if (blockmodel.func_178310_f() == field_177606_o) { @@ -88,7 +88,7 @@ this.field_217850_G.put(triple, ibakedmodel); return ibakedmodel; } -@@ -526,6 +554,10 @@ +@@ -524,6 +552,10 @@ return this.field_225367_M; } @@ -99,7 +99,7 @@ @OnlyIn(Dist.CLIENT) static class BlockStateDefinitionException extends RuntimeException { public BlockStateDefinitionException(String p_i49526_1_) { -@@ -533,6 +565,10 @@ +@@ -531,6 +563,10 @@ } } 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 c9094f9b5..0904884d3 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/renderer/model/ModelManager.java +++ b/net/minecraft/client/renderer/model/ModelManager.java -@@ -18,7 +18,7 @@ +@@ -19,7 +19,7 @@ @OnlyIn(Dist.CLIENT) public class ModelManager extends ReloadListener implements AutoCloseable { - private Map field_174958_a; + private Map field_174958_a = new java.util.HashMap<>(); + @Nullable private SpriteMap field_229352_b_; private final BlockModelShapes field_174957_c; - private final TextureManager field_229353_d_; -@@ -34,6 +34,10 @@ +@@ -36,6 +36,10 @@ this.field_174957_c = new BlockModelShapes(this); } @@ -20,7 +20,7 @@ public IBakedModel func_174953_a(ModelResourceLocation p_174953_1_) { return this.field_174958_a.getOrDefault(p_174953_1_, this.field_174955_d); } -@@ -48,7 +52,7 @@ +@@ -50,7 +54,7 @@ protected ModelBakery func_212854_a_(IResourceManager p_212854_1_, IProfiler p_212854_2_) { p_212854_2_.func_219894_a(); @@ -29,7 +29,7 @@ p_212854_2_.func_219897_b(); return modelbakery; } -@@ -64,6 +68,7 @@ +@@ -66,6 +70,7 @@ this.field_174958_a = p_212853_1_.func_217846_a(); this.field_224744_f = p_212853_1_.func_225354_b(); this.field_174955_d = this.field_174958_a.get(ModelBakery.field_177604_a); @@ -37,7 +37,7 @@ p_212853_3_.func_219895_b("cache"); this.field_174957_c.func_178124_c(); p_212853_3_.func_76319_b(); -@@ -89,6 +94,7 @@ +@@ -91,6 +96,7 @@ } public AtlasTexture func_229356_a_(ResourceLocation p_229356_1_) { @@ -45,7 +45,7 @@ return this.field_229352_b_.func_229152_a_(p_229356_1_); } -@@ -99,4 +105,10 @@ +@@ -104,4 +110,10 @@ public void func_229355_a_(int p_229355_1_) { this.field_229354_f_ = p_229355_1_; } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/LayeredTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/LayeredTexture.java.patch deleted file mode 100644 index 9888e39ac..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/texture/LayeredTexture.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/renderer/texture/LayeredTexture.java -+++ b/net/minecraft/client/renderer/texture/LayeredTexture.java -@@ -30,7 +30,7 @@ - String s = iterator.next(); - - try (IResource iresource = p_195413_1_.func_199002_a(new ResourceLocation(s))) { -- NativeImage nativeimage = NativeImage.func_195713_a(iresource.func_199027_b()); -+ NativeImage nativeimage = net.minecraftforge.client.MinecraftForgeClient.getImageLayer(new ResourceLocation(s), p_195413_1_); - - while(iterator.hasNext()) { - String s1 = iterator.next(); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java.patch index ef9e370e7..58a40fd87 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java +++ b/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java -@@ -98,7 +98,7 @@ +@@ -100,7 +100,7 @@ f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; - int i = icallbackwrapper.apply(new DualBrightnessCallback<>()).applyAsInt(p_225616_5_); -- Material material = Atlases.func_228771_a_(p_225616_1_, chesttype, this.field_147509_j); -+ Material material = this.getMaterial(p_225616_1_, chesttype); - IVertexBuilder ivertexbuilder = material.func_229311_a_(p_225616_4_, RenderType::func_228638_b_); + int i = icallbackwrapper.apply(new DualBrightnessCallback<>()).applyAsInt(p_225616_5_); +- RenderMaterial rendermaterial = Atlases.func_228771_a_(p_225616_1_, chesttype, this.field_147509_j); ++ RenderMaterial rendermaterial = this.getMaterial(p_225616_1_, chesttype); + IVertexBuilder ivertexbuilder = rendermaterial.func_229311_a_(p_225616_4_, RenderType::func_228638_b_); if (flag1) { if (chesttype == ChestType.LEFT) { -@@ -121,4 +121,8 @@ +@@ -123,4 +123,8 @@ p_228871_4_.func_228308_a_(p_228871_1_, p_228871_2_, p_228871_7_, p_228871_8_); p_228871_5_.func_228308_a_(p_228871_1_, p_228871_2_, p_228871_7_, p_228871_8_); } + -+ protected Material getMaterial(T tileEntity, ChestType chestType) { ++ protected RenderMaterial getMaterial(T tileEntity, ChestType chestType) { + return Atlases.func_228771_a_(tileEntity, chestType, this.field_147509_j); + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch index f28783991..da399f476 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch @@ -4,7 +4,7 @@ } private void func_228876_a_(BlockPos p_228876_1_, BlockState p_228876_2_, MatrixStack p_228876_3_, IRenderTypeBuffer p_228876_4_, World p_228876_5_, boolean p_228876_6_, int p_228876_7_) { -- RenderType rendertype = RenderTypeLookup.func_228390_a_(p_228876_2_); +- RenderType rendertype = RenderTypeLookup.func_239221_b_(p_228876_2_); + net.minecraft.client.renderer.RenderType.func_228661_n_().stream().filter(t -> RenderTypeLookup.canRenderInLayer(p_228876_2_, t)).forEach(rendertype -> { + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(rendertype); IVertexBuilder ivertexbuilder = p_228876_4_.getBuffer(rendertype); 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 6b14293f4..55e9c02d6 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 -@@ -134,4 +134,9 @@ +@@ -135,4 +135,9 @@ public FontRenderer func_147548_a() { return this.field_147557_n; } diff --git a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java.patch b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java.patch index d1b8d13a7..2b5178011 100644 --- a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java.patch @@ -7,7 +7,7 @@ + + // Forge start + public int getOffset(int index) { return field_177356_c.getInt(index); } -+ public boolean hasPosition() { return field_177355_b.stream().anyMatch(e -> e.func_177374_g()); } ++ public boolean hasPosition() { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.POSITION); } + public boolean hasNormal() { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.NORMAL); } + public boolean hasColor() { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.COLOR); } + public boolean hasUV(int which) { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.UV && e.func_177369_e() == which); } diff --git a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch new file mode 100644 index 000000000..e889095d7 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/client/renderer/vertex/VertexFormatElement.java ++++ b/net/minecraft/client/renderer/vertex/VertexFormatElement.java +@@ -88,6 +88,12 @@ + this.field_177380_c.func_227901_a_(this.field_177377_d); + } + ++ //Forge Start ++ public int getElementCount() { ++ return field_177378_e; ++ } ++ //Forge End ++ + @OnlyIn(Dist.CLIENT) + public static enum Type { + FLOAT(4, "Float", 5126), diff --git a/patches/minecraft/net/minecraft/client/resources/ClientResourcePackInfo.java.patch b/patches/minecraft/net/minecraft/client/resources/ClientResourcePackInfo.java.patch index 7ff2c300b..d1850d5b3 100644 --- a/patches/minecraft/net/minecraft/client/resources/ClientResourcePackInfo.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/ClientResourcePackInfo.java.patch @@ -1,32 +1,28 @@ --- a/net/minecraft/client/resources/ClientResourcePackInfo.java +++ b/net/minecraft/client/resources/ClientResourcePackInfo.java -@@ -23,8 +23,13 @@ +@@ -24,13 +24,23 @@ @Nullable private ResourceLocation field_195810_b; + @Deprecated - 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 ClientResourcePackInfo(String p_i232485_1_, boolean p_i232485_2_, Supplier p_i232485_3_, IResourcePack p_i232485_4_, PackMetadataSection p_i232485_5_, ResourcePackInfo.Priority p_i232485_6_, IPackNameDecorator p_i232485_7_) { +- super(p_i232485_1_, p_i232485_2_, p_i232485_3_, p_i232485_4_, p_i232485_5_, p_i232485_6_, p_i232485_7_); ++ this(p_i232485_1_, p_i232485_2_, p_i232485_3_, p_i232485_4_, p_i232485_5_, p_i232485_6_, p_i232485_7_, false); + } + -+ 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; - - try (InputStream inputstream = p_i48113_4_.func_195763_b("pack.png")) { -@@ -36,8 +41,13 @@ - this.field_195809_a = nativeimage; ++ public ClientResourcePackInfo(String p_i232485_1_, boolean p_i232485_2_, Supplier p_i232485_3_, IResourcePack p_i232485_4_, PackMetadataSection p_i232485_5_, ResourcePackInfo.Priority p_i232485_6_, IPackNameDecorator p_i232485_7_, boolean hidden) { ++ super(p_i232485_1_, p_i232485_2_, p_i232485_3_, p_i232485_4_, p_i232485_5_, p_i232485_6_, p_i232485_7_, hidden); + this.field_195809_a = func_239491_a_(p_i232485_4_); } + @Deprecated - 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 ClientResourcePackInfo(String p_i232486_1_, boolean p_i232486_2_, Supplier p_i232486_3_, ITextComponent p_i232486_4_, ITextComponent p_i232486_5_, PackCompatibility p_i232486_6_, ResourcePackInfo.Priority p_i232486_7_, boolean p_i232486_8_, IPackNameDecorator p_i232486_9_, @Nullable NativeImage p_i232486_10_) { +- super(p_i232486_1_, p_i232486_2_, p_i232486_3_, p_i232486_4_, p_i232486_5_, p_i232486_6_, p_i232486_7_, p_i232486_8_, p_i232486_9_); ++ this(p_i232486_1_, p_i232486_2_, p_i232486_3_, p_i232486_4_, p_i232486_5_, p_i232486_6_, p_i232486_7_, p_i232486_8_, p_i232486_9_, p_i232486_10_, false); + } + -+ 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_; ++ public ClientResourcePackInfo(String p_i232486_1_, boolean p_i232486_2_, Supplier p_i232486_3_, ITextComponent p_i232486_4_, ITextComponent p_i232486_5_, PackCompatibility p_i232486_6_, ResourcePackInfo.Priority p_i232486_7_, boolean p_i232486_8_, IPackNameDecorator p_i232486_9_, @Nullable NativeImage p_i232486_10_, boolean hidden) { ++ super(p_i232486_1_, p_i232486_2_, p_i232486_3_, p_i232486_4_, p_i232486_5_, p_i232486_6_, p_i232486_7_, p_i232486_8_, p_i232486_9_, hidden); + this.field_195809_a = p_i232486_10_; } diff --git a/patches/minecraft/net/minecraft/client/resources/I18n.java.patch b/patches/minecraft/net/minecraft/client/resources/I18n.java.patch index 093574f21..ac3face51 100644 --- a/patches/minecraft/net/minecraft/client/resources/I18n.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/I18n.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/resources/I18n.java +++ b/net/minecraft/client/resources/I18n.java -@@ -9,6 +9,7 @@ +@@ -11,6 +11,7 @@ - static void func_135051_a(Locale p_135051_0_) { - field_135054_a = p_135051_0_; -+ net.minecraftforge.fml.ForgeI18n.loadLanguageData(field_135054_a.field_135032_a); + static void func_239502_a_(LanguageMap p_239502_0_) { + field_239501_a_ = p_239502_0_; ++ //net.minecraftforge.fml.ForgeI18n.loadLanguageData(i18nLocale.properties); //TODO } public static String func_135052_a(String p_135052_0_, Object... p_135052_1_) { diff --git a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch index 84332ce2d..1c327c11e 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 -@@ -14,9 +14,9 @@ +@@ -15,9 +15,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); -@@ -35,7 +35,7 @@ +@@ -36,7 +36,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; } -@@ -43,7 +43,7 @@ +@@ -44,7 +44,7 @@ } public static void func_197980_a(InputMappings.Input p_197980_0_, boolean p_197980_1_) { @@ -30,7 +30,7 @@ if (keybinding != null) { keybinding.func_225593_a_(p_197980_1_); } -@@ -67,10 +67,10 @@ +@@ -68,10 +68,10 @@ } public static void func_74508_b() { @@ -43,7 +43,7 @@ } } -@@ -85,12 +85,12 @@ +@@ -86,12 +86,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() { -@@ -124,7 +124,13 @@ +@@ -125,7 +125,13 @@ } public int compareTo(KeyBinding p_compareTo_1_) { @@ -72,8 +72,8 @@ + return tCat.compareTo(oCat); } - public static Supplier func_193626_b(String p_193626_0_) { -@@ -135,6 +141,20 @@ + public static Supplier func_193626_b(String p_193626_0_) { +@@ -136,6 +142,20 @@ } public boolean func_197983_b(KeyBinding p_197983_1_) { @@ -94,19 +94,12 @@ return this.field_74512_d.equals(p_197983_1_.field_74512_d); } -@@ -155,6 +175,7 @@ +@@ -156,11 +176,12 @@ } - public String func_197978_k() { -+ return getKeyModifier().getLocalizedComboName(this.field_74512_d, () -> { - String s = this.field_74512_d.func_197935_d(); - int i = this.field_74512_d.func_197937_c(); - String s1 = null; -@@ -171,16 +192,97 @@ - } - - return s1 == null ? I18n.func_135052_a(s) : s1; -+ }); + public ITextComponent func_238171_j_() { ++ //TODO eturn getKeyModifier().getLocalizedComboName needs to go here + return this.field_74512_d.func_237520_d_(); } public boolean func_197985_l() { @@ -115,9 +108,11 @@ } public String func_197982_m() { - return this.field_74512_d.func_197935_d(); +@@ -170,4 +191,84 @@ + public void func_225593_a_(boolean p_225593_1_) { + this.field_74513_e = p_225593_1_; } - ++ + /****************** 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; @@ -127,21 +122,21 @@ + * 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) { -+ this(description, keyConflictContext, inputType.func_197944_a(keyCode), 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); ++ 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) { -+ this(description, keyConflictContext, keyModifier, inputType.func_197944_a(keyCode), category); ++ this(description, keyConflictContext, keyModifier, inputType.func_197944_a(keyCode), category); + } + + /** @@ -156,7 +151,7 @@ + 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); @@ -164,40 +159,37 @@ + + @Override + public InputMappings.Input getKey() { -+ return this.field_74512_d; ++ return this.field_74512_d; + } + + @Override + public void setKeyConflictContext(net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext) { -+ this.keyConflictContext = keyConflictContext; ++ this.keyConflictContext = keyConflictContext; + } + + @Override + public net.minecraftforge.client.settings.IKeyConflictContext getKeyConflictContext() { -+ return keyConflictContext; ++ return keyConflictContext; + } + + @Override + public net.minecraftforge.client.settings.KeyModifier getKeyModifierDefault() { -+ return keyModifierDefault; ++ return keyModifierDefault; + } + + @Override + public net.minecraftforge.client.settings.KeyModifier getKeyModifier() { -+ return keyModifier; ++ 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); ++ 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 *****************************/ -+ - public void func_225593_a_(boolean p_225593_1_) { - this.field_74513_e = p_225593_1_; - } + } diff --git a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch index c94cb23d0..2ed1903a5 100644 --- a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -1,21 +1,6 @@ --- a/net/minecraft/client/shader/Framebuffer.java +++ b/net/minecraft/client/shader/Framebuffer.java -@@ -100,8 +100,14 @@ - GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227594_c_, 3553, this.field_147617_g, 0); - if (this.field_147619_e) { - GlStateManager.func_227730_i_(FramebufferConstants.field_227593_b_, this.field_147624_h); -+ if (!stencilEnabled) { - GlStateManager.func_227678_b_(FramebufferConstants.field_227593_b_, 33190, this.field_147622_a, this.field_147620_b); - GlStateManager.func_227693_c_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227595_d_, FramebufferConstants.field_227593_b_, this.field_147624_h); -+ } else { -+ GlStateManager.func_227678_b_(FramebufferConstants.field_227593_b_, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.field_147622_a, this.field_147620_b); -+ GlStateManager.func_227693_c_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, FramebufferConstants.field_227593_b_, this.field_147624_h); -+ GlStateManager.func_227693_c_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, FramebufferConstants.field_227593_b_, this.field_147624_h); -+ } - } - - this.func_147611_b(); -@@ -254,4 +260,29 @@ +@@ -280,4 +280,29 @@ GlStateManager.func_227658_a_(i, p_216493_1_); this.func_147609_e(); } diff --git a/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch b/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch index 464d7dd5e..3b85d51e4 100644 --- a/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/shader/ShaderInstance.java +++ b/net/minecraft/client/shader/ShaderInstance.java -@@ -50,7 +50,8 @@ +@@ -51,7 +51,8 @@ private final ShaderLoader field_216563_s; public ShaderInstance(IResourceManager p_i50988_1_, String p_i50988_2_) throws IOException { diff --git a/patches/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch b/patches/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch index e821230c2..c748c83ba 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 @@ -31,6 +31,11 @@ - return (IMutableSearchTree) this.field_194013_c.get(p_215358_1_); + 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 index a07b850b4..7ca3f0bdc 100644 --- a/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch @@ -1,23 +1,15 @@ --- a/net/minecraft/client/world/ClientWorld.java +++ b/net/minecraft/client/world/ClientWorld.java @@ -103,6 +103,8 @@ - this.func_175652_B(new BlockPos(8, 64, 8)); + this.func_239136_a_(new BlockPos(8, 64, 8)); this.func_72966_v(); this.func_72947_a(); -+ this.gatherCapabilities(field_73011_w.initCapabilities()); ++ //this.gatherCapabilities(dimension.initCapabilities()); //TODO + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); } - public void func_72835_b(BooleanSupplier p_72835_1_) { -@@ -127,6 +129,7 @@ - Entity entity = this.field_217428_a.get(i); - this.func_217390_a((p_228325_0_) -> { - ++p_228325_0_.field_70173_aa; -+ if (p_228325_0_.canUpdate()) - p_228325_0_.func_70071_h_(); - }, entity); - if (entity.field_70128_L) { -@@ -172,6 +175,7 @@ + public DimensionRenderInfo func_239132_a_() { +@@ -185,6 +187,7 @@ this.func_217381_Z().func_194340_a(() -> { return Registry.field_212629_r.func_177774_c(p_217418_1_.func_200600_R()).toString(); }); @@ -25,7 +17,7 @@ p_217418_1_.func_70071_h_(); this.func_217381_Z().func_76319_b(); } -@@ -289,9 +293,11 @@ +@@ -284,9 +287,11 @@ } private void func_217424_b(int p_217424_1_, Entity p_217424_2_) { @@ -37,7 +29,7 @@ } public void func_217413_d(int p_217413_1_) { -@@ -310,6 +316,7 @@ +@@ -305,6 +310,7 @@ } this.field_217431_w.remove(p_217414_1_); @@ -45,7 +37,7 @@ } public void func_217417_b(Chunk p_217417_1_) { -@@ -443,6 +450,11 @@ +@@ -447,6 +453,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_) { @@ -57,7 +49,7 @@ 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); } -@@ -450,6 +462,11 @@ +@@ -454,6 +465,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_) { diff --git a/patches/minecraft/net/minecraft/command/Commands.java.patch b/patches/minecraft/net/minecraft/command/Commands.java.patch index 5fd933cf8..427b323de 100644 --- a/patches/minecraft/net/minecraft/command/Commands.java.patch +++ b/patches/minecraft/net/minecraft/command/Commands.java.patch @@ -1,11 +1,10 @@ --- a/net/minecraft/command/Commands.java +++ b/net/minecraft/command/Commands.java -@@ -194,7 +194,15 @@ +@@ -202,6 +202,14 @@ try { try { -- int lvt_4_3_ = this.field_197062_b.execute(stringreader, p_197059_1_); -+ com.mojang.brigadier.ParseResults parse = this.field_197062_b.parse(stringreader, p_197059_1_); ++ ParseResults parse = this.field_197062_b.parse(stringreader, p_197059_1_); + net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(parse); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { + if (event.getException() != null) { @@ -13,7 +12,6 @@ + } + return 1; + } -+ int lvt_4_3_ = this.field_197062_b.execute(event.getParseResults()); - return lvt_4_3_; + return this.field_197062_b.execute(stringreader, p_197059_1_); } catch (CommandException commandexception) { p_197059_1_.func_197021_a(commandexception.func_197003_a()); diff --git a/patches/minecraft/net/minecraft/command/arguments/BlockStateParser.java.patch b/patches/minecraft/net/minecraft/command/arguments/BlockStateParser.java.patch index 3cc346834..bcbca2830 100644 --- a/patches/minecraft/net/minecraft/command/arguments/BlockStateParser.java.patch +++ b/patches/minecraft/net/minecraft/command/arguments/BlockStateParser.java.patch @@ -1,26 +1,19 @@ --- a/net/minecraft/command/arguments/BlockStateParser.java +++ b/net/minecraft/command/arguments/BlockStateParser.java -@@ -168,13 +168,13 @@ +@@ -170,7 +170,7 @@ - private boolean func_212598_k() { + private boolean func_212598_k(TagCollection p_212598_1_) { if (this.field_197270_l != null) { -- return this.field_197270_l.func_177230_c().func_149716_u(); +- return this.field_197270_l.func_177230_c().func_235695_q_(); + return this.field_197270_l.hasTileEntity(); } else { if (this.field_199833_p != null) { - Tag tag = BlockTags.func_199896_a().func_199910_a(this.field_199833_p); - if (tag != null) { - for(Block block : tag.func_199885_a()) { -- if (block.func_149716_u()) { -+ if (block.func_176223_P().hasTileEntity()) { - return true; - } - } -@@ -291,7 +291,7 @@ + ITag itag = p_212598_1_.func_199910_a(this.field_199833_p); +@@ -293,7 +293,7 @@ p_197255_1_.suggest(String.valueOf('[')); } -- if (this.field_197270_l.func_177230_c().func_149716_u()) { +- if (this.field_197270_l.func_177230_c().func_235695_q_()) { + if (this.field_197270_l.hasTileEntity()) { p_197255_1_.suggest(String.valueOf('{')); } diff --git a/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch b/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch index 2b447db97..5a847b978 100644 --- a/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch +++ b/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/command/impl/TeleportCommand.java +++ b/net/minecraft/command/impl/TeleportCommand.java -@@ -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; +@@ -159,7 +159,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; + } } - } diff --git a/patches/minecraft/net/minecraft/data/BlockModelDefinition.java.patch b/patches/minecraft/net/minecraft/data/BlockModelDefinition.java.patch new file mode 100644 index 000000000..137ed77c0 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/BlockModelDefinition.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/data/BlockModelDefinition.java ++++ b/net/minecraft/data/BlockModelDefinition.java +@@ -8,6 +8,8 @@ + import java.util.Map; + import java.util.function.Supplier; + ++import net.minecraft.data.BlockModeInfo.Field; ++ + public class BlockModelDefinition implements Supplier { + private final Map, BlockModeInfo.Field> field_240193_a_ = Maps.newLinkedHashMap(); + diff --git a/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch b/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch index fa26229b8..f4162e888 100644 --- a/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/LootTableProvider.java +++ b/net/minecraft/data/LootTableProvider.java -@@ -42,7 +42,7 @@ +@@ -43,7 +43,7 @@ public void func_200398_a(DirectoryCache p_200398_1_) { Path path = this.field_218443_d.func_200391_b(); Map map = Maps.newHashMap(); @@ -9,7 +9,7 @@ p_218438_1_.getFirst().get().accept((p_218437_2_, p_218437_3_) -> { if (map.put(p_218437_2_, p_218437_3_.func_216039_a(p_218438_1_.getSecond()).func_216038_b()) != null) { throw new IllegalStateException("Duplicate loot table " + p_218437_2_); -@@ -53,13 +53,8 @@ +@@ -54,13 +54,8 @@ return null; }, map::get); @@ -24,7 +24,7 @@ Multimap multimap = validationtracker.func_227527_a_(); if (!multimap.isEmpty()) { multimap.forEach((p_229440_0_, p_229440_1_) -> { -@@ -80,6 +75,20 @@ +@@ -81,6 +76,20 @@ } } diff --git a/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch b/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch index 7bf7bb49c..3f67b6b5a 100644 --- a/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch @@ -1,10 +1,28 @@ --- a/net/minecraft/data/RecipeProvider.java +++ b/net/minecraft/data/RecipeProvider.java -@@ -57,6 +57,7 @@ +@@ -59,6 +59,7 @@ } }); + if (this.getClass() == RecipeProvider.class) //Forge: Subclasses don't need this. - this.func_208310_b(p_200398_1_, Advancement.Builder.func_200278_a().func_200275_a("impossible", new ImpossibleTrigger.Instance()).func_200273_b(), path.resolve("data/minecraft/advancements/recipes/root.json")); + func_208310_b(p_200398_1_, Advancement.Builder.func_200278_a().func_200275_a("impossible", new ImpossibleTrigger.Instance()).func_200273_b(), path.resolve("data/minecraft/advancements/recipes/root.json")); } +@@ -81,7 +82,7 @@ + + } + +- protected static void func_208310_b(DirectoryCache p_208310_0_, JsonObject p_208310_1_, Path p_208310_2_) { ++ protected void func_208310_b(DirectoryCache p_208310_0_, JsonObject p_208310_1_, Path p_208310_2_) { + try { + String s = field_200412_b.toJson((JsonElement)p_208310_1_); + String s1 = field_208307_a.hashUnencodedChars(s).toString(); +@@ -100,7 +101,7 @@ + + } + +- protected static void func_200404_a(Consumer p_200404_0_) { ++ protected void func_200404_a(Consumer p_200404_0_) { + func_240470_a_(p_200404_0_, Blocks.field_196670_r, ItemTags.field_203297_q); + func_240472_b_(p_200404_0_, Blocks.field_196666_p, ItemTags.field_203296_p); + func_240472_b_(p_200404_0_, Blocks.field_235344_mC_, ItemTags.field_232913_w_); diff --git a/patches/minecraft/net/minecraft/data/TagsProvider.java.patch b/patches/minecraft/net/minecraft/data/TagsProvider.java.patch index c62e9d5bd..5dfdfed73 100644 --- a/patches/minecraft/net/minecraft/data/TagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/TagsProvider.java.patch @@ -1,10 +1,19 @@ --- a/net/minecraft/data/TagsProvider.java +++ b/net/minecraft/data/TagsProvider.java -@@ -48,6 +48,7 @@ - tagcollection.func_200039_c().forEach((p_223474_2_, p_223474_3_) -> { - JsonObject jsonobject = p_223474_3_.func_200571_a(this.field_200435_c::func_177774_c); - Path path = this.func_200431_a(p_223474_2_); -+ if (path == null) return; //Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. +@@ -53,6 +53,7 @@ + } else { + JsonObject jsonobject = p_240524_5_.func_232965_c_(); + Path path = this.func_200431_a(p_240524_4_); ++ if (path == null) return; //Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. - try { - String s = field_200437_e.toJson((JsonElement)jsonobject); + try { + String s = field_200437_e.toJson((JsonElement)jsonobject); +@@ -87,7 +88,7 @@ + }); + } + +- public static class Builder { ++ public static class Builder implements net.minecraftforge.common.extensions.IForgeTagBuilder { + private final ITag.Builder field_240528_a_; + private final Registry field_240529_b_; + private final String field_240530_c_; diff --git a/patches/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch b/patches/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch index 3301eee73..e86e91b57 100644 --- a/patches/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/loot/BlockLootTables.java +++ b/net/minecraft/data/loot/BlockLootTables.java -@@ -204,7 +204,7 @@ +@@ -216,7 +216,7 @@ return LootTable.func_216119_b(); } @@ -9,10 +9,10 @@ this.func_218492_c(Blocks.field_196650_c); this.func_218492_c(Blocks.field_196652_d); this.func_218492_c(Blocks.field_196654_e); -@@ -976,9 +976,13 @@ - this.func_218507_a(Blocks.field_150414_aQ, func_218482_a()); - this.func_218507_a(Blocks.field_185778_de, func_218482_a()); - this.func_218507_a(Blocks.field_150474_ac, func_218482_a()); +@@ -1066,9 +1066,13 @@ + this.func_218507_a(Blocks.field_150480_ab, func_218482_a()); + this.func_218507_a(Blocks.field_235335_bO_, func_218482_a()); + this.func_218507_a(Blocks.field_150427_aO, func_218482_a()); + } + + public void accept(BiConsumer p_accept_1_) { @@ -24,8 +24,8 @@ ResourceLocation resourcelocation = block.func_220068_i(); if (resourcelocation != LootTables.field_186419_a && set.add(resourcelocation)) { LootTable.Builder loottable$builder = this.field_218581_i.remove(resourcelocation); -@@ -995,6 +999,10 @@ - } +@@ -1095,6 +1099,10 @@ + return func_218562_a(p_239829_0_, DoorBlock.field_176523_O, DoubleBlockHalf.LOWER); } + protected Iterable getKnownBlocks() { @@ -33,5 +33,5 @@ + } + public void func_218547_a(Block p_218547_1_) { - this.func_218522_a(p_218547_1_, (p_229438_0_) -> { - return func_218523_c(((FlowerPotBlock)p_229438_0_).func_220276_d()); + this.func_218522_a(p_218547_1_, (p_241751_0_) -> { + return func_218523_c(((FlowerPotBlock)p_241751_0_).func_220276_d()); diff --git a/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch b/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch index 793278692..dcc9eddd5 100644 --- a/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch @@ -9,9 +9,9 @@ this.func_218582_a(EntityType.field_200789_c, LootTable.func_216119_b()); this.func_218582_a(EntityType.field_200791_e, LootTable.func_216119_b()); this.func_218582_a(EntityType.field_226289_e_, LootTable.func_216119_b()); -@@ -137,8 +137,12 @@ - this.func_218582_a(EntityType.field_200726_aE, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151078_bh).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 2.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F)))))); - this.func_218582_a(EntityType.field_200785_Y, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151078_bh).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 1.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151074_bl).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 1.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151043_k)).func_212840_b_(KilledByPlayer.func_215994_b()).func_212840_b_(RandomChanceWithLooting.func_216003_a(0.025F, 0.01F)))); +@@ -141,8 +141,12 @@ + this.func_218582_a(EntityType.field_233588_G_, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151147_al).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(2.0F, 4.0F))).func_212841_b_(Smelt.func_215953_b().func_212840_b_(EntityHasProperty.func_215999_a(LootContext.EntityTarget.THIS, field_218586_a))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151116_aA).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 1.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F)))))); + this.func_218582_a(EntityType.field_233591_ai_, LootTable.func_216119_b()); this.func_218582_a(EntityType.field_200727_aF, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151078_bh).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 2.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151042_j)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151172_bF)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151174_bG)).func_212840_b_(KilledByPlayer.func_215994_b()).func_212840_b_(RandomChanceWithLooting.func_216003_a(0.025F, 0.01F)))); + } + @@ -23,7 +23,7 @@ EntityType entitytype; ResourceLocation resourcelocation; -@@ -150,7 +154,7 @@ +@@ -154,7 +158,7 @@ entitytype = (EntityType)iterator.next(); resourcelocation = entitytype.func_220348_g(); @@ -32,7 +32,7 @@ if (resourcelocation != LootTables.field_186419_a && this.field_218587_b.remove(resourcelocation) != null) { break; } -@@ -167,6 +171,14 @@ +@@ -171,6 +175,14 @@ throw new IllegalStateException(String.format("Weird loottable '%s' for '%s', not a LivingEntity so should not have loot", resourcelocation, Registry.field_212629_r.func_177774_c(entitytype))); } @@ -44,6 +44,6 @@ + return !field_222944_b.contains(entitytype) && entitytype.func_220339_d() == EntityClassification.MISC; + } + - protected void func_218582_a(EntityType p_218582_1_, LootTable.Builder p_218582_2_) { + private void func_218582_a(EntityType p_218582_1_, LootTable.Builder p_218582_2_) { this.func_218585_a(p_218582_1_.func_220348_g(), p_218582_2_); } diff --git a/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch index ca367b12c..a0f54047d 100644 --- a/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch +++ b/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/dispenser/IDispenseItemBehavior.java +++ b/net/minecraft/dispenser/IDispenseItemBehavior.java -@@ -295,8 +295,9 @@ - world.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P()); - } else if (FlintAndSteelItem.func_219997_a(blockstate)) { +@@ -371,8 +371,9 @@ + world.func_175656_a(blockpos, AbstractFireBlock.func_235326_a_(world, blockpos)); + } else if (CampfireBlock.func_241470_h_(blockstate)) { world.func_175656_a(blockpos, blockstate.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true))); - } else if (blockstate.func_177230_c() instanceof TNTBlock) { - TNTBlock.func_196534_a(world, blockpos); @@ -11,31 +11,4 @@ + if (blockstate.func_177230_c() instanceof TNTBlock) world.func_217377_a(blockpos, false); } else { - this.field_218407_b = false; -@@ -426,15 +427,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((net.minecraft.entity.Entity)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(d, 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); - } + this.func_239796_a_(false); diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 9fb0bac15..2832b21ab 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/enchantment/Enchantment.java +++ b/net/minecraft/enchantment/Enchantment.java -@@ -17,7 +17,7 @@ +@@ -18,7 +18,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -8,7 +8,7 @@ +public abstract class Enchantment extends net.minecraftforge.registries.ForgeRegistryEntry { private final EquipmentSlotType[] field_185263_a; private final Enchantment.Rarity field_77333_a; - @Nullable + public final EnchantmentType field_77351_y; @@ -114,7 +114,7 @@ } @@ -18,8 +18,8 @@ } public void func_151368_a(LivingEntity p_151368_1_, Entity p_151368_2_, int p_151368_3_) { -@@ -131,6 +131,24 @@ - return false; +@@ -139,6 +139,24 @@ + return true; } + /** diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 91f50c0dd..87ae54787 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 -@@ -262,7 +262,7 @@ +@@ -274,7 +274,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 { -@@ -300,7 +300,7 @@ +@@ -312,7 +312,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 { -@@ -353,7 +353,7 @@ +@@ -365,7 +365,7 @@ boolean flag = p_185291_1_.func_77973_b() == Items.field_151122_aG; 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()))) { +- if ((!enchantment.func_185261_e() || p_185291_2_) && enchantment.func_230310_i_() && (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_223551_b(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 index 050831318..4f84fbb22 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/enchantment/EnchantmentType.java +++ b/net/minecraft/enchantment/EnchantmentType.java -@@ -14,7 +14,7 @@ +@@ -11,7 +11,7 @@ import net.minecraft.item.ToolItem; import net.minecraft.item.TridentItem; -public enum EnchantmentType { +public enum EnchantmentType implements net.minecraftforge.common.IExtensibleEnum { - ALL { + ARMOR { public boolean func_77557_a(Item p_77557_1_) { - for(EnchantmentType enchantmenttype : EnchantmentType.values()) { -@@ -96,5 +96,16 @@ + return p_77557_1_ instanceof ArmorItem; +@@ -86,5 +86,16 @@ private EnchantmentType() { } diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 719851b75..b32570e85 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/Entity.java +++ b/net/minecraft/entity/Entity.java -@@ -105,12 +105,13 @@ +@@ -107,12 +107,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -16,14 +16,14 @@ private int field_145783_c = field_213331_b.incrementAndGet(); public boolean field_70156_m; @@ -138,6 +139,7 @@ - public boolean field_70132_H; + public boolean field_70124_G; public boolean field_70133_I; - protected Vec3d field_213328_B = Vec3d.field_186680_a; + protected Vector3d field_213328_B = Vector3d.field_186680_a; + @Deprecated //Forge: Use isAlive, remove(boolean) and revive() instead of directly accessing this field. To allow the entity to react to and better control this information. public boolean field_70128_L; public float field_70141_P; public float field_70140_Q; -@@ -196,6 +198,7 @@ +@@ -198,6 +200,7 @@ private float field_213326_aJ; public Entity(EntityType p_i48580_1_, World p_i48580_2_) { @@ -47,7 +47,7 @@ protected void func_70065_x() { if (this.field_70170_p != null) { - for(double d0 = this.func_226278_cu_(); d0 > 0.0D && d0 < 256.0D; ++d0) { -+ for(double d0 = this.func_226278_cu_(); d0 > 0.0D && d0 < this.field_70170_p.func_201675_m().getHeight(); ++d0) { ++ for(double d0 = this.func_226278_cu_(); d0 > 0.0D && d0 < 256.0D/*TODO this.world.getDimension().getHeight()*/; ++d0) { this.func_70107_b(this.func_226277_ct_(), d0, this.func_226281_cx_()); if (this.field_70170_p.func_226669_j_(this)) { break; @@ -64,8 +64,8 @@ + this.invalidateCaps(); } - protected void func_213301_b(Pose p_213301_1_) { -@@ -323,6 +334,7 @@ + public void func_213301_b(Pose p_213301_1_) { +@@ -330,6 +341,7 @@ public void func_70107_b(double p_70107_1_, double p_70107_3_, double p_70107_5_) { this.func_226288_n_(p_70107_1_, p_70107_3_, p_70107_5_); @@ -73,16 +73,16 @@ float f = this.field_213325_aI.field_220315_a / 2.0F; float f1 = this.field_213325_aI.field_220316_b; this.func_174826_a(new AxisAlignedBB(p_70107_1_ - (double)f, p_70107_3_, p_70107_5_ - (double)f, p_70107_1_ + (double)f, p_70107_3_ + (double)f1, p_70107_5_ + (double)f)); -@@ -523,7 +535,7 @@ +@@ -542,7 +554,7 @@ - this.field_70140_Q = (float)((double)this.field_70140_Q + (double)MathHelper.func_76133_a(func_213296_b(vec3d)) * 0.6D); + this.field_70140_Q = (float)((double)this.field_70140_Q + (double)MathHelper.func_76133_a(func_213296_b(vector3d)) * 0.6D); this.field_82151_R = (float)((double)this.field_82151_R + (double)MathHelper.func_76133_a(d0 * d0 + d1 * d1 + d2 * d2) * 0.6D); - if (this.field_82151_R > this.field_70150_b && !blockstate.func_196958_f()) { + if (this.field_82151_R > this.field_70150_b && !blockstate.isAir(this.field_70170_p, blockpos)) { this.field_70150_b = this.func_203009_ad(); if (this.func_70090_H()) { Entity entity = this.func_184207_aI() && this.func_184179_bs() != null ? this.func_184179_bs() : this; -@@ -538,7 +550,7 @@ +@@ -557,7 +569,7 @@ } else { this.func_180429_a(blockpos, blockstate); } @@ -91,9 +91,21 @@ this.field_191959_ay = this.func_191954_d(this.field_82151_R); } } -@@ -582,11 +594,10 @@ - int j = MathHelper.func_76128_c(this.field_70163_u - (double)0.2F); - int k = MathHelper.func_76128_c(this.field_70161_v); +@@ -574,8 +586,9 @@ + + float f2 = this.func_225515_ai_(); + this.func_213317_d(this.func_213322_ci().func_216372_d((double)f2, 1.0D, (double)f2)); +- if (this.field_70170_p.func_234939_c_(this.func_174813_aQ().func_186664_h(0.001D)).noneMatch((p_233572_0_) -> { +- return p_233572_0_.func_235714_a_(BlockTags.field_232872_am_) || p_233572_0_.func_203425_a(Blocks.field_150353_l); ++ if (BlockPos.func_239581_a_(this.func_174813_aQ().func_186664_h(0.001D)).noneMatch((p_233572_0_) -> { ++ BlockState state = field_70170_p.func_180495_p(p_233572_0_); ++ return state.func_235714_a_(BlockTags.field_232872_am_) || state.func_203425_a(Blocks.field_150353_l) || state.isBurning(field_70170_p, p_233572_0_); + }) && this.field_190534_ay <= 0) { + this.func_241209_g_(-this.func_190531_bD()); + } +@@ -594,11 +607,10 @@ + int j = MathHelper.func_76128_c(this.field_233557_ao_.field_72448_b - (double)0.2F); + int k = MathHelper.func_76128_c(this.field_233557_ao_.field_72449_c); BlockPos blockpos = new BlockPos(i, j, k); - if (this.field_70170_p.func_180495_p(blockpos).func_196958_f()) { + if (this.field_70170_p.func_175623_d(blockpos)) { @@ -105,7 +117,7 @@ return blockpos1; } } -@@ -770,6 +781,7 @@ +@@ -784,6 +796,7 @@ public void func_174829_m() { AxisAlignedBB axisalignedbb = this.func_174813_aQ(); this.func_226288_n_((axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D, axisalignedbb.field_72338_b, (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D); @@ -113,37 +125,28 @@ } protected SoundEvent func_184184_Z() { -@@ -822,7 +834,7 @@ +@@ -832,7 +845,7 @@ protected void func_180429_a(BlockPos p_180429_1_, BlockState p_180429_2_) { if (!p_180429_2_.func_185904_a().func_76224_d()) { BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()); -- SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.func_215695_r() : p_180429_2_.func_215695_r(); -+ SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.getSoundType(field_70170_p, p_180429_1_, this) : p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this); +- SoundType soundtype = blockstate.func_203425_a(Blocks.field_150433_aE) ? blockstate.func_215695_r() : p_180429_2_.func_215695_r(); ++ SoundType soundtype = blockstate.func_203425_a(Blocks.field_150433_aE) ? blockstate.getSoundType(field_70170_p, p_180429_1_, this) : p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this); this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b()); } } -@@ -1019,9 +1031,10 @@ +@@ -1048,9 +1061,10 @@ int k = MathHelper.func_76128_c(this.func_226281_cx_()); BlockPos blockpos = new BlockPos(i, j, k); BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); -+ if (!blockstate.addRunningEffects(field_70170_p, blockpos, this)) ++ if(!blockstate.addRunningEffects(field_70170_p, blockpos, this)) if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) { - Vec3d vec3d = this.func_213322_ci(); -- this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate), this.func_226277_ct_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vec3d.field_72450_a * -4.0D, 1.5D, vec3d.field_72449_c * -4.0D); -+ this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate).setPos(blockpos), this.func_226277_ct_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vec3d.field_72450_a * -4.0D, 1.5D, vec3d.field_72449_c * -4.0D); + Vector3d vector3d = this.func_213322_ci(); +- this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate), this.func_226277_ct_() + (this.field_70146_Z.nextDouble() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + (this.field_70146_Z.nextDouble() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vector3d.field_72450_a * -4.0D, 1.5D, vector3d.field_72449_c * -4.0D); ++ this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate).setPos(blockpos), this.func_226277_ct_() + (this.field_70146_Z.nextDouble() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + (this.field_70146_Z.nextDouble() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vector3d.field_72450_a * -4.0D, 1.5D, vector3d.field_72449_c * -4.0D); } } -@@ -1040,7 +1053,7 @@ - return false; - } else { - IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos); -- return ifluidstate.func_206884_a(p_213290_1_) && d0 < (double)((float)blockpos.func_177956_o() + ifluidstate.func_215679_a(this.field_70170_p, blockpos) + 0.11111111F); -+ return ifluidstate.isEntityInside(field_70170_p, blockpos, this, d0, p_213290_1_, true); - } - } - } -@@ -1330,6 +1343,7 @@ +@@ -1356,6 +1370,7 @@ if (this.field_184238_ar) { p_189511_1_.func_74757_a("Glowing", this.field_184238_ar); } @@ -151,7 +154,7 @@ if (!this.field_184236_aF.isEmpty()) { ListNBT listnbt = new ListNBT(); -@@ -1341,6 +1355,10 @@ +@@ -1367,6 +1382,10 @@ p_189511_1_.func_218657_a("Tags", listnbt); } @@ -162,7 +165,7 @@ this.func_213281_b(p_189511_1_); if (this.func_184207_aI()) { ListNBT listnbt1 = new ListNBT(); -@@ -1409,6 +1427,9 @@ +@@ -1437,6 +1456,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")); @@ -171,8 +174,8 @@ + if (p_70020_1_.func_150297_b("ForgeCaps", 10)) deserializeCaps(p_70020_1_.func_74775_l("ForgeCaps")); if (p_70020_1_.func_150297_b("Tags", 9)) { this.field_184236_aF.clear(); - ListNBT listnbt1 = p_70020_1_.func_150295_c("Tags", 8); -@@ -1497,6 +1518,8 @@ + ListNBT listnbt3 = p_70020_1_.func_150295_c("Tags", 8); +@@ -1525,6 +1547,8 @@ } else { ItemEntity itementity = new ItemEntity(this.field_70170_p, this.func_226277_ct_(), this.func_226278_cu_() + (double)p_70099_2_, this.func_226281_cx_(), p_70099_1_); itementity.func_174869_p(); @@ -181,15 +184,15 @@ this.field_70170_p.func_217376_c(itementity); return itementity; } -@@ -1540,6 +1563,7 @@ +@@ -1558,6 +1582,7 @@ public void func_70098_U() { - this.func_213317_d(Vec3d.field_186680_a); + this.func_213317_d(Vector3d.field_186680_a); + if (canUpdate()) this.func_70071_h_(); if (this.func_184218_aH()) { this.func_184187_bx().func_184232_k(this); -@@ -1584,6 +1608,7 @@ +@@ -1603,6 +1628,7 @@ } } @@ -197,15 +200,15 @@ if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) { if (this.func_184218_aH()) { this.func_184210_p(); -@@ -1615,6 +1640,7 @@ - public void func_184210_p() { +@@ -1635,6 +1661,7 @@ + public void func_233575_bb_() { if (this.field_184239_as != null) { Entity entity = this.field_184239_as; + if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entity, false)) return; this.field_184239_as = null; entity.func_184225_p(this); } -@@ -1771,6 +1797,7 @@ +@@ -1799,6 +1826,7 @@ return !this.func_184188_bt().isEmpty(); } @@ -213,7 +216,7 @@ public boolean func_205710_ba() { return true; } -@@ -1989,7 +2016,7 @@ +@@ -2015,7 +2043,7 @@ } protected ITextComponent func_225513_by_() { @@ -222,85 +225,11 @@ } public boolean func_70028_i(Entity p_70028_1_) { -@@ -2046,6 +2073,11 @@ - - @Nullable - public Entity func_212321_a(DimensionType p_212321_1_) { -+ return this.changeDimension(p_212321_1_, func_184102_h().func_71218_a(p_212321_1_).func_85176_s()); -+ } -+ @Nullable -+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null; - if (!this.field_70170_p.field_72995_K && !this.field_70128_L) { - this.field_70170_p.func_217381_Z().func_76320_a("changeDimension"); - MinecraftServer minecraftserver = this.func_184102_h(); -@@ -2055,6 +2087,7 @@ - this.field_71093_bK = p_212321_1_; - this.func_213319_R(); - this.field_70170_p.func_217381_Z().func_76320_a("reposition"); -+ Entity transportedEntity = teleporter.placeEntity(this, serverworld, serverworld1, this.field_70177_z, spawnPortal -> { //Forge: Start vanilla logic - Vec3d vec3d = this.func_213322_ci(); - float f = 0.0F; - BlockPos blockpos; -@@ -2063,16 +2096,9 @@ - } else if (p_212321_1_ == DimensionType.field_223229_c_) { - blockpos = serverworld1.func_180504_m(); - } else { -- double d0 = this.func_226277_ct_(); -- double d1 = this.func_226281_cx_(); -- double d2 = 8.0D; -- if (dimensiontype == DimensionType.field_223227_a_ && p_212321_1_ == DimensionType.field_223228_b_) { -- d0 /= 8.0D; -- d1 /= 8.0D; -- } else if (dimensiontype == DimensionType.field_223228_b_ && p_212321_1_ == DimensionType.field_223227_a_) { -- d0 *= 8.0D; -- d1 *= 8.0D; -- } -+ double movementFactor = serverworld.func_201675_m().getMovementFactor() / serverworld1.func_201675_m().getMovementFactor(); -+ double d0 = this.func_226277_ct_() * movementFactor; -+ double d1 = this.func_226281_cx_() * movementFactor; - - double d3 = Math.min(-2.9999872E7D, serverworld1.func_175723_af().func_177726_b() + 16.0D); - double d4 = Math.min(-2.9999872E7D, serverworld1.func_175723_af().func_177736_c() + 16.0D); -@@ -2082,6 +2108,7 @@ - d1 = MathHelper.func_151237_a(d1, d4, d6); - Vec3d vec3d1 = this.func_181014_aG(); - blockpos = new BlockPos(d0, this.func_226278_cu_(), d1); -+ if (spawnPortal) { - BlockPattern.PortalInfo blockpattern$portalinfo = serverworld1.func_85176_s().func_222272_a(blockpos, vec3d, this.func_181012_aH(), vec3d1.field_72450_a, vec3d1.field_72448_b, this instanceof PlayerEntity); - if (blockpattern$portalinfo == null) { - return null; -@@ -2090,6 +2117,7 @@ - blockpos = new BlockPos(blockpattern$portalinfo.field_222505_a); - vec3d = blockpattern$portalinfo.field_222506_b; - f = (float)blockpattern$portalinfo.field_222507_c; -+ } - } - - this.field_70170_p.func_217381_Z().func_219895_b("reloading"); -@@ -2100,13 +2128,15 @@ - entity.func_213317_d(vec3d); - serverworld1.func_217460_e(entity); - } -+ return entity; -+ });//Forge: End vanilla logic - -- this.field_70128_L = true; -+ this.remove(false); - this.field_70170_p.func_217381_Z().func_76319_b(); - serverworld.func_82742_i(); - serverworld1.func_82742_i(); - this.field_70170_p.func_217381_Z().func_76319_b(); -- return entity; -+ return transportedEntity; - } else { - return null; - } -@@ -2129,10 +2159,12 @@ +@@ -2159,10 +2187,12 @@ } - public Vec3d func_181014_aG() { -+ if (this.field_181017_ao == null) return Vec3d.field_186680_a; + public Vector3d func_181014_aG() { ++ if (this.field_181017_ao == null) return Vector3d.field_186680_a; return this.field_181017_ao; } @@ -309,7 +238,7 @@ return this.field_181018_ap; } -@@ -2261,7 +2293,7 @@ +@@ -2295,7 +2325,7 @@ Pose pose = this.func_213283_Z(); EntitySize entitysize1 = this.func_213305_a(pose); this.field_213325_aI = entitysize1; @@ -318,15 +247,15 @@ if (entitysize1.field_220315_a < entitysize.field_220315_a) { double d0 = (double)entitysize1.field_220315_a / 2.0D; this.func_174826_a(new AxisAlignedBB(this.func_226277_ct_() - d0, this.func_226278_cu_(), this.func_226281_cx_() - d0, this.func_226277_ct_() + d0, this.func_226278_cu_() + (double)entitysize1.field_220316_b, this.func_226281_cx_() + d0)); -@@ -2713,6 +2745,7 @@ - this.field_70165_t = p_226288_1_; - this.field_70163_u = p_226288_3_; - this.field_70161_v = p_226288_5_; -+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && !this.field_70128_L) this.field_70170_p.func_212866_a_((int) Math.floor(this.field_70165_t) >> 4, (int) Math.floor(this.field_70161_v) >> 4); // Forge - ensure target chunk is loaded. +@@ -2769,6 +2799,7 @@ + + this.field_233555_aA_ = true; + } ++ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && !this.field_70128_L) this.field_70170_p.func_212866_a_((int) Math.floor(p_226288_1_) >> 4, (int) Math.floor(p_226288_5_) >> 4); // Forge - ensure target chunk is loaded. + } - public void func_70623_bb() { -@@ -2726,4 +2759,69 @@ +@@ -2779,4 +2810,69 @@ public interface IMoveCallback { void accept(Entity p_accept_1_, double p_accept_2_, double p_accept_4_, double p_accept_6_); } diff --git a/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch b/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch index 0e2aa4040..74f2ec45f 100644 --- a/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch @@ -1,20 +1,13 @@ --- 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() { +@@ -57,6 +57,10 @@ 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"); + } - } ++ + public int func_233671_f_() { + return this.field_233669_n_; + } diff --git a/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch b/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch index 2a51a8f7f..0b567c859 100644 --- a/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/EntitySpawnPlacementRegistry.java +++ b/net/minecraft/entity/EntitySpawnPlacementRegistry.java -@@ -141,9 +141,25 @@ +@@ -147,10 +147,26 @@ boolean test(EntityType p_test_1_, IWorld p_test_2_, SpawnReason p_test_3_, BlockPos p_test_4_, Random p_test_5_); } @@ -8,22 +8,23 @@ + public static enum PlacementType implements net.minecraftforge.common.IExtensibleEnum { ON_GROUND, IN_WATER, - NO_RESTRICTIONS; + NO_RESTRICTIONS, + IN_LAVA; + + public static PlacementType create(String name, net.minecraftforge.common.util.TriPredicate> predicate) { -+ throw new IllegalStateException("Enum not extended"); ++ throw new IllegalStateException("Enum not extended"); + } + + private net.minecraftforge.common.util.TriPredicate> predicate; + private PlacementType() { this(null); } + private PlacementType(net.minecraftforge.common.util.TriPredicate> predicate) { -+ this.predicate = predicate; ++ this.predicate = predicate; + } + + public boolean canSpawnAt(net.minecraft.world.IWorldReader world, BlockPos pos, EntityType type) { -+ if (this == NO_RESTRICTIONS) return true; -+ if (predicate == null) return net.minecraft.world.spawner.WorldEntitySpawner.canSpawnAtBody(this, world, pos, type); -+ return predicate.test(world, pos, type); ++ if (this == NO_RESTRICTIONS) return true; ++ 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/EntityType.java.patch b/patches/minecraft/net/minecraft/entity/EntityType.java.patch index bb79ef355..151cc4c8a 100644 --- a/patches/minecraft/net/minecraft/entity/EntityType.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityType.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/entity/EntityType.java +++ b/net/minecraft/entity/EntityType.java -@@ -135,7 +135,7 @@ +@@ -141,7 +141,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_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,12 @@ + 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).func_233606_a_(10).func_233608_b_(Integer.MAX_VALUE)); + 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).func_233606_a_(10)); +@@ -267,6 +267,12 @@ private ResourceLocation field_220358_bg; private final EntitySize field_220359_bi; @@ -17,27 +17,25 @@ + private final java.util.function.ToIntFunction> trackingRangeSupplier; + private final java.util.function.ToIntFunction> updateIntervalSupplier; + private final java.util.function.BiFunction customClientFactory; -+ private final net.minecraftforge.common.util.ReverseTagWrapper> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.EntityTypeTags::getGeneration, net.minecraft.tags.EntityTypeTags::func_219762_a); ++ private final net.minecraftforge.common.util.ReverseTagWrapper> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.EntityTypeTags::func_219762_a); + 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 +272,11 @@ - return Registry.field_212629_r.func_218349_b(ResourceLocation.func_208304_a(p_220327_0_)); +@@ -280,6 +286,9 @@ } -+ - public EntityType(EntityType.IFactory p_i51559_1_, EntityClassification p_i51559_2_, boolean p_i51559_3_, boolean p_i51559_4_, boolean p_i51559_5_, boolean p_i51559_6_, EntitySize p_i51559_7_) { -+ this(p_i51559_1_, p_i51559_2_, p_i51559_3_, p_i51559_4_, p_i51559_5_, p_i51559_6_, p_i51559_7_, EntityType::defaultVelocitySupplier, EntityType::defaultTrackingRangeSupplier, EntityType::defaultUpdateIntervalSupplier, null); + public EntityType(EntityType.IFactory p_i231489_1_, EntityClassification p_i231489_2_, boolean p_i231489_3_, boolean p_i231489_4_, boolean p_i231489_5_, boolean p_i231489_6_, ImmutableSet p_i231489_7_, EntitySize p_i231489_8_, int p_i231489_9_, int p_i231489_10_) { ++ this(p_i231489_1_, p_i231489_2_, p_i231489_3_, p_i231489_4_, p_i231489_5_, p_i231489_6_, p_i231489_7_, p_i231489_8_, p_i231489_9_, p_i231489_10_, EntityType::defaultVelocitySupplier, EntityType::defaultTrackingRangeSupplier, EntityType::defaultUpdateIntervalSupplier, null); + } -+ public EntityType(EntityType.IFactory p_i51559_1_, EntityClassification p_i51559_2_, boolean p_i51559_3_, boolean p_i51559_4_, boolean p_i51559_5_, boolean p_i51559_6_, EntitySize p_i51559_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_i51559_1_; - this.field_220355_ba = p_i51559_2_; - this.field_225438_be = p_i51559_6_; -@@ -274,6 +284,10 @@ - this.field_200734_aM = p_i51559_4_; - this.field_220357_bd = p_i51559_5_; - this.field_220359_bi = p_i51559_7_; ++ public EntityType(EntityType.IFactory p_i231489_1_, EntityClassification p_i231489_2_, boolean p_i231489_3_, boolean p_i231489_4_, boolean p_i231489_5_, boolean p_i231489_6_, ImmutableSet p_i231489_7_, EntitySize p_i231489_8_, int p_i231489_9_, int p_i231489_10_, 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_i231489_1_; + this.field_220355_ba = p_i231489_2_; + this.field_225438_be = p_i231489_6_; +@@ -290,6 +299,10 @@ + this.field_220359_bi = p_i231489_8_; + this.field_233594_bl_ = p_i231489_9_; + this.field_233595_bm_ = p_i231489_10_; + this.velocityUpdateSupplier = velocityUpdateSupplier; + this.trackingRangeSupplier = trackingRangeSupplier; + this.updateIntervalSupplier = updateIntervalSupplier; @@ -45,7 +43,7 @@ } @Nullable -@@ -284,6 +298,7 @@ +@@ -300,6 +313,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_); @@ -53,27 +51,21 @@ p_220342_1_.func_217376_c(t); return t; } -@@ -466,6 +481,9 @@ +@@ -498,14 +512,23 @@ } - public int func_220345_k() { + public int func_233602_m_() { + return trackingRangeSupplier.applyAsInt(this); + } + private int defaultTrackingRangeSupplier() { - if (this == field_200729_aH) { - return 32; - } else if (this == field_200801_o) { -@@ -478,6 +496,9 @@ + return this.field_233594_bl_; } 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; -@@ -498,6 +519,9 @@ + return this.field_233595_bm_; } public boolean func_220340_m() { @@ -83,13 +75,13 @@ 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; } -@@ -505,12 +529,30 @@ - return p_220341_1_.func_199685_a_(this); +@@ -513,6 +536,19 @@ + return p_220341_1_.func_230235_a_(this); } + public T customClientSpawn(net.minecraftforge.fml.network.FMLPlayMessages.SpawnEntity packet, World world) { -+ if (customClientFactory == null) return this.func_200721_a(world); -+ return customClientFactory.apply(packet, world); ++ if (customClientFactory == null) return this.func_200721_a(world); ++ return customClientFactory.apply(packet, world); + } + + /** @@ -97,40 +89,41 @@ + * This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes. + */ + public java.util.Set getTags() { -+ return reverseTags.getTagNames(); ++ return reverseTags.getTagNames(); + } + public static class Builder { 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 field_220325_e; +@@ -525,6 +561,11 @@ + private int field_233605_i_ = 3; + private EntitySize field_220326_f = EntitySize.func_220314_b(0.6F, 1.8F); + + 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 boolean field_225436_f; - private EntitySize field_220326_f = EntitySize.func_220314_b(0.6F, 1.8F); - -@@ -555,11 +597,35 @@ + private Builder(EntityType.IFactory p_i50479_1_, EntityClassification p_i50479_2_) { + this.field_200709_a = p_i50479_1_; + this.field_220324_b = p_i50479_2_; +@@ -581,12 +622,36 @@ return this; } + public EntityType.Builder setUpdateInterval(int interval) { -+ this.updateIntervalSupplier = t->interval; -+ return this; ++ this.updateIntervalSupplier = t->interval; ++ return this; + } + + public EntityType.Builder setTrackingRange(int range) { -+ this.trackingRangeSupplier = t->range; -+ return this; ++ this.trackingRangeSupplier = t->range; ++ return this; + } + + public EntityType.Builder setShouldReceiveVelocityUpdates(boolean value) { -+ this.velocityUpdateSupplier = t->value; -+ return this; ++ this.velocityUpdateSupplier = t->value; ++ return this; + } + + /** @@ -138,25 +131,17 @@ + * If you need finer control over the spawning process, use this to get read access to the spawn packet. + */ + public EntityType.Builder setCustomClientFactory(java.util.function.BiFunction customClientFactory) { -+ this.customClientFactory = customClientFactory; -+ return this; ++ this.customClientFactory = customClientFactory; ++ return this; + } + public EntityType func_206830_a(String p_206830_1_) { if (this.field_200710_b) { - try { - 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) { // Forge: fix catching wrong exception - if (SharedConstants.field_206244_b) { - throw illegalstateexception; - } -@@ -568,7 +634,7 @@ - } + Util.func_240976_a_(TypeReferences.field_211298_n, p_206830_1_); } -- return new EntityType<>(this.field_200709_a, this.field_220324_b, this.field_200710_b, this.field_200711_c, this.field_220325_e, this.field_225436_f, 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, this.field_225436_f, this.field_220326_f, velocityUpdateSupplier, trackingRangeSupplier, updateIntervalSupplier, customClientFactory); +- return new EntityType<>(this.field_200709_a, this.field_220324_b, this.field_200710_b, this.field_200711_c, this.field_220325_e, this.field_225436_f, this.field_233603_c_, this.field_220326_f, this.field_233604_h_, this.field_233605_i_); ++ return new EntityType<>(this.field_200709_a, this.field_220324_b, this.field_200710_b, this.field_200711_c, this.field_220325_e, this.field_225436_f, this.field_233603_c_, this.field_220326_f, this.field_233604_h_, this.field_233605_i_, velocityUpdateSupplier, trackingRangeSupplier, updateIntervalSupplier, customClientFactory); } } diff --git a/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch b/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch index dcb9a4cc8..27a05b03c 100644 --- a/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/FlyingEntity.java +++ b/net/minecraft/entity/FlyingEntity.java -@@ -28,15 +28,16 @@ +@@ -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 { diff --git a/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch b/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch index 9323e64c2..27c3fa41f 100644 --- a/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch @@ -1,29 +1,35 @@ --- a/net/minecraft/entity/LivingEntity.java +++ b/net/minecraft/entity/LivingEntity.java -@@ -109,7 +109,12 @@ - +@@ -116,7 +116,9 @@ public abstract class LivingEntity extends Entity { private static final UUID field_110156_b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); + private static final UUID field_233625_c_ = UUID.fromString("87f46a96-686f-4796-b035-22e16ee9e038"); + private static final UUID SLOW_FALLING_ID = UUID.fromString("A5B6CF2A-2F7C-31EF-9022-7C3E7D5E6ABA"); - private static final AttributeModifier field_110157_c = (new AttributeModifier(field_110156_b, "Sprinting speed boost", (double)0.3F, AttributeModifier.Operation.MULTIPLY_TOTAL)).func_111168_a(false); -+ private static final AttributeModifier SLOW_FALLING = new AttributeModifier(SLOW_FALLING_ID, "Slow falling acceleration reduction", -0.07, AttributeModifier.Operation.ADDITION).func_111168_a(false); // Add -0.07 to 0.08 so we get the vanilla default of 0.01 -+ public static final net.minecraft.entity.ai.attributes.IAttribute SWIM_SPEED = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.swimSpeed", 1.0D, 0.0D, 1024.0D).func_111112_a(true); -+ public static final net.minecraft.entity.ai.attributes.IAttribute NAMETAG_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.nameTagDistance", 64.0D, 0.0D, Float.MAX_VALUE).func_111112_a(true); -+ public static final net.minecraft.entity.ai.attributes.IAttribute ENTITY_GRAVITY = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.entity_gravity", 0.08D, -8.0D, 8.0D).func_111112_a(true); + private static final AttributeModifier field_110157_c = new AttributeModifier(field_110156_b, "Sprinting speed boost", (double)0.3F, AttributeModifier.Operation.MULTIPLY_TOTAL); ++ private static final AttributeModifier SLOW_FALLING = new AttributeModifier(SLOW_FALLING_ID, "Slow falling acceleration reduction", -0.07, AttributeModifier.Operation.ADDITION); // Add -0.07 to 0.08 so we get the vanilla default of 0.01 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); -@@ -235,6 +240,9 @@ - this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_111263_d); - this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188791_g); - this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_189429_h); -+ this.func_110140_aT().func_111150_b(SWIM_SPEED); -+ this.func_110140_aT().func_111150_b(NAMETAG_DISTANCE); -+ this.func_110140_aT().func_111150_b(ENTITY_GRAVITY); +@@ -124,6 +126,9 @@ + private static final DataParameter field_184635_h = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187192_b); + private static final DataParameter field_226291_bp_ = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187192_b); + private static final DataParameter> field_213379_bs = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187201_k); ++ public static final net.minecraft.entity.ai.attributes.Attribute SWIM_SPEED = new net.minecraft.entity.ai.attributes.RangedAttribute("forge.swimSpeed", 1.0D, 0.0D, 1024.0D).func_233753_a_(true); ++ public static final net.minecraft.entity.ai.attributes.Attribute NAMETAG_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute("forge.nameTagDistance", 64.0D, 0.0D, Float.MAX_VALUE).func_233753_a_(true); ++ public static final net.minecraft.entity.ai.attributes.Attribute ENTITY_GRAVITY = new net.minecraft.entity.ai.attributes.RangedAttribute("forge.entity_gravity", 0.08D, -8.0D, 8.0D).func_233753_a_(true); + protected static final EntitySize field_213377_as = EntitySize.func_220311_c(0.2F, 0.2F); + private final AttributeModifierManager field_110155_d; + private final CombatTracker field_94063_bt = new CombatTracker(this); +@@ -244,7 +249,7 @@ + } + + public static AttributeModifierMap.MutableAttribute func_233639_cI_() { +- return AttributeModifierMap.func_233803_a_().func_233814_a_(Attributes.field_233818_a_).func_233814_a_(Attributes.field_233820_c_).func_233814_a_(Attributes.field_233821_d_).func_233814_a_(Attributes.field_233826_i_).func_233814_a_(Attributes.field_233827_j_); ++ return AttributeModifierMap.func_233803_a_().func_233814_a_(Attributes.field_233818_a_).func_233814_a_(Attributes.field_233820_c_).func_233814_a_(Attributes.field_233821_d_).func_233814_a_(Attributes.field_233826_i_).func_233814_a_(Attributes.field_233827_j_).func_233814_a_(SWIM_SPEED).func_233814_a_(NAMETAG_DISTANCE).func_233814_a_(ENTITY_GRAVITY); } protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, BlockState p_184231_4_, BlockPos p_184231_5_) { -@@ -244,9 +252,10 @@ +@@ -259,9 +264,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); @@ -35,7 +41,7 @@ ((ServerWorld)this.field_70170_p).func_195598_a(new BlockParticleData(ParticleTypes.field_197611_d, p_184231_4_), this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), i, 0.0D, 0.0D, 0.0D, (double)0.15F); } } -@@ -310,7 +319,7 @@ +@@ -329,7 +335,7 @@ } } @@ -44,7 +50,7 @@ this.func_184210_p(); } } else if (this.func_70086_ai() < this.func_205010_bg()) { -@@ -392,7 +401,7 @@ +@@ -474,7 +480,7 @@ protected void func_70609_aI() { ++this.field_70725_aQ; if (this.field_70725_aQ == 20) { @@ -53,7 +59,7 @@ for(int i = 0; i < 20; ++i) { double d0 = this.field_70146_Z.nextGaussian() * 0.02D; -@@ -573,7 +582,7 @@ +@@ -667,7 +673,7 @@ if (!effectinstance.func_76455_a(this, () -> { this.func_70695_b(effectinstance, true); })) { @@ -62,7 +68,7 @@ iterator.remove(); this.func_70688_c(effectinstance); } -@@ -623,8 +632,10 @@ +@@ -716,8 +722,10 @@ this.func_82142_c(false); } else { Collection collection = this.field_70713_bf.values(); @@ -75,7 +81,7 @@ this.func_82142_c(this.func_70644_a(Effects.field_76441_p)); } -@@ -688,7 +699,9 @@ +@@ -781,7 +789,9 @@ boolean flag; for(flag = false; iterator.hasNext(); flag = true) { @@ -86,7 +92,7 @@ iterator.remove(); } -@@ -718,6 +731,7 @@ +@@ -811,6 +821,7 @@ return false; } else { EffectInstance effectinstance = this.field_70713_bf.get(p_195064_1_.func_188419_a()); @@ -94,7 +100,7 @@ if (effectinstance == null) { this.field_70713_bf.put(p_195064_1_.func_188419_a(), p_195064_1_); this.func_70670_a(p_195064_1_); -@@ -732,6 +746,9 @@ +@@ -825,6 +836,9 @@ } public boolean func_70687_e(EffectInstance p_70687_1_) { @@ -104,7 +110,7 @@ if (this.func_70668_bt() == CreatureAttribute.field_223223_b_) { Effect effect = p_70687_1_.func_188419_a(); if (effect == Effects.field_76428_l || effect == Effects.field_76436_u) { -@@ -752,6 +769,7 @@ +@@ -858,6 +872,7 @@ } public boolean func_195063_d(Effect p_195063_1_) { @@ -112,7 +118,7 @@ EffectInstance effectinstance = this.func_184596_c(p_195063_1_); if (effectinstance != null) { this.func_70688_c(effectinstance); -@@ -788,6 +806,8 @@ +@@ -894,6 +909,8 @@ } public void func_70691_i(float p_70691_1_) { @@ -121,7 +127,7 @@ float f = this.func_110143_aJ(); if (f > 0.0F) { this.func_70606_j(f + p_70691_1_); -@@ -804,6 +824,7 @@ +@@ -914,6 +931,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -129,7 +135,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; } else if (this.field_70170_p.field_72995_K) { -@@ -870,8 +891,8 @@ +@@ -980,8 +998,8 @@ if (entity1 instanceof PlayerEntity) { this.field_70718_bc = 100; this.field_70717_bb = (PlayerEntity)entity1; @@ -140,7 +146,7 @@ if (wolfentity.func_70909_n()) { this.field_70718_bc = 100; LivingEntity livingentity = wolfentity.func_70902_q(); -@@ -1053,6 +1074,7 @@ +@@ -1163,6 +1181,7 @@ } public void func_70645_a(DamageSource p_70645_1_) { @@ -148,20 +154,7 @@ if (!this.field_70128_L && !this.field_70729_aU) { Entity entity = p_70645_1_.func_76346_g(); LivingEntity livingentity = this.func_94060_bK(); -@@ -1084,10 +1106,10 @@ - if (!this.field_70170_p.field_72995_K) { - boolean flag = false; - if (p_226298_1_ instanceof WitherEntity) { -- if (this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { - BlockPos blockpos = new BlockPos(this); - BlockState blockstate = Blocks.field_222388_bz.func_176223_P(); -- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f() && blockstate.func_196955_c(this.field_70170_p, blockpos)) { -+ if (this.field_70170_p.func_175623_d(blockpos) && blockstate.func_196955_c(this.field_70170_p, blockpos)) { - this.field_70170_p.func_180501_a(blockpos, blockstate, 3); - flag = true; - } -@@ -1104,13 +1126,10 @@ +@@ -1214,13 +1233,10 @@ protected void func_213345_d(DamageSource p_213345_1_) { Entity entity = p_213345_1_.func_76346_g(); @@ -176,9 +169,9 @@ + this.captureDrops(new java.util.ArrayList<>()); + boolean flag = this.field_70718_bc > 0; - if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e)) { + if (this.func_230282_cS_() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e)) { this.func_213354_a(p_213345_1_, flag); -@@ -1119,6 +1138,10 @@ +@@ -1229,6 +1245,10 @@ this.func_213337_cE(); this.func_226294_cV_(); @@ -189,7 +182,7 @@ } protected void func_213337_cE() { -@@ -1128,6 +1151,7 @@ +@@ -1238,6 +1258,7 @@ if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e))) { int i = this.func_70693_a(this.field_70717_bb); @@ -197,7 +190,7 @@ while(i > 0) { int j = ExperienceOrbEntity.func_70527_a(i); i -= j; -@@ -1135,6 +1159,7 @@ +@@ -1245,6 +1266,7 @@ } } @@ -205,7 +198,7 @@ } protected void func_213333_a(DamageSource p_213333_1_, int p_213333_2_, boolean p_213333_3_) { -@@ -1148,7 +1173,8 @@ +@@ -1258,7 +1280,8 @@ ResourceLocation resourcelocation = this.func_213346_cF(); LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(resourcelocation); LootContext.Builder lootcontext$builder = this.func_213363_a(p_213354_2_, p_213354_1_); @@ -215,31 +208,20 @@ } protected LootContext.Builder func_213363_a(boolean p_213363_1_, DamageSource p_213363_2_) { -@@ -1161,6 +1187,9 @@ +@@ -1271,6 +1294,12 @@ } - public void func_70653_a(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) { -+ net.minecraftforge.event.entity.living.LivingKnockBackEvent event = net.minecraftforge.common.ForgeHooks.onLivingKnockBack(this, p_70653_1_, p_70653_2_, p_70653_3_, p_70653_5_); + public void func_233627_a_(float p_233627_1_, double p_233627_2_, double p_233627_4_) { ++ //TODO, Vanilla removed the attacker entity from this method, 1.15-mcp: knockBack ++ net.minecraftforge.event.entity.living.LivingKnockBackEvent event = net.minecraftforge.common.ForgeHooks.onLivingKnockBack(this, null, p_233627_1_, p_233627_2_, p_233627_4_); + if(event.isCanceled()) return; -+ p_70653_2_ = event.getStrength(); p_70653_3_ = event.getRatioX(); p_70653_5_ = event.getRatioZ(); - if (!(this.field_70146_Z.nextDouble() < this.func_110148_a(SharedMonsterAttributes.field_111266_c).func_111126_e())) { ++ p_233627_1_ = event.getStrength(); ++ p_233627_2_ = event.getRatioX(); ++ p_233627_4_ = event.getRatioZ(); + p_233627_1_ = (float)((double)p_233627_1_ * (1.0D - this.func_233637_b_(Attributes.field_233820_c_))); + if (!(p_233627_1_ <= 0.0F)) { this.field_70160_al = true; - Vec3d vec3d = this.func_213322_ci(); -@@ -1196,12 +1225,7 @@ - return false; - } else { - BlockState blockstate = this.func_213339_cH(); -- Block block = blockstate.func_177230_c(); -- if (block != Blocks.field_150468_ap && block != Blocks.field_150395_bd && block != Blocks.field_222420_lI) { -- return block instanceof TrapDoorBlock && this.func_184604_a(new BlockPos(this), blockstate); -- } else { -- return true; -- } -+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, field_70170_p, new BlockPos(this), this); - } - } - -@@ -1225,6 +1249,11 @@ +@@ -1353,6 +1382,11 @@ } public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) { @@ -251,7 +233,7 @@ boolean flag = super.func_225503_b_(p_225503_1_, p_225503_2_); int i = this.func_225508_e_(p_225503_1_, p_225503_2_); if (i > 0) { -@@ -1248,9 +1277,10 @@ +@@ -1376,9 +1410,10 @@ int i = MathHelper.func_76128_c(this.func_226277_ct_()); int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F); int k = MathHelper.func_76128_c(this.func_226281_cx_()); @@ -265,7 +247,7 @@ this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F); } -@@ -1319,6 +1349,8 @@ +@@ -1446,6 +1481,8 @@ protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { if (!this.func_180431_b(p_70665_1_)) { @@ -274,7 +256,7 @@ p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); -@@ -1328,10 +1360,11 @@ +@@ -1455,10 +1492,11 @@ ((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f * 10.0F)); } @@ -287,7 +269,7 @@ this.func_110149_m(this.func_110139_bj() - f2); } } -@@ -1385,6 +1418,8 @@ +@@ -1512,6 +1550,8 @@ } public void func_226292_a_(Hand p_226292_1_, boolean p_226292_2_) { @@ -296,60 +278,32 @@ if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { this.field_110158_av = -1; this.field_82175_bq = true; -@@ -1771,15 +1806,16 @@ - } - - this.field_70160_al = true; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - @OnlyIn(Dist.CLIENT) - protected void func_203010_cG() { -- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F, 0.0D)); -+ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e(), 0.0D)); - } - - protected void func_180466_bG(Tag p_180466_1_) { -- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F, 0.0D)); -+ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e(), 0.0D)); - } - - protected float func_189749_co() { -@@ -1789,11 +1825,15 @@ - public void func_213352_e(Vec3d p_213352_1_) { +@@ -1868,11 +1908,15 @@ + public void func_213352_e(Vector3d p_213352_1_) { if (this.func_70613_aW() || this.func_184186_bw()) { double d0 = 0.08D; -+ IAttributeInstance gravity = this.func_110148_a(ENTITY_GRAVITY); ++ ModifiableAttributeInstance gravity = this.func_110148_a(ENTITY_GRAVITY); boolean flag = this.func_213322_ci().field_72448_b <= 0.0D; if (flag && this.func_70644_a(Effects.field_204839_B)) { - d0 = 0.01D; -+ if (!gravity.func_180374_a(SLOW_FALLING)) gravity.func_111121_a(SLOW_FALLING); ++ if (!gravity.func_180374_a(SLOW_FALLING)) gravity.func_233767_b_(SLOW_FALLING); this.field_70143_R = 0.0F; + } else if (gravity.func_180374_a(SLOW_FALLING)) { + gravity.func_111124_b(SLOW_FALLING); } + d0 = gravity.func_111126_e(); - if (!this.func_70090_H() || this instanceof PlayerEntity && ((PlayerEntity)this).field_71075_bZ.field_75100_b) { - if (!this.func_180799_ab() || this instanceof PlayerEntity && ((PlayerEntity)this).field_71075_bZ.field_75100_b) { -@@ -1842,7 +1882,7 @@ - } - } else { - BlockPos blockpos = this.func_226270_aj_(); -- float f5 = this.field_70170_p.func_180495_p(blockpos).func_177230_c().func_208618_m(); -+ float f5 = this.field_70170_p.func_180495_p(blockpos).getSlipperiness(field_70170_p, blockpos, this); - float f7 = this.field_70122_E ? f5 * 0.91F : 0.91F; - this.func_213309_a(this.func_213335_r(f5), p_213352_1_); - this.func_213317_d(this.func_213362_f(this.func_213322_ci())); -@@ -1904,6 +1944,7 @@ - f = 0.96F; + FluidState fluidstate = this.field_70170_p.func_204610_c(this.func_233580_cy_()); + if (this.func_70090_H() && this.func_241208_cS_() && !this.func_230285_a_(fluidstate.func_206886_c())) { +@@ -1897,6 +1941,7 @@ + f5 = 0.96F; } -+ f1 *= (float)this.func_110148_a(SWIM_SPEED).func_111126_e(); - this.func_213309_a(f1, p_213352_1_); ++ f6 *= (float)this.func_110148_a(SWIM_SPEED).func_111126_e(); + this.func_213309_a(f6, p_213352_1_); this.func_213315_a(MoverType.SELF, this.func_213322_ci()); - Vec3d vec3d1 = this.func_213322_ci(); -@@ -1979,6 +2020,7 @@ + Vector3d vector3d6 = this.func_213322_ci(); +@@ -2075,6 +2120,7 @@ } public void func_70071_h_() { @@ -357,42 +311,7 @@ super.func_70071_h_(); this.func_184608_ct(); this.func_205014_p(); -@@ -2022,7 +2064,9 @@ - - ItemStack itemstack1 = this.func_184582_a(equipmentslottype); - if (!ItemStack.func_77989_b(itemstack1, itemstack)) { -+ if (!itemstack1.equals(itemstack, true)) - ((ServerWorld)this.field_70170_p).func_72863_F().func_217218_b(this, new SEntityEquipmentPacket(this.func_145782_y(), equipmentslottype, itemstack1)); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent(this, equipmentslottype, itemstack, itemstack1)); - if (!itemstack.func_190926_b()) { - this.func_110140_aT().func_111148_a(itemstack.func_111283_C(equipmentslottype)); - } -@@ -2474,13 +2518,22 @@ - - private void func_184608_ct() { - if (this.func_184587_cr()) { -- if (ItemStack.func_185132_d(this.func_184586_b(this.func_184600_cs()), this.field_184627_bm)) { -+ ItemStack itemstack = this.func_184586_b(this.func_184600_cs()); -+ if (net.minecraftforge.common.ForgeHooks.canContinueUsing(this.field_184627_bm, itemstack)) this.field_184627_bm = itemstack; -+ if (itemstack == this.field_184627_bm) { -+ -+ if (!this.field_184627_bm.func_190926_b()) { -+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn); -+ if (field_184628_bn > 0) -+ field_184627_bm.onUsingTick(this, field_184628_bn); -+ } -+ - this.field_184627_bm.func_222121_b(this.field_70170_p, this, this.func_184605_cv()); - if (this.func_226299_p_()) { - this.func_226293_b_(this.field_184627_bm, 5); - } - -- if (--this.field_184628_bn == 0 && !this.field_70170_p.field_72995_K && !this.field_184627_bm.func_222122_m()) { -+ if (--this.field_184628_bn <= 0 && !this.field_70170_p.field_72995_K && !this.field_184627_bm.func_222122_m()) { - this.func_71036_o(); - } - } else { -@@ -2522,8 +2575,10 @@ +@@ -2707,8 +2753,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()) { @@ -404,17 +323,17 @@ if (!this.field_70170_p.field_72995_K) { this.func_204802_c(1, true); this.func_204802_c(2, p_184598_1_ == Hand.OFF_HAND); -@@ -2583,6 +2638,9 @@ - vec3d1 = vec3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F)); - vec3d1 = vec3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F)); - vec3d1 = vec3d1.func_72441_c(this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_()); +@@ -2768,6 +2816,9 @@ + vector3d1 = vector3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F)); + vector3d1 = vector3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F)); + vector3d1 = vector3d1.func_72441_c(this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_()); + 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); ++ ((ServerWorld)this.field_70170_p).func_195598_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vector3d1.field_72450_a, vector3d1.field_72448_b, vector3d1.field_72449_c, 1, vector3d.field_72450_a, vector3d.field_72448_b + 0.05D, vector3d.field_72449_c, 0.0D); + else - this.field_70170_p.func_195594_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c); + this.field_70170_p.func_195594_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vector3d1.field_72450_a, vector3d1.field_72448_b, vector3d1.field_72449_c, vector3d.field_72450_a, vector3d.field_72448_b + 0.05D, vector3d.field_72449_c); } -@@ -2594,7 +2652,9 @@ +@@ -2779,7 +2830,9 @@ } else { if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) { this.func_226293_b_(this.field_184627_bm, 16); @@ -425,7 +344,7 @@ this.func_184602_cy(); } -@@ -2615,7 +2675,11 @@ +@@ -2800,7 +2853,11 @@ public void func_184597_cx() { if (!this.field_184627_bm.func_190926_b()) { @@ -437,28 +356,7 @@ if (this.field_184627_bm.func_222122_m()) { this.func_184608_ct(); } -@@ -2772,16 +2836,16 @@ - - private boolean func_213359_p() { - return this.func_213374_dv().map((p_213347_1_) -> { -- return this.field_70170_p.func_180495_p(p_213347_1_).func_177230_c() instanceof BedBlock; -+ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, p_213347_1_); - }).orElse(false); - } - - public void func_213366_dy() { - this.func_213374_dv().filter(this.field_70170_p::func_175667_e).ifPresent((p_213368_1_) -> { - BlockState blockstate = this.field_70170_p.func_180495_p(p_213368_1_); -- if (blockstate.func_177230_c() instanceof BedBlock) { -- this.field_70170_p.func_180501_a(p_213368_1_, blockstate.func_206870_a(BedBlock.field_176471_b, Boolean.valueOf(false)), 3); -- Vec3d vec3d = BedBlock.func_220172_a(this.func_200600_R(), this.field_70170_p, p_213368_1_, 0).orElseGet(() -> { -+ if (blockstate.isBed(this.field_70170_p, p_213368_1_, this)) { -+ blockstate.setBedOccupied(field_70170_p, p_213368_1_, this, false); -+ Vec3d vec3d = blockstate.getBedSpawnPosition(this.func_200600_R(), field_70170_p, p_213368_1_, this).orElseGet(()-> { - BlockPos blockpos = p_213368_1_.func_177984_a(); - return new Vec3d((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.1D, (double)blockpos.func_177952_p() + 0.5D); - }); -@@ -2797,7 +2861,9 @@ +@@ -2993,7 +3050,9 @@ @OnlyIn(Dist.CLIENT) public Direction func_213376_dz() { BlockPos blockpos = this.func_213374_dv().orElse((BlockPos)null); @@ -469,7 +367,7 @@ } public boolean func_70094_T() { -@@ -2866,4 +2932,58 @@ +@@ -3062,4 +3121,58 @@ public void func_213334_d(Hand p_213334_1_) { this.func_213361_c(p_213334_1_ == Hand.MAIN_HAND ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND); } diff --git a/patches/minecraft/net/minecraft/entity/MobEntity.java.patch b/patches/minecraft/net/minecraft/entity/MobEntity.java.patch index f02a86a3f..1497d3db2 100644 --- a/patches/minecraft/net/minecraft/entity/MobEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/MobEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/MobEntity.java +++ b/net/minecraft/entity/MobEntity.java -@@ -176,6 +176,7 @@ +@@ -197,6 +197,7 @@ public void func_70624_b(@Nullable LivingEntity p_70624_1_) { this.field_70696_bz = p_70624_1_; @@ -8,16 +8,16 @@ } public boolean func_213358_a(EntityType p_213358_1_) { -@@ -460,7 +461,7 @@ +@@ -485,7 +486,7 @@ public void func_70636_d() { super.func_70636_d(); this.field_70170_p.func_217381_Z().func_76320_a("looting"); - if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && this.func_70089_S() && !this.field_70729_aU && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { + if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && this.func_70089_S() && !this.field_70729_aU && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { for(ItemEntity itementity : this.field_70170_p.func_217357_a(ItemEntity.class, this.func_174813_aQ().func_72314_b(1.0D, 0.0D, 1.0D))) { - if (!itementity.field_70128_L && !itementity.func_92059_d().func_190926_b() && !itementity.func_174874_s()) { + if (!itementity.field_70128_L && !itementity.func_92059_d().func_190926_b() && !itementity.func_174874_s() && this.func_230293_i_(itementity.func_92059_d())) { this.func_175445_a(itementity); -@@ -556,6 +557,14 @@ +@@ -638,6 +639,14 @@ this.func_70106_y(); } else if (!this.func_104002_bU() && !this.func_213392_I()) { Entity entity = this.field_70170_p.func_217362_a(this, -1.0D); @@ -31,8 +31,8 @@ + } if (entity != null) { double d0 = entity.func_70068_e(this); - if (d0 > 16384.0D && this.func_213397_c(d0)) { -@@ -791,6 +800,8 @@ + int i = this.func_200600_R().func_220339_d().func_233671_f_(); +@@ -877,6 +886,8 @@ } public static EquipmentSlotType func_184640_d(ItemStack p_184640_0_) { @@ -41,7 +41,7 @@ Item item = p_184640_0_.func_77973_b(); if (item != Blocks.field_196625_cS.func_199767_j() && (!(item instanceof BlockItem) || !(((BlockItem)item).func_179223_d() instanceof AbstractSkullBlock))) { if (item instanceof ArmorItem) { -@@ -798,7 +809,7 @@ +@@ -884,7 +895,7 @@ } else if (item == Items.field_185160_cR) { return EquipmentSlotType.CHEST; } else { @@ -50,16 +50,3 @@ } } else { return EquipmentSlotType.HEAD; -@@ -1178,10 +1189,10 @@ - PlayerEntity playerentity = (PlayerEntity)p_70652_1_; - ItemStack itemstack = this.func_184614_ca(); - ItemStack itemstack1 = playerentity.func_184587_cr() ? playerentity.func_184607_cu() : ItemStack.field_190927_a; -- if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.func_77973_b() instanceof AxeItem && itemstack1.func_77973_b() == Items.field_185159_cQ) { -+ if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.canDisableShield(itemstack1, playerentity, this) && itemstack1.isShield(playerentity)) { - float f2 = 0.25F + (float)EnchantmentHelper.func_185293_e(this) * 0.05F; - if (this.field_70146_Z.nextFloat() < f2) { -- playerentity.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100); -+ playerentity.func_184811_cZ().func_185145_a(itemstack.func_77973_b(), 100); - this.field_70170_p.func_72960_a(playerentity, (byte)30); - } - } diff --git a/patches/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch b/patches/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch index 01a17200e..5d70ba1da 100644 --- a/patches/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java +++ b/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java -@@ -18,7 +18,7 @@ +@@ -23,7 +23,7 @@ import net.minecraft.util.math.IPosWrapper; import net.minecraft.util.registry.Registry; -public class MemoryModuleType { +public class MemoryModuleType extends net.minecraftforge.registries.ForgeRegistryEntry> { public static final MemoryModuleType field_220940_a = func_223541_a("dummy"); - public static final MemoryModuleType field_220941_b = func_220937_a("home", Optional.of(GlobalPos::func_218176_a)); - public static final MemoryModuleType field_220942_c = func_220937_a("job_site", Optional.of(GlobalPos::func_218176_a)); + public static final MemoryModuleType field_220941_b = func_234108_a_("home", GlobalPos.field_239645_a_); + public static final MemoryModuleType field_220942_c = func_234108_a_("job_site", GlobalPos.field_239645_a_); diff --git a/patches/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch b/patches/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch index d1a3ed307..2707f0f1a 100644 --- a/patches/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch @@ -7,5 +7,5 @@ -public class SensorType> { +public class SensorType> extends net.minecraftforge.registries.ForgeRegistryEntry> { public static final SensorType field_220997_a = func_220996_a("dummy", DummySensor::new); + public static final SensorType field_234129_b_ = func_220996_a("nearest_items", WantedItemsSensor::new); public static final SensorType field_220998_b = func_220996_a("nearest_living_entities", NearestLivingEntitiesSensor::new); - public static final SensorType field_220999_c = func_220996_a("nearest_players", NearestPlayersSensor::new); 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 index 9e6673880..b4cad6e6d 100644 --- a/patches/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/ai/brain/task/FarmTask.java +++ b/net/minecraft/entity/ai/brain/task/FarmTask.java -@@ -39,7 +39,7 @@ +@@ -37,7 +37,7 @@ } protected boolean func_212832_a_(ServerWorld p_212832_1_, VillagerEntity p_212832_2_) { @@ -9,15 +9,16 @@ return false; } else if (p_212832_2_.func_213700_eh().func_221130_b() != VillagerProfession.field_221156_f) { return false; -@@ -136,6 +136,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; +@@ -117,7 +117,12 @@ + } 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; + } + } } - } + if (flag) { diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch index 7c4feb3d6..7d55ae31c 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/entity/ai/goal/EatGrassGoal.java @@ -59,7 +59,7 @@ if (this.field_151502_a == 4) { - BlockPos blockpos = new BlockPos(this.field_151500_b); + BlockPos blockpos = this.field_151500_b.func_233580_cy_(); if (field_179505_b.test(this.field_151501_c.func_180495_p(blockpos))) { - if (this.field_151501_c.func_82736_K().func_223586_b(GameRules.field_223599_b)) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b)) { @@ -12,7 +12,7 @@ @@ -67,7 +67,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_180495_p(blockpos1).func_203425_a(Blocks.field_196658_i)) { - if (this.field_151501_c.func_82736_K().func_223586_b(GameRules.field_223599_b)) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b)) { this.field_151501_c.func_217379_c(2001, blockpos1, Block.func_196246_j(Blocks.field_196658_i.func_176223_P())); diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch index bba290bbf..f91800a7c 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch @@ -1,15 +1,15 @@ --- 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; +@@ -20,6 +20,8 @@ + private int field_234037_i_; + private 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 @@ +@@ -40,6 +42,15 @@ } else if (!livingentity.func_70089_S()) { return false; } else { diff --git a/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch b/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch index 3619caf1b..b93651582 100644 --- a/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/entity/boss/WitherEntity.java +++ b/net/minecraft/entity/boss/WitherEntity.java -@@ -212,7 +212,7 @@ +@@ -213,7 +213,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_223586_b(GameRules.field_223599_b) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; + Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; this.field_70170_p.func_217398_a(this, this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_(), 7.0F, false, explosion$mode); - this.field_70170_p.func_175669_a(1023, new BlockPos(this), 0); - } -@@ -287,7 +287,7 @@ + if (!this.func_174814_R()) { + this.field_70170_p.func_175669_a(1023, this.func_233580_cy_(), 0); +@@ -290,7 +290,7 @@ if (this.field_82222_j > 0) { --this.field_82222_j; @@ -18,7 +18,7 @@ int i1 = MathHelper.func_76128_c(this.func_226278_cu_()); int l1 = MathHelper.func_76128_c(this.func_226277_ct_()); int i2 = MathHelper.func_76128_c(this.func_226281_cx_()); -@@ -301,7 +301,7 @@ +@@ -304,7 +304,7 @@ int l = i2 + l2; BlockPos blockpos = new BlockPos(i3, k, l); BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); @@ -27,11 +27,11 @@ flag = this.field_70170_p.func_225521_a_(blockpos, true, this) || flag; } } -@@ -322,6 +322,7 @@ +@@ -325,6 +325,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()); + return !p_181033_0_.func_196958_f() && !BlockTags.field_219755_X.func_230235_a_(p_181033_0_.func_177230_c()); } diff --git a/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch b/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch index c441725bf..536147dcc 100644 --- a/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/effect/LightningBoltEntity.java +++ b/net/minecraft/entity/effect/LightningBoltEntity.java -@@ -80,6 +80,7 @@ +@@ -82,6 +82,7 @@ List list = this.field_70170_p.func_175674_a(this, new AxisAlignedBB(this.func_226277_ct_() - 3.0D, this.func_226278_cu_() - 3.0D, this.func_226281_cx_() - 3.0D, this.func_226277_ct_() + 3.0D, this.func_226278_cu_() + 6.0D + 3.0D, this.func_226281_cx_() + 3.0D), Entity::func_70089_S); for(Entity entity : list) { diff --git a/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch index e63ad54f5..5232c3e5e 100644 --- a/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/item/ArmorStandEntity.java +++ b/net/minecraft/entity/item/ArmorStandEntity.java -@@ -56,7 +56,7 @@ +@@ -55,7 +55,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_) -> { diff --git a/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch index 4b85b1c0f..0c4aa2468 100644 --- a/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/entity/item/BoatEntity.java +++ b/net/minecraft/entity/item/BoatEntity.java -@@ -461,7 +461,7 @@ - blockpos$pooledmutable.func_181079_c(l1, k2, i2); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos$pooledmutable); - if (!(blockstate.func_177230_c() instanceof LilyPadBlock) && VoxelShapes.func_197879_c(blockstate.func_196952_d(this.field_70170_p, blockpos$pooledmutable).func_197751_a((double)l1, (double)k2, (double)i2), voxelshape, IBooleanFunction.field_223238_i_)) { -- f += blockstate.func_177230_c().func_208618_m(); -+ f += blockstate.getSlipperiness(this.field_70170_p, blockpos$pooledmutable, this); - ++k1; - } +@@ -467,7 +467,7 @@ + blockpos$mutable.func_181079_c(l1, k2, i2); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos$mutable); + if (!(blockstate.func_177230_c() instanceof LilyPadBlock) && VoxelShapes.func_197879_c(blockstate.func_196952_d(this.field_70170_p, blockpos$mutable).func_197751_a((double)l1, (double)k2, (double)i2), voxelshape, IBooleanFunction.field_223238_i_)) { +- f += blockstate.func_177230_c().func_208618_m(); ++ f += blockstate.getSlipperiness(this.field_70170_p, blockpos$mutable, this); + ++k1; } -@@ -776,6 +776,16 @@ - return new SSpawnObjectPacket(this); + } +@@ -820,6 +820,16 @@ + return this.field_184469_aF == BoatEntity.Status.UNDER_WATER || this.field_184469_aF == BoatEntity.Status.UNDER_FLOWING_WATER; } + // 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 index 027066c18..d2773b98d 100644 --- a/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch @@ -1,38 +1,24 @@ --- a/net/minecraft/entity/item/EnderPearlEntity.java +++ b/net/minecraft/entity/item/EnderPearlEntity.java -@@ -85,6 +85,8 @@ - if (livingentity instanceof ServerPlayerEntity) { - ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)livingentity; +@@ -55,6 +55,8 @@ + if (entity instanceof ServerPlayerEntity) { + ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)entity; if (serverplayerentity.field_71135_a.func_147298_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.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), 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_223586_b(GameRules.field_223601_d)) { EndermiteEntity endermiteentity = EntityType.field_200804_r.func_200721_a(this.field_70170_p); endermiteentity.func_175496_a(true); -@@ -96,9 +98,10 @@ - livingentity.func_184210_p(); +@@ -66,9 +68,10 @@ + entity.func_184210_p(); } -- livingentity.func_70634_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_()); -+ 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()); +- entity.func_70634_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_()); ++ entity.func_70634_a(event.getTargetX(), event.getTargetY(), event.getTargetZ()); + entity.field_70143_R = 0.0F; +- entity.func_70097_a(DamageSource.field_76379_h, 5.0F); ++ entity.func_70097_a(DamageSource.field_76379_h, event.getAttackDamage()); + } //Forge: End } - } else if (livingentity != null) { - livingentity.func_70634_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_()); -@@ -121,11 +124,11 @@ - } - - @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); - } - } + } else if (entity != null) { + entity.func_70634_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_()); diff --git a/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch index d6935dc02..7fbb36a83 100644 --- a/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch @@ -10,7 +10,7 @@ } this.func_213317_d(this.func_213322_ci().func_216372_d((double)f, 0.98D, (double)f)); -@@ -127,6 +128,7 @@ +@@ -123,6 +124,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -18,19 +18,3 @@ if (this.func_180431_b(p_70097_1_)) { return false; } else { -@@ -155,13 +157,14 @@ - public void func_70100_b_(PlayerEntity p_70100_1_) { - if (!this.field_70170_p.field_72995_K) { - if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerXpEvent.PickupXp(p_70100_1_, this))) return; - p_70100_1_.field_71090_bL = 2; - p_70100_1_.func_71001_a(this, 1); - Entry 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); - } diff --git a/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch index 6f29d16ef..4ac5a3dfe 100644 --- a/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/entity/item/FallingBlockEntity.java +++ b/net/minecraft/entity/item/FallingBlockEntity.java @@ -153,7 +153,7 @@ - ((FallingBlock)block).func_176502_a_(this.field_70170_p, blockpos1, this.field_175132_d, blockstate); + ((FallingBlock)block).func_176502_a_(this.field_70170_p, blockpos1, this.field_175132_d, blockstate, this); } - if (this.field_145810_d != null && block instanceof ITileEntityProvider) { diff --git a/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch index 7b173e0a1..37575400d 100644 --- a/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/item/HangingEntity.java +++ b/net/minecraft/entity/item/HangingEntity.java -@@ -113,6 +113,8 @@ +@@ -119,6 +119,8 @@ int j1 = (j - 1) / -2; blockpos$mutable.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$mutable); diff --git a/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch index 8b647d9a6..f7d52f5cf 100644 --- a/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch @@ -1,16 +1,16 @@ --- 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; + public final float field_70290_d; + /** + * The maximum age of this EntityItem. The item is expired once this is reached. + */ + public int lifespan = 6000; - public final float field_70290_d = (float)(Math.random() * Math.PI * 2.0D); public ItemEntity(EntityType p_i50217_1_, World p_i50217_2_) { + super(p_i50217_1_, 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_); @@ -18,8 +18,8 @@ + this.lifespan = (p_i1710_8_.func_77973_b() == null ? 6000 : p_i1710_8_.getEntityLifespan(p_i1710_1_)); } - protected boolean func_225502_at_() { -@@ -65,6 +70,7 @@ + @OnlyIn(Dist.CLIENT) +@@ -74,6 +79,7 @@ } public void func_70071_h_() { @@ -27,7 +27,7 @@ if (this.func_92059_d().func_190926_b()) { this.func_70106_y(); } else { -@@ -96,7 +102,8 @@ +@@ -107,7 +113,8 @@ this.func_213315_a(MoverType.SELF, this.func_213322_ci()); float f = 0.98F; if (this.field_70122_E) { @@ -37,7 +37,7 @@ } this.func_213317_d(this.func_213322_ci().func_216372_d((double)f, 0.98D, (double)f)); -@@ -130,7 +137,14 @@ +@@ -140,7 +147,14 @@ } } @@ -53,7 +53,7 @@ this.func_70106_y(); } -@@ -183,6 +197,8 @@ +@@ -198,6 +212,8 @@ return false; } else if (p_226532_1_.func_77942_o() ^ p_226532_0_.func_77942_o()) { return false; @@ -62,7 +62,7 @@ } else { return !p_226532_1_.func_77942_o() || p_226532_1_.func_77978_p().equals(p_226532_0_.func_77978_p()); } -@@ -216,6 +232,7 @@ +@@ -231,6 +247,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -70,23 +70,23 @@ 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()) { -@@ -235,6 +252,7 @@ +@@ -252,6 +269,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_213281_1_.func_218657_a("Thrower", NBTUtil.func_186862_a(this.func_200214_m())); + p_213281_1_.func_186854_a("Thrower", this.func_200214_m()); } -@@ -255,6 +273,7 @@ - if (p_70037_1_.func_74764_b("PickupDelay")) { - this.field_145804_b = p_70037_1_.func_74765_d("PickupDelay"); +@@ -259,6 +277,7 @@ + if (this.func_200215_l() != null) { + p_213281_1_.func_186854_a("Owner", this.func_200215_l()); } -+ if (p_70037_1_.func_74764_b("Lifespan")) lifespan = p_70037_1_.func_74762_e("Lifespan"); ++ if (p_213281_1_.func_74764_b("Lifespan")) lifespan = p_213281_1_.func_74762_e("Lifespan"); - if (p_70037_1_.func_150297_b("Owner", 10)) { - this.field_145802_g = NBTUtil.func_186860_b(p_70037_1_.func_74775_l("Owner")); -@@ -274,12 +293,21 @@ + if (!this.func_92059_d().func_190926_b()) { + p_213281_1_.func_218657_a("Item", this.func_92059_d().func_77955_b(new CompoundNBT())); +@@ -291,12 +310,21 @@ public void func_70100_b_(PlayerEntity p_70100_1_) { if (!this.field_70170_p.field_72995_K) { @@ -109,18 +109,7 @@ this.func_70106_y(); itemstack.func_190920_e(i); } -@@ -300,8 +328,8 @@ - } - - @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(); - } -@@ -366,7 +394,7 @@ +@@ -392,7 +420,7 @@ public void func_174870_v() { this.func_174871_r(); @@ -128,4 +117,4 @@ + this.field_70292_b = func_92059_d().getEntityLifespan(field_70170_p) - 1; } - public IPacket func_213297_N() { + @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch index 01a71f9e4..f815f09d9 100644 --- a/patches/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/item/ItemFrameEntity.java +++ b/net/minecraft/entity/item/ItemFrameEntity.java -@@ -192,7 +192,7 @@ +@@ -216,7 +216,7 @@ } private void func_110131_b(ItemStack p_110131_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch index a9b1db525..7e5b947a2 100644 --- a/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/item/LeashKnotEntity.java +++ b/net/minecraft/entity/item/LeashKnotEntity.java -@@ -43,6 +43,7 @@ +@@ -44,6 +44,7 @@ protected void func_174856_o() { this.func_226288_n_((double)this.field_174861_a.func_177958_n() + 0.5D, (double)this.field_174861_a.func_177956_o() + 0.5D, (double)this.field_174861_a.func_177952_p() + 0.5D); diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch index f2f092c76..1a3d57629 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java +++ b/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java -@@ -40,7 +40,7 @@ +@@ -47,7 +47,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -9,7 +9,7 @@ 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); -@@ -80,6 +80,7 @@ +@@ -88,6 +88,7 @@ private double field_70507_ar; @OnlyIn(Dist.CLIENT) private double field_70506_as; @@ -17,7 +17,7 @@ protected AbstractMinecartEntity(EntityType p_i48538_1_, World p_i48538_2_) { super(p_i48538_1_, p_i48538_2_); -@@ -126,11 +127,12 @@ +@@ -134,11 +135,12 @@ @Nullable public AxisAlignedBB func_70114_g(Entity p_70114_1_) { @@ -31,19 +31,15 @@ } public double func_70042_X() { -@@ -239,9 +241,9 @@ +@@ -291,6 +293,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) { -+ if (blockstate.func_177230_c() instanceof PoweredRailBlock && ((PoweredRailBlock) blockstate.func_177230_c()).isActivatorRail()) { - this.func_96095_a(i, j, k, blockstate.func_177229_b(PoweredRailBlock.field_176569_M)); - } - } else { -@@ -266,8 +268,11 @@ + } else { ++ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); + if (!this.func_189652_ae()) { + this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, -0.04D, 0.0D)); + } +@@ -331,8 +334,11 @@ } this.func_70101_b(this.field_70177_z, this.field_70125_A); @@ -57,7 +53,7 @@ if (!list.isEmpty()) { for(int l = 0; l < list.size(); ++l) { Entity entity1 = list.get(l); -@@ -279,7 +284,7 @@ +@@ -344,7 +350,7 @@ } } } else { @@ -66,78 +62,7 @@ if (!this.func_184196_w(entity) && entity.func_70104_M() && entity instanceof AbstractMinecartEntity) { entity.func_70108_f(this); } -@@ -287,6 +292,7 @@ - } - - this.func_70072_I(); -+ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); - } - } - -@@ -298,16 +304,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())); - } - - } -@@ -322,29 +336,28 @@ - boolean flag = false; - boolean flag1 = false; - AbstractRailBlock abstractrailblock = (AbstractRailBlock)p_180460_2_.func_177230_c(); -- if (abstractrailblock == Blocks.field_196552_aC) { -+ if (abstractrailblock instanceof PoweredRailBlock && !((PoweredRailBlock) abstractrailblock).isActivatorRail()) { - flag = p_180460_2_.func_177229_b(PoweredRailBlock.field_176569_M); - flag1 = !flag; - } - -- double d3 = 0.0078125D; - 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*getSlopeAdjustment(), 0.0D, 0.0D)); - ++d1; - 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(getSlopeAdjustment(), 0.0D, 0.0D)); - ++d1; - 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, getSlopeAdjustment())); - ++d1; - 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*getSlopeAdjustment())); - ++d1; - } - -@@ -375,7 +388,7 @@ +@@ -440,7 +446,7 @@ } } @@ -145,21 +70,9 @@ + if (flag1 && shouldDoRailFunctions()) { double d22 = Math.sqrt(func_213296_b(this.func_213322_ci())); if (d22 < 0.03D) { - this.func_213317_d(Vec3d.field_186680_a); -@@ -404,10 +417,7 @@ - d0 = d23 + d4 * d14; - d2 = d10 + d5 * d14; - this.func_70107_b(d0, d1, d2); -- double d24 = this.func_184207_aI() ? 0.75D : 1.0D; -- double d25 = this.func_174898_m(); -- vec3d1 = this.func_213322_ci(); -- this.func_213315_a(MoverType.SELF, new Vec3d(MathHelper.func_151237_a(d24 * vec3d1.field_72450_a, -d25, d25), 0.0D, MathHelper.func_151237_a(d24 * vec3d1.field_72449_c, -d25, d25))); -+ this.moveMinecartOnRail(p_180460_1_); - if (vec3i.func_177956_o() != 0 && MathHelper.func_76128_c(this.func_226277_ct_()) - p_180460_1_.func_177958_n() == vec3i.func_177958_n() && MathHelper.func_76128_c(this.func_226281_cx_()) - p_180460_1_.func_177952_p() == vec3i.func_177952_p()) { - this.func_70107_b(this.func_226277_ct_(), this.func_226278_cu_() + (double)vec3i.func_177956_o(), this.func_226281_cx_()); - } else if (vec3i1.func_177956_o() != 0 && MathHelper.func_76128_c(this.func_226277_ct_()) - p_180460_1_.func_177958_n() == vec3i1.func_177958_n() && MathHelper.func_76128_c(this.func_226281_cx_()) - p_180460_1_.func_177952_p() == vec3i1.func_177952_p()) { -@@ -435,7 +445,10 @@ - this.func_213293_j(d26 * (double)(j - p_180460_1_.func_177958_n()), vec3d5.field_72448_b, d26 * (double)(i - p_180460_1_.func_177952_p())); + this.func_213317_d(Vector3d.field_186680_a); +@@ -500,7 +506,10 @@ + this.func_213293_j(d26 * (double)(j - p_180460_1_.func_177958_n()), vector3d5.field_72448_b, d26 * (double)(i - p_180460_1_.func_177952_p())); } - if (flag) { @@ -167,28 +80,28 @@ + ((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 d27 = Math.sqrt(func_213296_b(vec3d6)); + Vector3d vector3d6 = this.func_213322_ci(); + double d27 = Math.sqrt(func_213296_b(vector3d6)); if (d27 > 0.01D) { -@@ -490,7 +503,7 @@ +@@ -555,7 +564,7 @@ BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); - if (blockstate.func_203425_a(BlockTags.field_203437_y)) { + if (AbstractRailBlock.func_208487_j(blockstate)) { - 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); -@@ -529,7 +542,7 @@ +@@ -594,7 +603,7 @@ BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); - if (blockstate.func_203425_a(BlockTags.field_203437_y)) { + if (AbstractRailBlock.func_208487_j(blockstate)) { - 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); - Pair pair = func_226573_a_(railshape); - Vec3i vec3i = pair.getFirst(); - Vec3i vec3i1 = pair.getSecond(); -@@ -592,6 +605,11 @@ + Pair pair = func_226573_a_(railshape); + Vector3i vector3i = pair.getFirst(); + Vector3i vector3i1 = pair.getSecond(); +@@ -657,6 +666,11 @@ } public void func_70108_f(Entity p_70108_1_) { @@ -200,21 +113,7 @@ 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_)) { -@@ -627,11 +645,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)); -@@ -737,6 +755,40 @@ +@@ -802,6 +816,40 @@ return new SSpawnObjectPacket(this); } @@ -238,7 +137,7 @@ + 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(); ++ if (!state.func_235714_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()); @@ -248,8 +147,8 @@ + AbstractMinecartEntity mc = getMinecart(); + double d24 = mc.func_184207_aI() ? 0.75D : 1.0D; + double d25 = mc.getMaxSpeedWithRail(); -+ Vec3d vec3d1 = mc.func_213322_ci(); -+ mc.func_213315_a(MoverType.SELF, new Vec3d(MathHelper.func_151237_a(d24 * vec3d1.field_72450_a, -d25, d25), 0.0D, MathHelper.func_151237_a(d24 * vec3d1.field_72449_c, -d25, d25))); ++ Vector3d vec3d1 = mc.func_213322_ci(); ++ mc.func_213315_a(MoverType.SELF, new Vector3d(MathHelper.func_151237_a(d24 * vec3d1.field_72450_a, -d25, d25), 0.0D, MathHelper.func_151237_a(d24 * vec3d1.field_72449_c, -d25, d25))); + } + public static enum Type { diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch index 8459e6051..b00054709 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch @@ -1,47 +1,24 @@ --- a/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java +++ b/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java -@@ -110,17 +110,19 @@ - } +@@ -151,6 +151,8 @@ - @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() { -+ @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_) { -@@ -149,6 +151,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; + public ActionResultType func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { p_184230_1_.func_213829_a(this); - return true; ++ ActionResultType ret = super.func_184230_a(p_184230_1_, p_184230_2_); ++ if (ret.func_226246_a_()) return ret; + return ActionResultType.func_233537_a_(this.field_70170_p.field_72995_K); } -@@ -168,6 +171,8 @@ - LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(this.field_184290_c); + +@@ -173,6 +175,8 @@ + this.field_184290_c = null; - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)).func_216016_a(this.field_184291_d); + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, this.func_233580_cy_()).func_216016_a(this.field_184291_d); + // Forge: add this entity to loot context, however, currently Vanilla uses 'this' for the player creating the chests. So we take over 'killer_entity' for this. + lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this); 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_); } -@@ -198,4 +203,17 @@ +@@ -203,4 +207,17 @@ } protected abstract Container func_213968_a(int p_213968_1_, PlayerInventory p_213968_2_); diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch index 3cfb77768..36c831b40 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch @@ -1,10 +1,11 @@ --- a/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java +++ b/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java -@@ -110,6 +110,7 @@ +@@ -111,6 +111,8 @@ } - 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; + public ActionResultType func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { ++ ActionResultType ret = super.func_184230_a(p_184230_1_, p_184230_2_); ++ if (ret.func_226246_a_()) return ret; ItemStack itemstack = p_184230_1_.func_184586_b(p_184230_2_); if (field_195407_e.test(itemstack) && this.field_94110_c + 3600 <= 32000) { if (!p_184230_1_.field_71075_bZ.field_75098_d) { diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch index bd7714407..51800af13 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch @@ -1,10 +1,11 @@ --- a/net/minecraft/entity/item/minecart/MinecartEntity.java +++ b/net/minecraft/entity/item/minecart/MinecartEntity.java -@@ -15,6 +15,7 @@ +@@ -16,6 +16,8 @@ } - 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; + public ActionResultType func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { ++ ActionResultType ret = super.func_184230_a(p_184230_1_, p_184230_2_); ++ if (ret.func_226246_a_()) return ret; if (p_184230_1_.func_226563_dT_()) { - return false; + return ActionResultType.PASS; } else if (this.func_184207_aI()) { diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch index 02d08e37b..7c53117c8 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java @@ -23,6 +23,12 @@ public BlockPos func_177221_b() { - return new BlockPos(SpawnerMinecartEntity.this); + return SpawnerMinecartEntity.this.func_233580_cy_(); } + + @Override diff --git a/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch index b387ba622..3be0cc437 100644 --- a/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/entity/merchant/villager/VillagerEntity.java +++ b/net/minecraft/entity/merchant/villager/VillagerEntity.java -@@ -228,7 +228,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_226563_dT_()) { - if (this.func_70631_g_()) { - this.func_213756_es(); - return super.func_184645_a(p_184645_1_, p_184645_2_); -@@ -607,7 +607,8 @@ +@@ -628,7 +628,8 @@ } protected ITextComponent func_225513_by_() { diff --git a/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch index 87798c670..8e6cf42c3 100644 --- a/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/monster/AbstractSkeletonEntity.java +++ b/net/minecraft/entity/monster/AbstractSkeletonEntity.java -@@ -154,7 +154,7 @@ +@@ -155,7 +155,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)); @@ -9,12 +9,12 @@ int i = 20; if (this.field_70170_p.func_175659_aa() != Difficulty.HARD) { i = 40; -@@ -172,6 +172,8 @@ +@@ -173,6 +173,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); ++ abstractarrowentity = ((net.minecraft.item.BowItem)this.func_184614_ca().func_77973_b()).customArrow(abstractarrowentity); double d0 = p_82196_1_.func_226277_ct_() - this.func_226277_ct_(); double d1 = p_82196_1_.func_226283_e_(0.3333333333333333D) - abstractarrowentity.func_226278_cu_(); double d2 = p_82196_1_.func_226281_cx_() - this.func_226281_cx_(); diff --git a/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch index 556916353..a6c85aab2 100644 --- a/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/monster/CreeperEntity.java +++ b/net/minecraft/entity/monster/CreeperEntity.java -@@ -214,7 +214,7 @@ +@@ -215,7 +215,7 @@ private void func_146077_cc() { if (!this.field_70170_p.field_72995_K) { diff --git a/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch index 98eadfd82..334fa8364 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/entity/monster/EndermanEntity.java +++ b/net/minecraft/entity/monster/EndermanEntity.java -@@ -93,7 +93,6 @@ +@@ -100,7 +100,6 @@ } public void func_70624_b(@Nullable LivingEntity p_70624_1_) { - super.func_70624_b(p_70624_1_); - IAttributeInstance iattributeinstance = this.func_110148_a(SharedMonsterAttributes.field_111263_d); + ModifiableAttributeInstance modifiableattributeinstance = this.func_110148_a(Attributes.field_233821_d_); if (p_70624_1_ == null) { this.field_184721_by = 0; -@@ -108,6 +107,7 @@ +@@ -115,6 +114,7 @@ } } @@ -16,7 +16,7 @@ } protected void func_70088_a() { -@@ -234,7 +234,9 @@ +@@ -267,7 +267,9 @@ boolean flag = blockstate.func_185904_a().func_76230_c(); boolean flag1 = blockstate.func_204520_s().func_206884_a(FluidTags.field_206959_a); if (flag && !flag1) { @@ -24,10 +24,10 @@ + 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 flag2 = this.func_213373_a(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true); - if (flag2) { + if (flag2 && !this.func_174814_R()) { 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); -@@ -390,7 +392,7 @@ +@@ -431,7 +433,7 @@ public boolean func_75250_a() { if (this.field_179475_a.func_195405_dq() == null) { return false; @@ -36,7 +36,7 @@ return false; } else { return this.field_179475_a.func_70681_au().nextInt(2000) == 0; -@@ -408,7 +410,7 @@ +@@ -449,7 +451,7 @@ BlockPos blockpos1 = blockpos.func_177977_b(); BlockState blockstate1 = iworld.func_180495_p(blockpos1); BlockState blockstate2 = this.field_179475_a.func_195405_dq(); @@ -45,16 +45,7 @@ iworld.func_180501_a(blockpos, blockstate2, 3); this.field_179475_a.func_195406_b((BlockState)null); } -@@ -416,7 +418,7 @@ - } - - private boolean func_220836_a(IWorldReader p_220836_1_, BlockPos p_220836_2_, BlockState p_220836_3_, BlockState p_220836_4_, BlockState p_220836_5_, BlockPos p_220836_6_) { -- return p_220836_4_.func_196958_f() && !p_220836_5_.func_196958_f() && p_220836_5_.func_224756_o(p_220836_1_, p_220836_6_) && p_220836_3_.func_196955_c(p_220836_1_, p_220836_2_); -+ return p_220836_4_.isAir(p_220836_1_, p_220836_2_) && !p_220836_5_.isAir(p_220836_1_, p_220836_6_) && p_220836_5_.func_224756_o(p_220836_1_, p_220836_6_) && p_220836_3_.func_196955_c(p_220836_1_, p_220836_2_); - } - } - -@@ -458,7 +460,7 @@ +@@ -499,7 +501,7 @@ public boolean func_75250_a() { if (this.field_179473_a.func_195405_dq() != null) { return false; diff --git a/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch index 83f3bc0b7..a63f16f45 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/monster/EvokerEntity.java +++ b/net/minecraft/entity/monster/EvokerEntity.java -@@ -282,7 +282,7 @@ +@@ -280,7 +280,7 @@ return false; } else if (EvokerEntity.this.field_70173_aa < this.field_193322_d) { return false; diff --git a/patches/minecraft/net/minecraft/entity/monster/HoglinEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/HoglinEntity.java.patch new file mode 100644 index 000000000..cabe8c071 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/HoglinEntity.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/entity/monster/HoglinEntity.java ++++ b/net/minecraft/entity/monster/HoglinEntity.java +@@ -275,8 +275,8 @@ + return hoglinentity; + } + +- public boolean func_204701_dC() { +- return !HoglinTasks.func_234386_c_(this) && super.func_204701_dC(); ++ public boolean func_213743_em() { ++ return !HoglinTasks.func_234386_c_(this) && super.func_213743_em(); + } + + public SoundCategory func_184176_by() { diff --git a/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch index e1047feae..8950cdc4c 100644 --- a/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/monster/IllusionerEntity.java +++ b/net/minecraft/entity/monster/IllusionerEntity.java -@@ -185,6 +185,8 @@ +@@ -182,6 +182,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); ++ abstractarrowentity = ((net.minecraft.item.BowItem)this.func_184614_ca().func_77973_b()).customArrow(abstractarrowentity); double d0 = p_82196_1_.func_226277_ct_() - this.func_226277_ct_(); double d1 = p_82196_1_.func_226283_e_(0.3333333333333333D) - abstractarrowentity.func_226278_cu_(); double d2 = p_82196_1_.func_226281_cx_() - this.func_226281_cx_(); diff --git a/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch index ccef1a56d..a45a3c719 100644 --- a/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/entity/monster/MagmaCubeEntity.java +++ b/net/minecraft/entity/monster/MagmaCubeEntity.java @@ -72,6 +72,7 @@ - Vec3d vec3d = this.func_213322_ci(); - this.func_213293_j(vec3d.field_72450_a, (double)(this.func_175134_bD() + (float)this.func_70809_q() * 0.1F), vec3d.field_72449_c); + Vector3d vector3d = this.func_213322_ci(); + this.func_213293_j(vector3d.field_72450_a, (double)(this.func_175134_bD() + (float)this.func_70809_q() * 0.1F), vector3d.field_72449_c); this.field_70160_al = true; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } - protected void func_180466_bG(Tag p_180466_1_) { + protected void func_180466_bG(ITag p_180466_1_) { diff --git a/patches/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch index e66ab3c80..96f9a9df2 100644 --- a/patches/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/entity/monster/RavagerEntity.java +++ b/net/minecraft/entity/monster/RavagerEntity.java -@@ -139,7 +139,7 @@ - this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(MathHelper.func_219803_d(0.1D, d1, d0)); +@@ -134,7 +134,7 @@ + this.func_110148_a(Attributes.field_233821_d_).func_111128_a(MathHelper.func_219803_d(0.1D, d1, d0)); } - if (this.field_70123_F && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { diff --git a/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch index d1e4daa17..1777ad53b 100644 --- a/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch @@ -1,32 +1,42 @@ --- a/net/minecraft/entity/monster/ShulkerEntity.java +++ b/net/minecraft/entity/monster/ShulkerEntity.java -@@ -183,7 +183,7 @@ +@@ -166,7 +166,7 @@ this.field_184708_bA = 0; } else if (!this.field_70170_p.field_72995_K) { BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); - if (!blockstate.func_196958_f()) { + if (!blockstate.isAir(this.field_70170_p, blockpos)) { - if (blockstate.func_177230_c() == Blocks.field_196603_bb) { + if (blockstate.func_203425_a(Blocks.field_196603_bb)) { Direction direction = blockstate.func_177229_b(PistonBlock.field_176387_N); if (this.field_70170_p.func_175623_d(blockpos.func_177972_a(direction))) { @@ -249,6 +249,7 @@ - this.func_226286_f_((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p() + 0.5D); - double d0 = 0.5D - (double)MathHelper.func_76126_a((0.5F + this.field_184706_by) * (float)Math.PI) * 0.5D; - double d1 = 0.5D - (double)MathHelper.func_76126_a((0.5F + this.field_184705_bx) * (float)Math.PI) * 0.5D; + super.func_70107_b(p_70107_1_, p_70107_3_, p_70107_5_); + if (this.field_70180_af != null && this.field_70173_aa != 0) { + Optional optional = this.field_70180_af.func_187225_a(field_184701_b); + if (this.isAddedToWorld() && this.field_70170_p instanceof net.minecraft.world.server.ServerWorld) ((net.minecraft.world.server.ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. - Direction direction3 = this.func_184696_cZ().func_176734_d(); - this.func_174826_a((new AxisAlignedBB(this.func_226277_ct_() - 0.5D, this.func_226278_cu_(), this.func_226281_cx_() - 0.5D, this.func_226277_ct_() + 0.5D, this.func_226278_cu_() + 1.0D, this.func_226281_cx_() + 0.5D)).func_72321_a((double)direction3.func_82601_c() * d0, (double)direction3.func_96559_d() * d0, (double)direction3.func_82599_e() * d0)); - double d2 = d0 - d1; -@@ -307,6 +308,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()); + Optional optional1 = Optional.of(new BlockPos(p_70107_1_, p_70107_3_, p_70107_5_)); + if (!optional1.equals(optional)) { + this.field_70180_af.func_187227_b(field_184701_b, optional1); +@@ -282,7 +283,14 @@ + BlockPos blockpos1 = blockpos.func_177982_a(8 - this.field_70146_Z.nextInt(17), 8 - this.field_70146_Z.nextInt(17), 8 - this.field_70146_Z.nextInt(17)); + if (blockpos1.func_177956_o() > 0 && this.field_70170_p.func_175623_d(blockpos1) && this.field_70170_p.func_175723_af().func_177746_a(blockpos1) && this.field_70170_p.func_226665_a__(this, new AxisAlignedBB(blockpos1))) { + Direction direction = this.func_234299_g_(blockpos1); ++ + if (direction != null) { ++ 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)) direction = null; ++ blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ()); + } + -+ if (flag) { ++ if (direction != null) { + this.field_70180_af.func_187227_b(field_184700_a, direction); this.func_184185_a(SoundEvents.field_187791_eX, 1.0F, 1.0F); this.field_70180_af.func_187227_b(field_184701_b, Optional.of(blockpos1)); - this.field_70180_af.func_187227_b(field_184702_c, (byte)0); +@@ -306,7 +314,6 @@ + this.field_70760_ar = 0.0F; + this.field_70761_aq = 0.0F; + } +- + } + + public void func_184206_a(DataParameter p_184206_1_) { diff --git a/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch index 95b0e68a8..2893d71cb 100644 --- a/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/entity/monster/SilverfishEntity.java +++ b/net/minecraft/entity/monster/SilverfishEntity.java -@@ -136,7 +136,7 @@ +@@ -134,7 +134,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_223586_b(GameRules.field_223599_b) && 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 = Direction.func_176741_a(random); + this.field_179483_b = Direction.func_239631_a_(random); BlockPos blockpos = (new BlockPos(this.field_75457_a.func_226277_ct_(), this.field_75457_a.func_226278_cu_() + 0.5D, this.field_75457_a.func_226281_cx_())).func_177972_a(this.field_179483_b); BlockState blockstate = this.field_75457_a.field_70170_p.func_180495_p(blockpos); -@@ -205,7 +205,7 @@ +@@ -203,7 +203,7 @@ BlockState blockstate = world.func_180495_p(blockpos1); Block block = blockstate.func_177230_c(); if (block instanceof SilverfishBlock) { diff --git a/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch index 61266e095..49e74a0af 100644 --- a/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/monster/SlimeEntity.java +++ b/net/minecraft/entity/monster/SlimeEntity.java -@@ -129,6 +129,7 @@ +@@ -125,6 +125,7 @@ if (this.field_70122_E && !this.field_175452_bi) { int i = this.func_70809_q(); @@ -8,20 +8,20 @@ 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; -@@ -180,9 +181,10 @@ - return (EntityType) super.func_200600_R(); +@@ -176,9 +177,10 @@ + return (EntityType)super.func_200600_R(); } - public void func_70106_y() { + @Override + public void remove(boolean keepData) { int i = this.func_70809_q(); -- if (!this.field_70170_p.field_72995_K && i > 1 && this.func_110143_aJ() <= 0.0F) { -+ if (!this.field_70170_p.field_72995_K && i > 1 && this.func_110143_aJ() <= 0.0F && !this.field_70128_L) { - int j = 2 + this.field_70146_Z.nextInt(3); - - for(int k = 0; k < j; ++k) { -@@ -204,7 +206,7 @@ +- if (!this.field_70170_p.field_72995_K && i > 1 && this.func_233643_dh_()) { ++ if (!this.field_70170_p.field_72995_K && i > 1 && this.func_233643_dh_() && !this.field_70128_L) { + ITextComponent itextcomponent = this.func_200201_e(); + boolean flag = this.func_175446_cd(); + float f = (float)i / 4.0F; +@@ -202,7 +204,7 @@ } } @@ -30,16 +30,7 @@ } public void func_70108_f(Entity p_70108_1_) { -@@ -262,7 +264,7 @@ - } - - public static boolean func_223366_c(EntityType p_223366_0_, IWorld p_223366_1_, SpawnReason p_223366_2_, BlockPos p_223366_3_, Random p_223366_4_) { -- if (p_223366_1_.func_72912_H().func_76067_t() == WorldType.field_77138_c && p_223366_4_.nextInt(4) != 1) { -+ if (p_223366_1_.func_72912_H().func_76067_t().handleSlimeSpawnReduction(p_223366_4_, p_223366_1_) && p_223366_4_.nextInt(4) != 1) { - return false; - } else { - if (p_223366_1_.func_175659_aa() != Difficulty.PEACEFUL) { -@@ -320,6 +322,12 @@ +@@ -323,6 +325,12 @@ return super.func_213305_a(p_213305_1_).func_220313_a(0.255F * (float)this.func_70809_q()); } diff --git a/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch index 1215b5b94..31898f658 100644 --- a/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/monster/SpiderEntity.java +++ b/net/minecraft/entity/monster/SpiderEntity.java -@@ -119,7 +119,12 @@ +@@ -118,7 +118,12 @@ } public boolean func_70687_e(EffectInstance p_70687_1_) { diff --git a/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch index d15a0c55e..1aa7c75c8 100644 --- a/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch @@ -1,47 +1,10 @@ --- a/net/minecraft/entity/monster/ZombieEntity.java +++ b/net/minecraft/entity/monster/ZombieEntity.java -@@ -110,7 +110,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() { -@@ -315,12 +315,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_223586_b(GameRules.field_223601_d)) { - int i = MathHelper.func_76128_c(this.func_226277_ct_()); - int j = MathHelper.func_76128_c(this.func_226278_cu_()); - int k = MathHelper.func_76128_c(this.func_226281_cx_()); -- ZombieEntity zombieentity = new ZombieEntity(this.field_70170_p); - -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, livingentity, this.func_110148_a(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_223586_b(GameRules.field_223601_d)) { -+ ZombieEntity zombieentity = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.field_200725_aD.func_200721_a(this.field_70170_p); -+ - for(int l = 0; l < 50; ++l) { - int i1 = i + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); - int j1 = j + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); -@@ -330,6 +334,7 @@ +@@ -277,6 +277,7 @@ zombieentity.func_70107_b((double)i1, (double)j1, (double)k1); if (!this.field_70170_p.func_217358_a((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_226668_i_(zombieentity) && this.field_70170_p.func_226669_j_(zombieentity) && !this.field_70170_p.func_72953_d(zombieentity.func_174813_aQ())) { this.field_70170_p.func_217376_c(zombieentity); + 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)); -@@ -468,7 +473,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) { + zombieentity.func_213386_a(this.field_70170_p, this.field_70170_p.func_175649_E(zombieentity.func_233580_cy_()), SpawnReason.REINFORCEMENT, (ILivingEntityData)null, (CompoundNBT)null); + this.func_110148_a(Attributes.field_233829_l_).func_233769_c_(new AttributeModifier("Zombie reinforcement caller charge", (double)-0.05F, AttributeModifier.Operation.ADDITION)); diff --git a/patches/minecraft/net/minecraft/entity/passive/AnimalEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/AnimalEntity.java.patch new file mode 100644 index 000000000..2341fd81f --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/AnimalEntity.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/entity/passive/AnimalEntity.java ++++ b/net/minecraft/entity/passive/AnimalEntity.java +@@ -120,7 +120,7 @@ + ItemStack itemstack = p_230254_1_.func_184586_b(p_230254_2_); + if (this.func_70877_b(itemstack)) { + int i = this.func_70874_b(); +- if (!this.field_70170_p.field_72995_K && i == 0 && this.func_204701_dC()) { ++ if (!this.field_70170_p.field_72995_K && i == 0 && this.func_213743_em()) { + this.func_175505_a(p_230254_1_, itemstack); + this.func_146082_f(p_230254_1_); + return ActionResultType.SUCCESS; +@@ -147,7 +147,7 @@ + + } + +- public boolean func_204701_dC() { ++ public boolean func_213743_em() { + return this.field_70881_d <= 0; + } + +@@ -198,6 +198,17 @@ + + public void func_234177_a_(World p_234177_1_, AnimalEntity p_234177_2_) { + AgeableEntity ageableentity = this.func_90011_a(p_234177_2_); ++ final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(this, p_234177_2_, ageableentity); ++ final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ ageableentity = event.getChild(); ++ if (cancelled) { ++ //Reset the "inLove" state for the animals ++ this.func_70873_a(6000); ++ p_234177_2_.func_70873_a(6000); ++ this.func_70875_t(); ++ p_234177_2_.func_70875_t(); ++ return; ++ } + if (ageableentity != null) { + ServerPlayerEntity serverplayerentity = this.func_191993_do(); + if (serverplayerentity == null && p_234177_2_.func_191993_do() != null) { diff --git a/patches/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch index 618d0032d..9d8464cf3 100644 --- a/patches/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/passive/BeeEntity.java +++ b/net/minecraft/entity/passive/BeeEntity.java -@@ -438,7 +438,7 @@ +@@ -425,7 +425,7 @@ return false; } else { TileEntity tileentity = this.field_70170_p.func_175625_s(this.field_226369_bI_); diff --git a/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch index 8062f6f32..824f1e5bb 100644 --- a/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch @@ -1,11 +1,29 @@ --- a/net/minecraft/entity/passive/FoxEntity.java +++ b/net/minecraft/entity/passive/FoxEntity.java -@@ -747,7 +747,7 @@ +@@ -760,7 +760,7 @@ } protected void func_220730_m() { - if (FoxEntity.this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(FoxEntity.this.field_70170_p, FoxEntity.this)) { BlockState blockstate = FoxEntity.this.field_70170_p.func_180495_p(this.field_179494_b); - if (blockstate.func_177230_c() == Blocks.field_222434_lW) { + if (blockstate.func_203425_a(Blocks.field_222434_lW)) { int i = blockstate.func_177229_b(SweetBerryBushBlock.field_220125_a); +@@ -999,6 +999,17 @@ + + protected void func_75388_i() { + FoxEntity foxentity = (FoxEntity)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, foxentity); ++ final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ foxentity = (FoxEntity) event.getChild(); ++ if (cancelled) { ++ //Reset the "inLove" state for the animals ++ this.field_75390_d.func_70873_a(6000); ++ this.field_75391_e.func_70873_a(6000); ++ this.field_75390_d.func_70875_t(); ++ this.field_75391_e.func_70875_t(); ++ return; ++ } + if (foxentity != null) { + ServerPlayerEntity serverplayerentity = this.field_75390_d.func_191993_do(); + ServerPlayerEntity serverplayerentity1 = this.field_75391_e.func_191993_do(); diff --git a/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch index 07c8c58e3..d9efb5554 100644 --- a/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/passive/IronGolemEntity.java +++ b/net/minecraft/entity/passive/IronGolemEntity.java -@@ -113,9 +113,10 @@ +@@ -120,9 +120,10 @@ int i = MathHelper.func_76128_c(this.func_226277_ct_()); int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F); int k = MathHelper.func_76128_c(this.func_226281_cx_()); diff --git a/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch index 12bfcd170..c7f3cd7d6 100644 --- a/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/passive/OcelotEntity.java +++ b/net/minecraft/entity/passive/OcelotEntity.java @@ -161,7 +161,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_70914_e == null || this.field_70914_e.func_75277_f()) && !this.func_213530_dX() && this.func_70877_b(itemstack) && p_230254_1_.func_70068_e(this) < 9.0D) { + this.func_175505_a(p_230254_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_)) { ++ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_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/PandaEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/PandaEntity.java.patch new file mode 100644 index 000000000..0c20b7ec1 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/PandaEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/passive/PandaEntity.java ++++ b/net/minecraft/entity/passive/PandaEntity.java +@@ -586,7 +586,7 @@ + if (this.func_70631_g_()) { + this.func_175505_a(p_230254_1_, itemstack); + this.func_175501_a((int)((float)(-this.func_70874_b() / 20) * 0.1F), true); +- } else if (!this.field_70170_p.field_72995_K && this.func_70874_b() == 0 && this.func_204701_dC()) { ++ } else if (!this.field_70170_p.field_72995_K && this.func_70874_b() == 0 && this.func_213743_em()) { + this.func_175505_a(p_230254_1_, itemstack); + this.func_146082_f(p_230254_1_); + } else { diff --git a/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch index 3500854f2..fa4ba82a0 100644 --- a/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/passive/ParrotEntity.java +++ b/net/minecraft/entity/passive/ParrotEntity.java -@@ -232,7 +232,7 @@ +@@ -235,7 +235,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_); ++ if (this.field_70146_Z.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_1_)) { + this.func_193101_c(p_230254_1_); this.field_70170_p.func_72960_a(this, (byte)7); } else { diff --git a/patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch index cf77ca9eb..e61e964c5 100644 --- a/patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/passive/RabbitEntity.java +++ b/net/minecraft/entity/passive/RabbitEntity.java -@@ -492,7 +492,7 @@ +@@ -498,7 +498,7 @@ public boolean func_75250_a() { if (this.field_179496_a <= 0) { diff --git a/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch index 3c6557dd6..b913316e7 100644 --- a/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/entity/passive/SnowGolemEntity.java +++ b/net/minecraft/entity/passive/SnowGolemEntity.java -@@ -33,7 +33,7 @@ - import net.minecraft.world.GameRules; - import net.minecraft.world.World; - --public class SnowGolemEntity extends GolemEntity implements IRangedAttackMob { -+public class SnowGolemEntity extends GolemEntity implements IRangedAttackMob, net.minecraftforge.common.IShearable { - private static final DataParameter field_184749_a = EntityDataManager.func_187226_a(SnowGolemEntity.class, DataSerializers.field_187191_a); - - public SnowGolemEntity(EntityType p_i50244_1_, World p_i50244_2_) { -@@ -88,7 +88,7 @@ +@@ -93,7 +93,7 @@ this.func_70097_a(DamageSource.field_76370_b, 1.0F); } @@ -18,7 +9,7 @@ return; } -@@ -99,7 +99,7 @@ +@@ -104,7 +104,7 @@ j = MathHelper.func_76128_c(this.func_226278_cu_()); k = MathHelper.func_76128_c(this.func_226281_cx_() + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F)); BlockPos blockpos = new BlockPos(i, j, k); @@ -27,28 +18,3 @@ this.field_70170_p.func_175656_a(blockpos, blockstate); } } -@@ -125,7 +125,7 @@ - - protected boolean func_184645_a(PlayerEntity p_184645_1_, Hand p_184645_2_) { - ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_); -- if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o()) { -+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o()) { //Forge: Moved to onSheared - if (!this.field_70170_p.field_72995_K) { - this.func_184747_a(false); - itemstack.func_222118_a(1, p_184645_1_, (p_213622_1_) -> { -@@ -167,4 +167,15 @@ - protected SoundEvent func_184615_bR() { - return SoundEvents.field_187801_fC; - } -+ -+ @Override -+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) { -+ return this.func_184748_o(); -+ } -+ -+ @Override -+ public java.util.List 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/TurtleEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/TurtleEntity.java.patch new file mode 100644 index 000000000..b601db5e2 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/TurtleEntity.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/entity/passive/TurtleEntity.java ++++ b/net/minecraft/entity/passive/TurtleEntity.java +@@ -233,8 +233,8 @@ + this.func_184185_a(soundevent, 0.15F, 1.0F); + } + +- public boolean func_204701_dC() { +- return super.func_204701_dC() && !this.func_203020_dx(); ++ public boolean func_213743_em() { ++ return super.func_213743_em() && !this.func_203020_dx(); + } + + protected float func_203009_ad() { diff --git a/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch index fea6b0cc8..d649dce16 100644 --- a/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/passive/WolfEntity.java +++ b/net/minecraft/entity/passive/WolfEntity.java -@@ -353,7 +353,7 @@ +@@ -340,7 +340,7 @@ itemstack.func_190918_g(1); } - 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_); ++ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_1_)) { + this.func_193101_c(p_230254_1_); this.field_70699_by.func_75499_g(); this.func_70624_b((LivingEntity)null); diff --git a/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch index 3c6ccf362..411867bbb 100644 --- a/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch @@ -6,26 +6,6 @@ inventory.func_110132_b(this); + this.itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this.field_110296_bG)); int i = Math.min(inventory.func_70302_i_(), this.field_110296_bG.func_70302_i_()); - - for(int j = 0; j < i; ++j) { -@@ -275,6 +276,7 @@ - - this.field_110296_bG.func_110134_a(this); - this.func_110232_cE(); -+ this.itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this.field_110296_bG)); - } - - protected void func_110232_cE() { -@@ -324,9 +325,9 @@ - protected void func_180429_a(BlockPos p_180429_1_, BlockState p_180429_2_) { - if (!p_180429_2_.func_185904_a().func_76224_d()) { - BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()); -- SoundType soundtype = p_180429_2_.func_215695_r(); -+ SoundType soundtype = p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this); - if (blockstate.func_177230_c() == Blocks.field_150433_aE) { -- soundtype = blockstate.func_215695_r(); -+ soundtype = blockstate.getSoundType(field_70170_p, p_180429_1_, this); - } if (this.func_184207_aI() && this.field_190688_bE) { @@ -672,6 +673,7 @@ diff --git a/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch index 889f37dd0..23dc0b28d 100644 --- a/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/entity/passive/horse/HorseEntity.java +++ b/net/minecraft/entity/passive/horse/HorseEntity.java -@@ -175,6 +175,8 @@ - this.func_110230_cF(); +@@ -138,6 +138,8 @@ + this.func_184185_a(SoundEvents.field_187705_cn, p_190680_1_.func_185843_a() * 0.6F, p_190680_1_.func_185847_b()); } + ItemStack stack = this.field_110296_bG.func_70301_a(1); diff --git a/patches/minecraft/net/minecraft/entity/passive/horse/LlamaEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/horse/LlamaEntity.java.patch new file mode 100644 index 000000000..b3ba062d5 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/horse/LlamaEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/passive/horse/LlamaEntity.java ++++ b/net/minecraft/entity/passive/horse/LlamaEntity.java +@@ -179,7 +179,7 @@ + i = 90; + j = 6; + f = 10.0F; +- if (this.func_110248_bS() && this.func_70874_b() == 0 && this.func_204701_dC()) { ++ if (this.func_110248_bS() && this.func_70874_b() == 0 && this.func_213743_em()) { + flag = true; + this.func_146082_f(p_190678_1_); + } diff --git a/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch b/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch index 7997fdbbf..6521589e8 100644 --- a/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch @@ -1,35 +1,35 @@ --- a/net/minecraft/entity/player/PlayerEntity.java +++ b/net/minecraft/entity/player/PlayerEntity.java -@@ -109,6 +109,10 @@ +@@ -110,6 +110,10 @@ import net.minecraftforge.api.distmarker.OnlyIn; 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); ++ public static final net.minecraft.entity.ai.attributes.Attribute REACH_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute( "generic.reachDistance", 5.0D, 0.0D, 1024.0D).func_233753_a_(true); public static final EntitySize field_213835_bs = EntitySize.func_220314_b(0.6F, 1.8F); private static final Map 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.CROUCHING, EntitySize.func_220314_b(0.6F, 1.5F)).put(Pose.DYING, EntitySize.func_220311_c(0.2F, 0.2F)).build(); private static final DataParameter field_184829_a = EntityDataManager.func_187226_a(PlayerEntity.class, DataSerializers.field_187193_c); -@@ -151,6 +155,9 @@ +@@ -150,6 +154,8 @@ private final CooldownTracker field_184832_bU = this.func_184815_l(); @Nullable public FishingBobberEntity field_71104_cf; -+ private net.minecraft.world.dimension.DimensionType spawnDimension = net.minecraft.world.dimension.DimensionType.field_223227_a_; + private final java.util.Collection prefixes = new java.util.LinkedList(); + private final java.util.Collection suffixes = new java.util.LinkedList(); - public PlayerEntity(World p_i45324_1_, GameProfile p_i45324_2_) { - super(EntityType.field_200729_aH, p_i45324_1_); -@@ -182,6 +189,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); -+ this.func_110140_aT().func_111150_b(REACH_DISTANCE); + public PlayerEntity(World p_i231577_1_, BlockPos p_i231577_2_, GameProfile p_i231577_3_) { + super(EntityType.field_200729_aH, p_i231577_1_); +@@ -175,7 +181,7 @@ + } + + public static AttributeModifierMap.MutableAttribute func_234570_el_() { +- return LivingEntity.func_233639_cI_().func_233815_a_(Attributes.field_233823_f_, 1.0D).func_233815_a_(Attributes.field_233821_d_, (double)0.1F).func_233814_a_(Attributes.field_233825_h_).func_233814_a_(Attributes.field_233828_k_); ++ return LivingEntity.func_233639_cI_().func_233815_a_(Attributes.field_233823_f_, 1.0D).func_233815_a_(Attributes.field_233821_d_, (double)0.1F).func_233814_a_(Attributes.field_233825_h_).func_233814_a_(Attributes.field_233828_k_).func_233814_a_(REACH_DISTANCE); } protected void func_70088_a() { -@@ -195,6 +203,7 @@ +@@ -189,6 +195,7 @@ } public void func_70071_h_() { @@ -37,7 +37,7 @@ this.field_70145_X = this.func_175149_v(); if (this.func_175149_v()) { this.field_70122_E = false; -@@ -210,7 +219,7 @@ +@@ -204,7 +211,7 @@ this.field_71076_b = 100; } @@ -46,7 +46,7 @@ this.func_225652_a_(false, true); } } else if (this.field_71076_b > 0) { -@@ -268,6 +277,7 @@ +@@ -258,6 +265,7 @@ this.func_203041_m(); this.field_184832_bU.func_185144_a(); this.func_213832_dB(); @@ -54,20 +54,7 @@ } public boolean func_226563_dT_() { -@@ -454,10 +464,10 @@ - this.field_71107_bF = this.field_71109_bG; - this.field_71109_bG = 0.0F; - this.func_71015_k(this.func_226277_ct_() - d0, this.func_226278_cu_() - d1, this.func_226281_cx_() - d2); -- 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 = ((PigEntity)this.func_184187_bx()).field_70761_aq; -+ this.field_70761_aq = ((LivingEntity)this.func_184187_bx()).field_70761_aq; - } - - } -@@ -570,6 +580,7 @@ +@@ -550,6 +558,7 @@ } public void func_70645_a(DamageSource p_70645_1_) { @@ -75,7 +62,7 @@ super.func_70645_a(p_70645_1_); this.func_226264_Z_(); if (!this.func_175149_v()) { -@@ -623,12 +634,14 @@ +@@ -603,12 +612,14 @@ } public boolean func_225609_n_(boolean p_225609_1_) { @@ -92,7 +79,7 @@ } @Nullable -@@ -662,7 +675,12 @@ +@@ -646,7 +657,12 @@ } } @@ -105,39 +92,21 @@ float f = this.field_71071_by.func_184438_a(p_184813_1_); if (f > 1.0F) { int i = EnchantmentHelper.func_185293_e(this); -@@ -704,11 +722,12 @@ - f /= 5.0F; - } - -+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, p_184813_1_, f, pos); - return f; - } - - 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(CompoundNBT p_70037_1_) { -@@ -732,6 +751,17 @@ - this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); - } - -+ p_70037_1_.func_150295_c("Spawns", 10).forEach(e -> { +@@ -733,6 +749,13 @@ + p_213281_1_.func_74768_a("DataVersion", SharedConstants.func_215069_a().getWorldVersion()); + p_213281_1_.func_218657_a("Inventory", this.field_71071_by.func_70442_a(new ListNBT())); + p_213281_1_.func_74768_a("SelectedItemSlot", this.field_71071_by.field_70461_c); ++ p_213281_1_.func_150295_c("Spawns", 10).forEach(e -> { + CompoundNBT data = (CompoundNBT)e; + ResourceLocation dim = new ResourceLocation(data.func_74779_i("Dim")); + this.spawnPosMap.put(dim, new BlockPos(data.func_74762_e("SpawnX"), data.func_74762_e("SpawnY"), data.func_74762_e("SpawnZ"))); + this.spawnForcedMap.put(dim, data.func_74767_n("SpawnForced")); + }); -+ net.minecraft.world.dimension.DimensionType spawnDim = null; -+ if (p_70037_1_.func_150297_b("SpawnDimension", net.minecraftforge.common.util.Constants.NBT.TAG_STRING)) -+ spawnDim = net.minecraft.world.dimension.DimensionType.func_193417_a(new ResourceLocation(p_70037_1_.func_74779_i("SpawnDimension"))); -+ this.spawnDimension = spawnDim != null ? spawnDim : net.minecraft.world.dimension.DimensionType.field_223227_a_; + - 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)) { -@@ -777,6 +807,23 @@ + p_213281_1_.func_74777_a("SleepTimer", (short)this.field_71076_b); + p_213281_1_.func_74776_a("XpP", this.field_71106_cc); + p_213281_1_.func_74768_a("XpLevel", this.field_71068_ca); +@@ -750,6 +773,20 @@ p_213281_1_.func_218657_a("ShoulderEntityRight", this.func_192025_dl()); } @@ -154,14 +123,11 @@ + } + }); + p_213281_1_.func_218657_a("Spawns", spawnlist); -+ if (spawnDimension != net.minecraft.world.dimension.DimensionType.field_223227_a_) { -+ p_213281_1_.func_74778_a("SpawnDimension", spawnDimension.getRegistryName().toString()); -+ } + } public boolean func_180431_b(DamageSource p_180431_1_) { -@@ -794,6 +841,7 @@ +@@ -767,6 +804,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -169,7 +135,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; } else if (this.field_71075_bZ.field_75102_a && !p_70097_1_.func_76357_e()) { -@@ -825,7 +873,7 @@ +@@ -798,7 +836,7 @@ protected void func_190629_c(LivingEntity p_190629_1_) { super.func_190629_c(p_190629_1_); @@ -178,21 +144,7 @@ this.func_190777_m(true); } -@@ -846,11 +894,12 @@ - } - - protected void func_184590_k(float p_184590_1_) { -- if (p_184590_1_ >= 3.0F && this.field_184627_bm.func_77973_b() == Items.field_185159_cQ) { -+ if (p_184590_1_ >= 3.0F && this.field_184627_bm.isShield(this)) { - int i = 1 + MathHelper.func_76141_d(p_184590_1_); - Hand hand = this.func_184600_cs(); - this.field_184627_bm.func_222118_a(i, this, (p_213833_1_) -> { - p_213833_1_.func_213334_d(hand); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.field_184627_bm, hand); - }); - if (this.field_184627_bm.func_190926_b()) { - if (hand == Hand.MAIN_HAND) { -@@ -868,10 +917,13 @@ +@@ -847,10 +885,13 @@ protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { if (!this.func_180431_b(p_70665_1_)) { @@ -206,7 +158,7 @@ float f = p_70665_2_ - f2; if (f > 0.0F && f < 3.4028235E37F) { this.func_195067_a(Stats.field_212738_J, Math.round(f * 10.0F)); -@@ -926,6 +978,8 @@ +@@ -909,6 +950,8 @@ return ActionResultType.PASS; } else { @@ -214,34 +166,34 @@ + if (cancelResult != null) return cancelResult; ItemStack itemstack = this.func_184586_b(p_190775_2_); ItemStack itemstack1 = itemstack.func_77946_l(); - if (p_190775_1_.func_184230_a(this, p_190775_2_)) { -@@ -933,6 +987,9 @@ + ActionResultType actionresulttype = p_190775_1_.func_184230_a(this, p_190775_2_); +@@ -917,6 +960,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 ActionResultType.SUCCESS; + return actionresulttype; } else { if (!itemstack.func_190926_b() && p_190775_1_ instanceof LivingEntity) { -@@ -942,6 +999,7 @@ - - if (itemstack.func_111282_a(this, (LivingEntity)p_190775_1_, p_190775_2_)) { +@@ -927,6 +973,7 @@ + ActionResultType actionresulttype1 = itemstack.func_111282_a_(this, (LivingEntity)p_190775_1_, p_190775_2_); + if (actionresulttype1.func_226246_a_()) { if (itemstack.func_190926_b() && !this.field_71075_bZ.field_75098_d) { + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_190775_2_); this.func_184611_a(p_190775_2_, ItemStack.field_190927_a); } -@@ -1018,6 +1076,7 @@ +@@ -1007,6 +1054,7 @@ } public void func_71059_n(Entity p_71059_1_) { + if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, p_71059_1_)) return; 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(); -@@ -1045,8 +1104,10 @@ + float f = (float)this.func_233637_b_(Attributes.field_233823_f_); +@@ -1034,8 +1082,10 @@ boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(Effects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof LivingEntity; flag2 = flag2 && !this.func_70051_ag(); @@ -253,7 +205,7 @@ } f = f + f1; -@@ -1134,8 +1195,10 @@ +@@ -1123,8 +1173,10 @@ } if (!this.field_70170_p.field_72995_K && !itemstack1.func_190926_b() && entity instanceof LivingEntity) { @@ -264,7 +216,7 @@ this.func_184611_a(Hand.MAIN_HAND, ItemStack.field_190927_a); } } -@@ -1177,7 +1240,7 @@ +@@ -1166,7 +1218,7 @@ } if (this.field_70146_Z.nextFloat() < f) { @@ -273,7 +225,7 @@ this.func_184602_cy(); this.field_70170_p.func_72960_a(this, (byte)30); } -@@ -1203,8 +1266,9 @@ +@@ -1192,8 +1244,9 @@ public void func_71004_bE() { } @@ -285,34 +237,7 @@ this.field_71069_bz.func_75134_a(this); if (this.field_71070_bA != null) { this.field_71070_bA.func_75134_a(this); -@@ -1221,6 +1285,9 @@ - } - - public Either func_213819_a(BlockPos p_213819_1_) { -+ Optional optAt = Optional.of(p_213819_1_); -+ PlayerEntity.SleepResult ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, optAt); -+ 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()) { -@@ -1231,7 +1298,7 @@ - return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_HERE); - } - -- if (this.field_70170_p.func_72935_r()) { -+ if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, optAt)) { - this.func_226560_a_(p_213819_1_, false, true); - return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_NOW); - } -@@ -1273,6 +1340,7 @@ - } - - private boolean func_190774_a(BlockPos p_190774_1_, Direction p_190774_2_) { -+ if (p_190774_2_ == null) return false; - return this.func_230126_g_(p_190774_1_) || this.func_230126_g_(p_190774_1_.func_177972_a(p_190774_2_.func_176734_d())); - } - -@@ -1287,6 +1355,7 @@ +@@ -1216,6 +1269,7 @@ } public void func_225652_a_(boolean p_225652_1_, boolean p_225652_2_) { @@ -320,94 +245,7 @@ super.func_213366_dy(); if (this.field_70170_p instanceof ServerWorld && p_225652_2_) { ((ServerWorld)this.field_70170_p).func_72854_c(); -@@ -1300,17 +1369,17 @@ - } - - 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 = 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 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); - } - } - -@@ -1325,15 +1394,62 @@ - public void func_146105_b(ITextComponent p_146105_1_, boolean p_146105_2_) { - } - -+ @Deprecated //Forge: Use Dimension sensitive version - public BlockPos func_180470_cg() { -- return this.field_71077_c; -+ return getBedLocation(this.field_71093_bK); - } - -+ /** -+ * A dimension aware version of getBedLocation. -+ * @param dim The dimension to get the bed spawn for -+ * @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.field_223227_a_ ? field_71077_c : spawnPosMap.get(dim.getRegistryName()); -+ } -+ -+ @Deprecated //Forge: Use Dimension sensitive version - public boolean func_82245_bX() { -- return this.field_82248_d; -+ return isSpawnForced(this.field_71093_bK); - } - -+ /** -+ * A dimension aware version of isSpawnForced. -+ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. -+ * This just extends that to be dimension aware. -+ * @param dim The dimension to get whether to check for a bed before spawning for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public boolean isSpawnForced(net.minecraft.world.dimension.DimensionType dim) { -+ return dim == net.minecraft.world.dimension.DimensionType.field_223227_a_ ? field_82248_d : spawnForcedMap.getOrDefault(dim.getRegistryName(), false); -+ } -+ -+ @Deprecated //Forge: Use Dimension sensitive version - public void func_226560_a_(BlockPos p_226560_1_, boolean p_226560_2_, boolean p_226560_3_) { -+ setSpawnPoint(p_226560_1_, p_226560_2_, p_226560_3_, this.field_71093_bK); -+ } -+ -+ /** -+ * A dimension aware version of setSpawnChunk. -+ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. -+ * @param pos The spawn point to set as the player-specific spawn point for the dimension -+ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) -+ * @param dim Which dimension to apply the player-specific respawn point to -+ */ -+ public void setSpawnPoint(@Nullable BlockPos p_226560_1_, boolean p_226560_2_, boolean p_226560_3_, net.minecraft.world.dimension.DimensionType dim) { -+ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, p_226560_1_, p_226560_2_)) return; -+ if (dim != net.minecraft.world.dimension.DimensionType.field_223227_a_) { -+ if (p_226560_1_ != null) { -+ BlockPos old = spawnPosMap.put(dim.getRegistryName(), p_226560_1_); -+ spawnForcedMap.put(dim.getRegistryName(), p_226560_2_); -+ if (p_226560_3_ && !p_226560_1_.equals(old)) -+ this.func_145747_a(new TranslationTextComponent("block.minecraft.bed.set_spawn")); -+ } else { -+ spawnPosMap.remove(dim.getRegistryName()); -+ spawnForcedMap.remove(dim.getRegistryName()); -+ } -+ return; -+ } - if (p_226560_1_ != null) { - if (p_226560_3_ && !p_226560_1_.equals(this.field_71077_c)) { - this.func_145747_a(new TranslationTextComponent("block.minecraft.bed.set_spawn")); -@@ -1506,6 +1622,7 @@ +@@ -1421,6 +1475,7 @@ public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) { if (this.field_71075_bZ.field_75101_c) { @@ -415,7 +253,7 @@ return false; } else { if (p_225503_1_ >= 2.0F) { -@@ -1560,6 +1677,10 @@ +@@ -1475,6 +1530,10 @@ } public void func_195068_e(int p_195068_1_) { @@ -426,7 +264,7 @@ this.func_85039_t(p_195068_1_); this.field_71106_cc += (float)p_195068_1_ / (float)this.func_71050_bK(); this.field_71067_cb = MathHelper.func_76125_a(this.field_71067_cb + p_195068_1_, 0, Integer.MAX_VALUE); -@@ -1588,7 +1709,7 @@ +@@ -1503,7 +1562,7 @@ } public void func_192024_a(ItemStack p_192024_1_, int p_192024_2_) { @@ -435,7 +273,7 @@ if (this.field_71068_ca < 0) { this.field_71068_ca = 0; this.field_71106_cc = 0.0F; -@@ -1599,6 +1720,10 @@ +@@ -1514,6 +1573,10 @@ } public void func_82242_a(int p_82242_1_) { @@ -446,32 +284,12 @@ this.field_71068_ca += p_82242_1_; if (this.field_71068_ca < 0) { this.field_71068_ca = 0; -@@ -1789,7 +1914,10 @@ - } - - public ITextComponent func_145748_c_() { -- ITextComponent itextcomponent = ScorePlayerTeam.func_200541_a(this.func_96124_cp(), this.func_200200_C_()); -+ 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); - } - -@@ -2029,4 +2157,45 @@ +@@ -1956,4 +2019,37 @@ return this.field_221260_g; } } + + // =========== FORGE START ==============// -+ public net.minecraft.world.dimension.DimensionType getSpawnDimension() { -+ return this.spawnDimension; -+ } -+ -+ public void setSpawnDimenion(net.minecraft.world.dimension.DimensionType dim) { -+ this.spawnDimension = dim; -+ } -+ + public Collection getPrefixes() { + return this.prefixes; + } diff --git a/patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch b/patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch index d27a05c5e..91625cb4f 100644 --- a/patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/player/PlayerInventory.java +++ b/net/minecraft/entity/player/PlayerInventory.java -@@ -214,7 +214,8 @@ +@@ -188,7 +188,8 @@ int i = p_191973_2_.func_190916_E(); ItemStack itemstack = this.func_70301_a(p_191973_1_); if (itemstack.func_190926_b()) { @@ -10,7 +10,7 @@ if (p_191973_2_.func_77942_o()) { itemstack.func_77982_d(p_191973_2_.func_77978_p().func_74737_b()); } -@@ -265,7 +266,7 @@ +@@ -239,7 +240,7 @@ } } } @@ -19,7 +19,7 @@ } public boolean func_70441_a(ItemStack p_70441_1_) { -@@ -318,6 +319,8 @@ +@@ -292,6 +293,8 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.func_85055_a(throwable, "Adding item to inventory"); CrashReportCategory crashreportcategory = crashreport.func_85058_a("Item being added"); diff --git a/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch b/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch index 899fbcfc2..56126b4ef 100644 --- a/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch @@ -1,6 +1,21 @@ --- a/net/minecraft/entity/player/ServerPlayerEntity.java +++ b/net/minecraft/entity/player/ServerPlayerEntity.java -@@ -432,6 +432,7 @@ +@@ -3,12 +3,8 @@ + import com.google.common.collect.Lists; + import com.mojang.authlib.GameProfile; + import com.mojang.datafixers.util.Either; +-import java.util.Collection; +-import java.util.Iterator; +-import java.util.List; +-import java.util.OptionalInt; +-import java.util.Random; +-import java.util.UUID; ++ ++import java.util.*; + import javax.annotation.Nullable; + import net.minecraft.advancements.CriteriaTriggers; + import net.minecraft.advancements.PlayerAdvancements; +@@ -464,6 +460,7 @@ } public void func_70645_a(DamageSource p_70645_1_) { @@ -8,87 +23,25 @@ boolean flag = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223609_l); if (flag) { ITextComponent itextcomponent = this.func_110142_aN().func_151521_b(); -@@ -550,13 +551,15 @@ - return this.field_71133_b.func_71219_W(); +@@ -731,6 +728,9 @@ } -+ @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; - DimensionType dimensiontype = this.field_71093_bK; -- if (dimensiontype == DimensionType.field_223229_c_ && p_212321_1_ == DimensionType.field_223227_a_) { -+ if (dimensiontype == DimensionType.field_223229_c_ && p_212321_1_ == DimensionType.field_223227_a_ && teleporter instanceof net.minecraft.world.Teleporter) { //Forge: Fix non-vanilla teleporters triggering end credits - this.func_213319_R(); -- this.func_71121_q().func_217434_e(this); -+ this.func_71121_q().removePlayer(this, true); //Forge: The player entity is cloned so keep the data until after cloning calls copyFrom - if (!this.field_71136_j) { - this.field_71136_j = true; - this.field_71135_a.func_147359_a(new SChangeGameStatePacket(4, this.field_192040_cp ? 0.0F : 1.0F)); -@@ -569,12 +572,14 @@ - this.field_71093_bK = p_212321_1_; - ServerWorld serverworld1 = this.field_71133_b.func_71218_a(p_212321_1_); - WorldInfo worldinfo = serverworld1.func_72912_H(); -+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(this.field_71135_a.field_147371_a, this); - this.field_71135_a.func_147359_a(new SRespawnPacket(p_212321_1_, WorldInfo.func_227498_c_(worldinfo.func_76063_b()), 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())); - 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(); -+ Entity e = teleporter.placeEntity(this, serverworld, serverworld1, this.field_70177_z, spawnPortal -> {//Forge: Start vanilla logic - double d0 = this.func_226277_ct_(); - double d1 = this.func_226278_cu_(); - double d2 = this.func_226281_cx_(); -@@ -583,13 +588,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.field_223227_a_ && p_212321_1_ == DimensionType.field_223228_b_) { - this.field_193110_cw = this.func_213303_ch(); -- d0 /= 8.0D; -- d2 /= 8.0D; -- } else if (dimensiontype == DimensionType.field_223228_b_ && p_212321_1_ == DimensionType.field_223227_a_) { -- d0 *= 8.0D; -- d2 *= 8.0D; - } else if (dimensiontype == DimensionType.field_223227_a_ && p_212321_1_ == DimensionType.field_223229_c_) { - BlockPos blockpos = serverworld1.func_180504_m(); - d0 = (double)blockpos.func_177958_n(); -@@ -630,7 +633,7 @@ - - this.func_70012_b((double)i, (double)j, (double)k, f1, 0.0F); - this.func_213317_d(Vec3d.field_186680_a); -- } else if (!serverworld1.func_85176_s().func_222268_a(this, f2)) { -+ } else if (spawnPortal && !serverworld1.func_85176_s().func_222268_a(this, f2)) { - serverworld1.func_85176_s().func_85188_a(this); - serverworld1.func_85176_s().func_222268_a(this, f2); - } -@@ -640,6 +643,9 @@ - serverworld1.func_217447_b(this); - this.func_213846_b(serverworld); - this.field_71135_a.func_147364_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), f1, f); -+ return this;//forge: this is part of the ITeleporter patch -+ });//Forge: End vanilla logic -+ if (e != this) throw new java.lang.IllegalArgumentException(String.format("Teleporter %s returned not the player entity but instead %s, expected PlayerEntity %s", teleporter, e, this)); - this.field_71134_c.func_73080_a(serverworld1); - this.field_71135_a.func_147359_a(new SPlayerAbilitiesPacket(this.field_71075_bZ)); - playerlist.func_72354_b(this, serverworld1); -@@ -653,6 +659,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; - } + public Either func_213819_a(BlockPos p_213819_1_) { ++ Optional optAt = Optional.of(p_213819_1_); ++ PlayerEntity.SleepResult ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, optAt); ++ 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.func_70608_bn() && this.func_70089_S()) { + if (!this.field_70170_p.func_230315_m_().func_236043_f_()) { +@@ -775,6 +775,7 @@ } -@@ -788,6 +795,7 @@ + + private boolean func_241147_a_(BlockPos p_241147_1_, Direction p_241147_2_) { ++ if (p_241147_2_ == null) return false; + return this.func_241158_g_(p_241147_1_) || this.func_241158_g_(p_241147_1_.func_177972_a(p_241147_2_.func_176734_d())); + } + +@@ -874,6 +875,7 @@ 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; @@ -96,7 +49,7 @@ return OptionalInt.of(this.field_71139_cq); } } -@@ -806,6 +814,7 @@ +@@ -892,6 +894,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); @@ -104,7 +57,7 @@ } public void func_184814_a(ItemStack p_184814_1_, Hand p_184814_2_) { -@@ -863,6 +872,7 @@ +@@ -949,6 +952,7 @@ public void func_71128_l() { this.field_71070_bA.func_75134_a(this); @@ -112,17 +65,13 @@ this.field_71070_bA = this.field_71069_bz; } -@@ -989,6 +999,20 @@ +@@ -1075,6 +1079,16 @@ 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 != DimensionType.field_223227_a_) { -+ 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. @@ -133,36 +82,7 @@ } protected void func_70670_a(EffectInstance p_70670_1_) { -@@ -1207,15 +1231,17 @@ - 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())) { -+ DimensionType oldDimension = this.field_71093_bK; - 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(); -+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(this.field_71135_a.field_147371_a, this); - this.field_71135_a.func_147359_a(new SRespawnPacket(this.field_71093_bK, WorldInfo.func_227498_c_(worldinfo.func_76063_b()), 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); -@@ -1224,6 +1250,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, oldDimension, this.field_71093_bK); - } - - } -@@ -1261,6 +1288,8 @@ +@@ -1375,6 +1389,8 @@ if (itementity == null) { return null; } else { diff --git a/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch index 4d7125243..a60a64817 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/entity/projectile/AbstractArrowEntity.java +++ b/net/minecraft/entity/projectile/AbstractArrowEntity.java -@@ -160,7 +160,7 @@ +@@ -130,7 +130,7 @@ - BlockPos blockpos = new BlockPos(this); + BlockPos blockpos = this.func_233580_cy_(); BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); - if (!blockstate.func_196958_f() && !flag) { + if (!blockstate.isAir(this.field_70170_p, blockpos) && !flag) { VoxelShape voxelshape = blockstate.func_196952_d(this.field_70170_p, blockpos); if (!voxelshape.func_197766_b()) { - Vec3d vec3d1 = this.func_213303_ch(); -@@ -218,7 +218,7 @@ + Vector3d vector3d1 = this.func_213303_ch(); +@@ -184,7 +184,7 @@ } } - if (raytraceresult != null && !flag) { + if (raytraceresult != null && raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_184549_a(raytraceresult); + this.func_70227_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 index 72ac1fc65..414bd4dd1 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/entity/projectile/DamagingProjectileEntity.java +++ b/net/minecraft/entity/projectile/DamagingProjectileEntity.java -@@ -81,7 +81,7 @@ +@@ -69,7 +69,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); + RayTraceResult raytraceresult = ProjectileHelper.func_234618_a_(this, this::func_230298_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/FireballEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch index ee544eeb7..7a057ff72 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/projectile/FireballEntity.java +++ b/net/minecraft/entity/projectile/FireballEntity.java -@@ -38,7 +38,7 @@ - this.func_174815_a(this.field_70235_a, entity); - } - +@@ -32,7 +32,7 @@ + protected void func_70227_a(RayTraceResult p_70227_1_) { + super.func_70227_a(p_70227_1_); + if (!this.field_70170_p.field_72995_K) { - boolean flag = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b); -+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a); ++ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.func_234616_v_()); this.field_70170_p.func_217398_a((Entity)null, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), (float)this.field_92057_e, flag, flag ? Explosion.Mode.DESTROY : Explosion.Mode.NONE); this.func_70106_y(); } diff --git a/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch index bbc76d9e8..8427855b6 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch @@ -1,59 +1,41 @@ --- a/net/minecraft/entity/projectile/FishingBobberEntity.java +++ b/net/minecraft/entity/projectile/FishingBobberEntity.java -@@ -207,8 +207,8 @@ - private boolean func_190625_o() { - ItemStack itemstack = this.field_146042_b.func_184614_ca(); - ItemStack itemstack1 = this.field_146042_b.func_184592_cb(); +@@ -234,8 +234,8 @@ + private boolean func_234600_a_(PlayerEntity p_234600_1_) { + ItemStack itemstack = p_234600_1_.func_184614_ca(); + ItemStack itemstack1 = p_234600_1_.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)) { + if (!p_234600_1_.field_70128_L && p_234600_1_.func_70089_S() && (flag || flag1) && !(this.func_70068_e(p_234600_1_) > 1024.0D)) { return false; } else { -@@ -292,7 +292,7 @@ - double d1 = (double)((float)MathHelper.func_76128_c(this.func_226278_cu_()) + 1.0F); - double d2 = this.func_226281_cx_() + (double)(f2 * (float)this.field_146038_az * 0.1F); - Block block = serverworld.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2)).func_177230_c(); -- if (block == Blocks.field_150355_j) { -+ if (serverworld.func_180495_p(new BlockPos((int)d0, (int)d1 - 1, (int)d2)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) { - if (this.field_70146_Z.nextFloat() < 0.15F) { - serverworld.func_195598_a(ParticleTypes.field_197612_e, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D); - } -@@ -329,7 +329,7 @@ - double d5 = (double)((float)MathHelper.func_76128_c(this.func_226278_cu_()) + 1.0F); - double d6 = this.func_226281_cx_() + (double)(MathHelper.func_76134_b(f6) * f7 * 0.1F); - Block block1 = serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)).func_177230_c(); -- if (block1 == Blocks.field_150355_j) { -+ if (serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) { - serverworld.func_195598_a(ParticleTypes.field_218422_X, d4, d5, d6, 2 + this.field_70146_Z.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D); - } - } -@@ -354,6 +354,7 @@ - public int func_146034_e(ItemStack p_146034_1_) { - if (!this.field_70170_p.field_72995_K && this.field_146042_b != null) { +@@ -408,6 +408,7 @@ + PlayerEntity playerentity = this.func_234606_i_(); + if (!this.field_70170_p.field_72995_K && playerentity != null) { int i = 0; + net.minecraftforge.event.entity.player.ItemFishedEvent event = null; if (this.field_146043_c != null) { this.func_184527_k(); - CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)this.field_146042_b, p_146034_1_, this, Collections.emptyList()); -@@ -361,8 +362,15 @@ + CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)playerentity, p_146034_1_, this, Collections.emptyList()); +@@ -415,8 +416,15 @@ i = this.field_146043_c instanceof ItemEntity ? 3 : 5; } else if (this.field_146045_ax > 0) { - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)).func_216015_a(LootParameters.field_216289_i, p_146034_1_).func_216023_a(this.field_70146_Z).func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da()); -+ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this.field_146042_b).func_216015_a(LootParameters.field_216281_a, this); + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, this.func_233580_cy_()).func_216015_a(LootParameters.field_216289_i, p_146034_1_).func_216015_a(LootParameters.field_216281_a, this).func_216023_a(this.field_70146_Z).func_186469_a((float)this.field_191518_aw + playerentity.func_184817_da()); ++ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this.func_234616_v_()).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); ++ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.field_70122_E ? 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); + CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)playerentity, p_146034_1_, this, list); for(ItemStack itemstack : list) { -@@ -387,7 +395,7 @@ +@@ -441,7 +449,7 @@ } this.func_70106_y(); @@ -62,7 +44,7 @@ } else { return 0; } -@@ -413,8 +421,9 @@ +@@ -468,8 +476,9 @@ return false; } @@ -71,6 +53,6 @@ + @Override + public void remove(boolean keepData) { + super.remove(keepData); - if (this.field_146042_b != null) { - this.field_146042_b.field_71104_cf = null; - } + PlayerEntity playerentity = this.func_234606_i_(); + if (playerentity != null) { + playerentity.field_71104_cf = null; diff --git a/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch index ee8e50480..37a64af08 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch @@ -1,11 +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); +@@ -47,7 +47,7 @@ + super.func_70071_h_(); + Vector3d vector3d = this.func_213322_ci(); + RayTraceResult raytraceresult = ProjectileHelper.func_234618_a_(this, this::func_230298_a_, RayTraceContext.BlockMode.OUTLINE); - if (raytraceresult != null) { + if (raytraceresult != null && raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_190536_a(raytraceresult); + this.func_70227_a(raytraceresult); } diff --git a/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch index bb63e85d5..55502d795 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/projectile/ProjectileHelper.java +++ b/net/minecraft/entity/projectile/ProjectileHelper.java -@@ -86,7 +86,7 @@ - Vec3d vec3d1 = optional.get(); - double d1 = p_221273_1_.func_72436_e(vec3d1); +@@ -60,7 +60,7 @@ + Vector3d vector3d1 = optional.get(); + double d1 = p_221273_1_.func_72436_e(vector3d1); if (d1 < d0 || d0 == 0.0D) { - if (entity1.func_184208_bv() == p_221273_0_.func_184208_bv()) { + if (entity1.func_184208_bv() == p_221273_0_.func_184208_bv() && !entity1.canRiderInteract()) { if (d0 == 0.0D) { entity = entity1; - vec3d = vec3d1; + vector3d = vector3d1; diff --git a/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch index 4d51dd74d..097e06f50 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/projectile/ShulkerBulletEntity.java +++ b/net/minecraft/entity/projectile/ShulkerBulletEntity.java -@@ -255,7 +255,7 @@ +@@ -214,7 +214,7 @@ } - RayTraceResult raytraceresult = ProjectileHelper.func_221266_a(this, true, false, this.field_184570_a, RayTraceContext.BlockMode.COLLIDER); + RayTraceResult raytraceresult = ProjectileHelper.func_234618_a_(this, this::func_230298_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); + this.func_70227_a(raytraceresult); } } diff --git a/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch index 8c2c14e89..d4745414a 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/projectile/ThrowableEntity.java +++ b/net/minecraft/entity/projectile/ThrowableEntity.java -@@ -130,7 +130,7 @@ - if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) { - if (raytraceresult.func_216346_c() == RayTraceResult.Type.BLOCK && this.field_70170_p.func_180495_p(((BlockRayTraceResult)raytraceresult).func_216350_a()).func_177230_c() == Blocks.field_150427_aO) { - this.func_181015_d(((BlockRayTraceResult)raytraceresult).func_216350_a()); -- } else { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)){ - this.func_70184_a(raytraceresult); +@@ -64,7 +64,7 @@ } } + +- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !flag) { ++ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.func_70227_a(raytraceresult); + } + diff --git a/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch index 6da8d57e0..50b7b8afe 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch @@ -3,18 +3,18 @@ @@ -48,7 +48,7 @@ } - public float func_180428_a(Explosion p_180428_1_, IBlockReader p_180428_2_, BlockPos p_180428_3_, BlockState p_180428_4_, IFluidState p_180428_5_, float p_180428_6_) { + public float func_180428_a(Explosion p_180428_1_, IBlockReader p_180428_2_, BlockPos p_180428_3_, BlockState p_180428_4_, FluidState 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_213868_a(EntityRayTraceResult p_213868_1_) { +@@ -90,7 +90,7 @@ protected void func_70227_a(RayTraceResult p_70227_1_) { -@@ -82,7 +82,7 @@ - } - } - + super.func_70227_a(p_70227_1_); + if (!this.field_70170_p.field_72995_K) { - Explosion.Mode explosion$mode = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; -+ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; ++ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.func_234616_v_()) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; this.field_70170_p.func_217398_a(this, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), 1.0F, false, explosion$mode); this.func_70106_y(); } diff --git a/patches/minecraft/net/minecraft/fluid/Fluid.java.patch b/patches/minecraft/net/minecraft/fluid/Fluid.java.patch index 29ed2bf07..4289db623 100644 --- a/patches/minecraft/net/minecraft/fluid/Fluid.java.patch +++ b/patches/minecraft/net/minecraft/fluid/Fluid.java.patch @@ -6,15 +6,15 @@ -public abstract class Fluid { +public abstract class Fluid extends net.minecraftforge.registries.ForgeRegistryEntry implements net.minecraftforge.common.extensions.IForgeFluid { - public static final ObjectIntIdentityMap field_207201_d = new ObjectIntIdentityMap<>(); - protected final StateContainer field_207202_e; - private IFluidState field_207200_b; + public static final ObjectIntIdentityMap field_207201_d = new ObjectIntIdentityMap<>(); + protected final StateContainer field_207202_e; + private FluidState field_207200_b; @@ -98,4 +98,26 @@ } - public abstract VoxelShape func_215664_b(IFluidState p_215664_1_, IBlockReader p_215664_2_, BlockPos p_215664_3_); + public abstract VoxelShape func_215664_b(FluidState p_215664_1_, IBlockReader p_215664_2_, BlockPos p_215664_3_); + -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.FluidTags::getGeneration, net.minecraft.tags.FluidTags::func_226157_a_); ++ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.FluidTags::func_226157_a_); + @Override + public java.util.Set getTags() { + return reverseTags.getTagNames(); diff --git a/patches/minecraft/net/minecraft/fluid/FluidState.java.patch b/patches/minecraft/net/minecraft/fluid/FluidState.java.patch new file mode 100644 index 000000000..5172b291e --- /dev/null +++ b/patches/minecraft/net/minecraft/fluid/FluidState.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/fluid/FluidState.java ++++ b/net/minecraft/fluid/FluidState.java +@@ -20,7 +20,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public final class FluidState extends StateHolder { ++public final class FluidState extends StateHolder implements net.minecraftforge.common.extensions.IForgeFluidState { + public static final Codec field_237213_a_ = func_235897_a_(Registry.field_212619_h, Fluid::func_207188_f).stable(); + + public FluidState(Fluid p_i232145_1_, ImmutableMap, Comparable> p_i232145_2_, MapCodec p_i232145_3_) { diff --git a/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch b/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch index 593382ed8..e7d85695f 100644 --- a/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch +++ b/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/fluid/LavaFluid.java +++ b/net/minecraft/fluid/LavaFluid.java -@@ -70,7 +70,7 @@ +@@ -71,7 +71,7 @@ BlockState blockstate = p_207186_1_.func_180495_p(blockpos); if (blockstate.func_196958_f()) { if (this.func_176369_e(p_207186_1_, blockpos)) { -- p_207186_1_.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P()); +- p_207186_1_.func_175656_a(blockpos, AbstractFireBlock.func_235326_a_(p_207186_1_, blockpos)); + p_207186_1_.func_175656_a(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos, p_207186_2_, Blocks.field_150480_ab.func_176223_P())); return; } } else if (blockstate.func_185904_a().func_76230_c()) { -@@ -85,7 +85,7 @@ +@@ -86,7 +86,7 @@ } if (p_207186_1_.func_175623_d(blockpos1.func_177984_a()) && this.func_176368_m(p_207186_1_, blockpos1)) { -- p_207186_1_.func_175656_a(blockpos1.func_177984_a(), Blocks.field_150480_ab.func_176223_P()); +- p_207186_1_.func_175656_a(blockpos1.func_177984_a(), AbstractFireBlock.func_235326_a_(p_207186_1_, blockpos1)); + p_207186_1_.func_175656_a(blockpos1.func_177984_a(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos1.func_177984_a(), p_207186_2_, Blocks.field_150480_ab.func_176223_P())); } } } -@@ -163,7 +163,7 @@ - IFluidState ifluidstate = p_205574_1_.func_204610_c(p_205574_2_); - if (this.func_207185_a(FluidTags.field_206960_b) && ifluidstate.func_206884_a(FluidTags.field_206959_a)) { +@@ -164,7 +164,7 @@ + FluidState fluidstate = p_205574_1_.func_204610_c(p_205574_2_); + if (this.func_207185_a(FluidTags.field_206960_b) && fluidstate.func_206884_a(FluidTags.field_206959_a)) { if (p_205574_3_.func_177230_c() instanceof FlowingFluidBlock) { - p_205574_1_.func_180501_a(p_205574_2_, Blocks.field_150348_b.func_176223_P(), 3); + p_205574_1_.func_180501_a(p_205574_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_205574_1_, p_205574_2_, p_205574_2_, Blocks.field_150348_b.func_176223_P()), 3); diff --git a/patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch index dc4132fe6..087497df5 100644 --- a/patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/inventory/container/BeaconContainer.java +++ b/net/minecraft/inventory/container/BeaconContainer.java -@@ -18,7 +18,7 @@ +@@ -17,7 +17,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_.func_77973_b().func_206844_a(ItemTags.field_232908_Z_); + return p_94041_2_.isBeaconPayment(); } public int func_70297_j_() { -@@ -88,10 +88,8 @@ +@@ -87,10 +87,8 @@ } slot.func_75220_a(itemstack1, itemstack); @@ -22,12 +22,11 @@ } else if (p_82846_2_ >= 1 && p_82846_2_ < 28) { if (!this.func_75135_a(itemstack1, 28, 37, false)) { return ItemStack.field_190927_a; -@@ -157,8 +155,7 @@ +@@ -156,7 +154,7 @@ } public boolean func_75214_a(ItemStack p_75214_1_) { -- Item item = p_75214_1_.func_77973_b(); -- return item == Items.field_151166_bC || item == Items.field_151045_i || item == Items.field_151043_k || item == Items.field_151042_j; +- return p_75214_1_.func_77973_b().func_206844_a(ItemTags.field_232908_Z_); + return p_75214_1_.isBeaconPayment(); } diff --git a/patches/minecraft/net/minecraft/inventory/container/Container.java.patch b/patches/minecraft/net/minecraft/inventory/container/Container.java.patch index 2650329de..8be4c2cfd 100644 --- a/patches/minecraft/net/minecraft/inventory/container/Container.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/Container.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/inventory/container/Container.java +++ b/net/minecraft/inventory/container/Container.java -@@ -116,9 +116,11 @@ +@@ -120,9 +120,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)) { + boolean clientStackChanged = !itemstack1.equals(itemstack, true); - itemstack1 = itemstack.func_77946_l(); - this.field_75153_a.set(i, itemstack1); + ItemStack itemstack2 = itemstack.func_77946_l(); + this.field_75153_a.set(i, itemstack2); + if (clientStackChanged) for(IContainerListener icontainerlistener : this.field_75149_d) { - icontainerlistener.func_71111_a(this, i, itemstack1); + icontainerlistener.func_71111_a(this, i, itemstack2); } -@@ -476,14 +478,15 @@ +@@ -500,14 +502,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; } -@@ -584,7 +587,7 @@ +@@ -608,7 +611,7 @@ p_94525_2_.func_190920_e(1); break; case 2: diff --git a/patches/minecraft/net/minecraft/inventory/container/ContainerType.java.patch b/patches/minecraft/net/minecraft/inventory/container/ContainerType.java.patch index d73023fcd..2854c399b 100644 --- a/patches/minecraft/net/minecraft/inventory/container/ContainerType.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/ContainerType.java.patch @@ -9,7 +9,7 @@ public static final ContainerType field_221507_a = func_221505_a("generic_9x1", ChestContainer::func_216986_a); public static final ContainerType field_221508_b = func_221505_a("generic_9x2", ChestContainer::func_216987_b); public static final ContainerType field_221509_c = func_221505_a("generic_9x3", ChestContainer::func_216988_c); -@@ -45,6 +45,14 @@ +@@ -46,6 +46,14 @@ public T func_221506_a(int p_221506_1_, PlayerInventory p_221506_2_) { return this.field_221530_x.create(p_221506_1_, p_221506_2_); } diff --git a/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch index 27509a151..bdee6765b 100644 --- a/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/inventory/container/EnchantmentContainer.java +++ b/net/minecraft/inventory/container/EnchantmentContainer.java -@@ -55,7 +55,7 @@ +@@ -56,7 +56,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()); ++ return net.minecraftforge.common.Tags.Items.GEMS_LAPIS.func_230235_a_(p_75214_1_.func_77973_b()); } }); -@@ -81,40 +81,28 @@ +@@ -82,40 +82,28 @@ this.func_216958_a(IntReferenceHolder.func_221497_a(this.field_185002_i, 2)); } @@ -23,35 +23,35 @@ 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; ++ int 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) { +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 0, k * 2)).func_203425_a(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) { +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 1, k * 2)).func_203425_a(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) { +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 0, k)).func_203425_a(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) { +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 1, k)).func_203425_a(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) { +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l, 0, k * 2)).func_203425_a(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) { +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l, 1, k * 2)).func_203425_a(Blocks.field_150342_X)) { - ++j; - } + power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 0, k)); @@ -61,7 +61,7 @@ } } } -@@ -123,12 +111,13 @@ +@@ -124,12 +112,13 @@ this.field_75169_l.setSeed((long)this.field_178149_f.func_221495_b()); for(int i1 = 0; i1 < 3; ++i1) { @@ -76,15 +76,3 @@ } 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/container/RepairContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/RepairContainer.java.patch index 412549bf5..4b187ae6b 100644 --- a/patches/minecraft/net/minecraft/inventory/container/RepairContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/RepairContainer.java.patch @@ -1,24 +1,15 @@ --- 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)); + this.field_82854_e.func_221494_a(0); + this.field_234644_e_.func_221486_a((p_234633_1_, p_234633_2_) -> { ++ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_230301_1_, p_230301_2_, RepairContainer.this.field_234643_d_.func_70301_a(0), RepairContainer.this.field_234643_d_.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 @@ + BlockState blockstate = p_234633_1_.func_180495_p(p_234633_2_); + if (!p_230301_1_.field_71075_bZ.field_75098_d && blockstate.func_235714_a_(BlockTags.field_200572_k) && p_230301_1_.func_70681_au().nextFloat() < 0.12F) { + BlockState blockstate1 = AnvilBlock.func_196433_f(blockstate); +@@ -96,8 +98,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; @@ -26,12 +17,12 @@ + 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; ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_234642_c_, 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 @@ +@@ -214,6 +219,7 @@ i += k; itemstack1.func_200302_a(new StringTextComponent(this.field_82857_m)); } @@ -39,7 +30,7 @@ this.field_82854_e.func_221494_a(j + i); if (i <= 0) { -@@ -354,4 +360,8 @@ +@@ -269,4 +275,8 @@ public int func_216976_f() { return this.field_82854_e.func_221495_b(); } diff --git a/patches/minecraft/net/minecraft/item/ArmorItem.java.patch b/patches/minecraft/net/minecraft/item/ArmorItem.java.patch index ac2688615..362f3a350 100644 --- a/patches/minecraft/net/minecraft/item/ArmorItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ArmorItem.java.patch @@ -1,11 +1,13 @@ --- a/net/minecraft/item/ArmorItem.java +++ b/net/minecraft/item/ArmorItem.java -@@ -102,4 +102,8 @@ - public int func_200881_e() { +@@ -113,6 +113,10 @@ return this.field_77879_b; } -+ + + public float getToughness() { + return this.field_189415_e; + } - } ++ + public float func_234657_f_() { + return this.field_189415_e; + } diff --git a/patches/minecraft/net/minecraft/item/AxeItem.java.patch b/patches/minecraft/net/minecraft/item/AxeItem.java.patch index b8e2616ec..cac84ad6b 100644 --- a/patches/minecraft/net/minecraft/item/AxeItem.java.patch +++ b/patches/minecraft/net/minecraft/item/AxeItem.java.patch @@ -1,11 +1,11 @@ --- 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(); +@@ -22,7 +22,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).put(Blocks.field_235368_mh_, Blocks.field_235369_mi_).put(Blocks.field_235370_mj_, Blocks.field_235371_mk_).put(Blocks.field_235377_mq_, Blocks.field_235378_mr_).put(Blocks.field_235379_ms_, Blocks.field_235380_mt_).build(); public 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())); +- super(p_i48530_2_, p_i48530_3_, p_i48530_1_, field_150917_d_, p_i48530_4_); ++ super(p_i48530_2_, p_i48530_3_, p_i48530_1_, field_150917_d_, p_i48530_4_.addToolType(net.minecraftforge.common.ToolType.AXE, p_i48530_1_.func_200925_d())); } 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 index 32cf5ad8e..4adec0c17 100644 --- a/patches/minecraft/net/minecraft/item/BlockItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BlockItem.java.patch @@ -8,10 +8,10 @@ - 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); + SoundType soundtype = blockstate1.getSoundType(world, blockpos, p_195942_1_.func_195999_j()); + world.func_184133_a(playerentity, blockpos, this.getPlaceSound(blockstate1, world, blockpos, p_195942_1_.func_195999_j()), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F); - itemstack.func_190918_g(1); - return ActionResultType.SUCCESS; - } -@@ -78,10 +78,16 @@ + if (playerentity == null || !playerentity.field_71075_bZ.field_75098_d) { + itemstack.func_190918_g(1); + } +@@ -81,10 +81,16 @@ } } @@ -28,7 +28,7 @@ @Nullable public BlockItemUseContext func_219984_b(BlockItemUseContext p_219984_1_) { return p_219984_1_; -@@ -189,10 +195,18 @@ +@@ -192,10 +198,18 @@ } public Block func_179223_d() { diff --git a/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch b/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch index 69195f1f5..e216d207e 100644 --- a/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch @@ -44,6 +44,6 @@ 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; + double d0 = 0.5D; + double d1; + if (blockstate.func_203425_a(Blocks.field_150355_j)) { diff --git a/patches/minecraft/net/minecraft/item/BowItem.java.patch b/patches/minecraft/net/minecraft/item/BowItem.java.patch index e4cfa098a..1d5f831dc 100644 --- a/patches/minecraft/net/minecraft/item/BowItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BowItem.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/item/BowItem.java +++ b/net/minecraft/item/BowItem.java -@@ -21,7 +21,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 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_) -> { -@@ -34,18 +34,23 @@ +@@ -24,18 +24,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_); @@ -31,11 +22,11 @@ if (!p_77615_2_.field_72995_K) { 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); ++ abstractarrowentity = customArrow(abstractarrowentity); + abstractarrowentity.func_234612_a_(playerentity, playerentity.field_70125_A, playerentity.field_70177_z, 0.0F, f * 3.0F, 1.0F); if (f == 1.0F) { abstractarrowentity.func_70243_d(true); -@@ -110,6 +115,10 @@ +@@ -100,6 +105,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 = !p_77659_2_.func_213356_f(itemstack).func_190926_b(); @@ -46,12 +37,14 @@ if (!p_77659_2_.field_71075_bZ.field_75098_d && !flag) { return ActionResult.func_226251_d_(itemstack); } else { -@@ -121,4 +130,8 @@ - public Predicate func_220004_b() { +@@ -112,6 +121,10 @@ return field_220007_a; } -+ -+ public AbstractArrowEntity customeArrow(AbstractArrowEntity arrow) { + ++ public AbstractArrowEntity customArrow(AbstractArrowEntity arrow) { + return arrow; + } - } ++ + public int func_230305_d_() { + return 15; + } diff --git a/patches/minecraft/net/minecraft/item/BucketItem.java.patch b/patches/minecraft/net/minecraft/item/BucketItem.java.patch index b879b155a..f58850473 100644 --- a/patches/minecraft/net/minecraft/item/BucketItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BucketItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/BucketItem.java +++ b/net/minecraft/item/BucketItem.java -@@ -30,14 +30,28 @@ +@@ -32,14 +32,28 @@ public class BucketItem extends Item { private final Fluid field_77876_a; @@ -29,7 +29,7 @@ if (raytraceresult.func_216346_c() == RayTraceResult.Type.MISS) { return ActionResult.func_226250_c_(itemstack); } else if (raytraceresult.func_216346_c() != RayTraceResult.Type.BLOCK) { -@@ -54,7 +68,10 @@ +@@ -56,7 +70,10 @@ Fluid fluid = ((IBucketPickupHandler)blockstate1.func_177230_c()).func_204508_a(p_77659_1_, blockpos, blockstate1); if (fluid != Fluids.field_204541_a) { p_77659_2_.func_71029_a(Stats.field_75929_E.func_199076_b(this)); @@ -38,10 +38,10 @@ + SoundEvent soundevent = this.field_77876_a.getAttributes().getEmptySound(); + if (soundevent == null) soundevent = fluid.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187633_N : SoundEvents.field_187630_M; + p_77659_2_.func_184185_a(soundevent, 1.0F, 1.0F); - ItemStack itemstack1 = this.func_150910_a(itemstack, p_77659_2_, fluid.func_204524_b()); + ItemStack itemstack1 = DrinkHelper.func_241445_a_(itemstack, p_77659_2_, new ItemStack(fluid.func_204524_b())); if (!p_77659_1_.field_72995_K) { CriteriaTriggers.field_204813_j.func_204817_a((ServerPlayerEntity)p_77659_2_, new ItemStack(fluid.func_204524_b())); -@@ -67,7 +84,7 @@ +@@ -69,7 +86,7 @@ return ActionResult.func_226251_d_(itemstack); } else { BlockState blockstate = p_77659_1_.func_180495_p(blockpos); @@ -50,26 +50,16 @@ if (this.func_180616_a(p_77659_2_, p_77659_1_, blockpos2, blockraytraceresult)) { this.func_203792_a(p_77659_1_, itemstack, blockpos2); if (p_77659_2_ instanceof ServerPlayerEntity) { -@@ -117,7 +134,8 @@ - BlockState blockstate = p_180616_2_.func_180495_p(p_180616_3_); - Material material = blockstate.func_185904_a(); - boolean flag = blockstate.func_227032_a_(this.field_77876_a); -- if (blockstate.func_196958_f() || flag || blockstate.func_177230_c() instanceof ILiquidContainer && ((ILiquidContainer)blockstate.func_177230_c()).func_204510_a(p_180616_2_, p_180616_3_, blockstate, this.field_77876_a)) { -+ boolean canContainFluid = canBlockContainFluid(p_180616_2_, p_180616_3_, blockstate); -+ if (blockstate.func_196958_f() || flag || canContainFluid) { - if (p_180616_2_.field_73011_w.func_177500_n() && this.field_77876_a.func_207185_a(FluidTags.field_206959_a)) { - int i = p_180616_3_.func_177958_n(); - int j = p_180616_3_.func_177956_o(); -@@ -127,7 +145,7 @@ - for(int l = 0; l < 8; ++l) { - p_180616_2_.func_195594_a(ParticleTypes.field_197594_E, (double)i + Math.random(), (double)j + Math.random(), (double)k + Math.random(), 0.0D, 0.0D, 0.0D); - } -- } else if (blockstate.func_177230_c() instanceof ILiquidContainer && this.field_77876_a == Fluids.field_204546_a) { -+ } else if (canContainFluid) { - if (((ILiquidContainer)blockstate.func_177230_c()).func_204509_a(p_180616_2_, p_180616_3_, blockstate, ((FlowingFluid)this.field_77876_a).func_207204_a(false))) { - this.func_203791_b(p_180616_1_, p_180616_2_, p_180616_3_); - } -@@ -148,7 +166,24 @@ +@@ -117,7 +134,7 @@ + } + + return true; +- } else if (block instanceof ILiquidContainer && this.field_77876_a == Fluids.field_204546_a) { ++ } else if (block instanceof ILiquidContainer && ((ILiquidContainer)block).func_204510_a(p_180616_2_,p_180616_3_,blockstate,field_77876_a)) { + ((ILiquidContainer)block).func_204509_a(p_180616_2_, p_180616_3_, blockstate, ((FlowingFluid)this.field_77876_a).func_207204_a(false)); + this.func_203791_b(p_180616_1_, p_180616_2_, p_180616_3_); + return true; +@@ -137,7 +154,24 @@ } protected void func_203791_b(@Nullable PlayerEntity p_203791_1_, IWorld p_203791_2_, BlockPos p_203791_3_) { diff --git a/patches/minecraft/net/minecraft/item/DyeColor.java.patch b/patches/minecraft/net/minecraft/item/DyeColor.java.patch index 8fce4c2bd..b145a5762 100644 --- a/patches/minecraft/net/minecraft/item/DyeColor.java.patch +++ b/patches/minecraft/net/minecraft/item/DyeColor.java.patch @@ -4,7 +4,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 net.minecraft.tags.ITag tag; private final int field_218390_z; 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_) { @@ -12,7 +12,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("forge", "dyes/" + p_i50049_4_)); ++ this.tag = net.minecraft.tags.ItemTags.func_199901_a("forge: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_i50049_7_; } @@ -25,7 +25,7 @@ + return field_193351_w; + } + -+ public net.minecraft.tags.Tag getTag() { ++ public net.minecraft.tags.ITag getTag() { + return tag; + } + diff --git a/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch b/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch index 19b52fe96..6d002b950 100644 --- a/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch +++ b/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch @@ -15,5 +15,5 @@ + @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()); + if (mapdata == null && p_195950_1_ instanceof ServerWorld) { + 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_.func_234923_W_()); diff --git a/patches/minecraft/net/minecraft/item/FishBucketItem.java.patch b/patches/minecraft/net/minecraft/item/FishBucketItem.java.patch index cd8070e4f..f51581a39 100644 --- a/patches/minecraft/net/minecraft/item/FishBucketItem.java.patch +++ b/patches/minecraft/net/minecraft/item/FishBucketItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/FishBucketItem.java +++ b/net/minecraft/item/FishBucketItem.java -@@ -25,11 +25,19 @@ +@@ -26,11 +26,19 @@ public class FishBucketItem extends BucketItem { private final EntityType field_203794_a; @@ -20,7 +20,7 @@ public void func_203792_a(World p_203792_1_, ItemStack p_203792_2_, BlockPos p_203792_3_) { if (!p_203792_1_.field_72995_K) { this.func_205357_b(p_203792_1_, p_203792_2_, p_203792_3_); -@@ -78,4 +86,9 @@ +@@ -79,4 +87,9 @@ } } diff --git a/patches/minecraft/net/minecraft/item/Food.java.patch b/patches/minecraft/net/minecraft/item/Food.java.patch index 8b1215590..6d257bb5e 100644 --- a/patches/minecraft/net/minecraft/item/Food.java.patch +++ b/patches/minecraft/net/minecraft/item/Food.java.patch @@ -25,7 +25,7 @@ this.field_221473_d = p_i50106_4_; this.field_221474_e = p_i50106_5_; - this.field_221475_f = p_i50106_6_; -+ this.field_221475_f = p_i50106_6_.stream().map(pair -> Pair., Float>of(pair::getLeft, pair.getRight())).collect(java.util.stream.Collectors.toList()); ++ this.field_221475_f = p_i50106_6_.stream().map(pair -> Pair., Float>of(pair::getFirst, pair.getSecond())).collect(java.util.stream.Collectors.toList()); } public int func_221466_a() { @@ -34,7 +34,7 @@ public List> func_221464_f() { - return this.field_221475_f; -+ return this.field_221475_f.stream().map(pair -> Pair.of(pair.getLeft() != null ? pair.getLeft().get() : null, pair.getRight())).collect(java.util.stream.Collectors.toList()); ++ return this.field_221475_f.stream().map(pair -> Pair.of(pair.getFirst() != null ? pair.getFirst().get() : null, pair.getSecond())).collect(java.util.stream.Collectors.toList()); } public static class Builder { diff --git a/patches/minecraft/net/minecraft/item/HoeItem.java.patch b/patches/minecraft/net/minecraft/item/HoeItem.java.patch index b75b128f5..e465f8111 100644 --- a/patches/minecraft/net/minecraft/item/HoeItem.java.patch +++ b/patches/minecraft/net/minecraft/item/HoeItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/HoeItem.java +++ b/net/minecraft/item/HoeItem.java -@@ -31,7 +31,9 @@ +@@ -27,7 +27,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(); diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 5169d6da0..b0108133e 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -8,21 +8,21 @@ - public static final Map field_179220_a = Maps.newHashMap(); +public class Item extends net.minecraftforge.registries.ForgeRegistryEntry implements IItemProvider, net.minecraftforge.common.extensions.IForgeItem { + public static final Map field_179220_a = net.minecraftforge.registries.GameData.getBlockItemMap(); - private static final IItemPropertyGetter field_185046_b = (p_210306_0_, p_210306_1_, p_210306_2_) -> { - return p_210306_0_.func_77951_h() ? 1.0F : 0.0F; - }; -@@ -98,6 +98,10 @@ - this.func_185043_a(new ResourceLocation("damaged"), field_185046_b); - this.func_185043_a(new ResourceLocation("damage"), field_185047_c); - } + protected static final UUID field_111210_e = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + protected static final UUID field_185050_h = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); + protected static final Random field_77697_d = new Random(); +@@ -77,6 +77,10 @@ + this.field_77777_bU = p_i48487_1_.field_200920_a; + this.field_219974_q = p_i48487_1_.field_221541_f; + this.field_234684_d_ = p_i48487_1_.field_234688_g_; + this.canRepair = p_i48487_1_.canRepair; + this.toolClasses.putAll(p_i48487_1_.toolClasses); + Object tmp = p_i48487_1_.ister == null ? null : net.minecraftforge.fml.DistExecutor.callWhenOn(Dist.CLIENT, p_i48487_1_.ister); + this.ister = tmp == null ? null : () -> (net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer) tmp; - } -@@ -157,10 +161,12 @@ + public void func_219972_a(World p_219972_1_, LivingEntity p_219972_2_, ItemStack p_219972_3_, int p_219972_4_) { +@@ -120,10 +124,12 @@ return this.func_219971_r() ? p_77654_3_.func_213357_a(p_77654_2_, p_77654_1_) : p_77654_1_; } @@ -35,7 +35,7 @@ public final int func_77612_l() { return this.field_77699_b; } -@@ -215,10 +221,12 @@ +@@ -178,10 +184,12 @@ } @Nullable @@ -48,7 +48,7 @@ public boolean func_77634_r() { return this.field_77700_c != null; } -@@ -278,7 +286,7 @@ +@@ -241,7 +249,7 @@ } public boolean func_77616_k(ItemStack p_77616_1_) { @@ -56,19 +56,19 @@ + return this.getItemStackLimit(p_77616_1_) == 1 && this.func_77645_m(); } - protected static RayTraceResult func_219968_a(World p_219968_0_, PlayerEntity p_219968_1_, RayTraceContext.FluidMode p_219968_2_) { -@@ -291,8 +299,8 @@ + protected static BlockRayTraceResult func_219968_a(World p_219968_0_, PlayerEntity p_219968_1_, RayTraceContext.FluidMode p_219968_2_) { +@@ -254,8 +262,8 @@ float f5 = MathHelper.func_76126_a(-f * ((float)Math.PI / 180F)); float f6 = f3 * f4; float f7 = f2 * f4; - double d0 = 5.0D; -- Vec3d vec3d1 = vec3d.func_72441_c((double)f6 * 5.0D, (double)f5 * 5.0D, (double)f7 * 5.0D); +- Vector3d vector3d1 = vector3d.func_72441_c((double)f6 * 5.0D, (double)f5 * 5.0D, (double)f7 * 5.0D); + double d0 = p_219968_1_.func_110148_a(PlayerEntity.REACH_DISTANCE).func_111126_e();; -+ 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_)); ++ Vector3d vector3d1 = vector3d.func_72441_c((double)f6 * d0, (double)f5 * d0, (double)f7 * d0); + return p_219968_0_.func_217299_a(new RayTraceContext(vector3d, vector3d1, RayTraceContext.BlockMode.OUTLINE, p_219968_2_, p_219968_1_)); } -@@ -308,6 +316,7 @@ +@@ -271,6 +279,7 @@ } protected boolean func_194125_a(ItemGroup p_194125_1_) { @@ -76,64 +76,72 @@ ItemGroup itemgroup = this.func_77640_w(); return itemgroup != null && (p_194125_1_ == ItemGroup.field_78027_g || p_194125_1_ == itemgroup); } -@@ -321,10 +330,44 @@ +@@ -284,10 +293,44 @@ return false; } + @Deprecated // Use ItemStack sensitive version. - public Multimap func_111205_h(EquipmentSlotType p_111205_1_) { - return HashMultimap.create(); + public Multimap func_111205_h(EquipmentSlotType p_111205_1_) { + return ImmutableMultimap.of(); } + @Nullable + private final java.util.function.Supplier ister; + private final java.util.Map toolClasses = Maps.newHashMap(); -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.ItemTags::getGeneration, net.minecraft.tags.ItemTags::func_199903_a); ++ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.ItemTags::func_199903_a); + protected final boolean canRepair; + + @Override + public boolean isRepairable(ItemStack stack) { -+ return canRepair && func_77645_m(); ++ return canRepair && func_77645_m(); + } + + @Override + public java.util.Set getToolTypes(ItemStack stack) { -+ return toolClasses.keySet(); ++ return toolClasses.keySet(); + } + + @Override + public int getHarvestLevel(ItemStack stack, net.minecraftforge.common.ToolType tool, @Nullable PlayerEntity player, @Nullable BlockState blockState) { -+ return toolClasses.getOrDefault(tool, -1); ++ return toolClasses.getOrDefault(tool, -1); + } + + @OnlyIn(Dist.CLIENT) + @Override + public final net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer getItemStackTileEntityRenderer() { -+ net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer renderer = ister != null ? ister.get() : null; -+ return renderer != null ? renderer : net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer.field_147719_a; ++ net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer renderer = ister != null ? ister.get() : null; ++ return renderer != null ? renderer : net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer.field_147719_a; + } + + @Override -+ public java.util.Set getTags() { ++ public java.util.Set getTags() { + return reverseTags.getTagNames(); + } + public boolean func_219970_i(ItemStack p_219970_1_) { return p_219970_1_.func_77973_b() == Items.field_222114_py; } -@@ -362,6 +405,9 @@ - private ItemGroup field_200923_d; +@@ -333,6 +376,9 @@ private Rarity field_208104_e = Rarity.COMMON; private Food field_221541_f; -+ private boolean canRepair = true; + private boolean field_234688_g_; ++ private boolean canRepair; + private java.util.Map toolClasses = Maps.newHashMap(); + private java.util.function.Supplier> ister; public Item.Properties func_221540_a(Food p_221540_1_) { this.field_221541_f = p_221540_1_; -@@ -401,5 +447,20 @@ +@@ -368,6 +414,7 @@ + return this; + } + ++ + public Item.Properties func_208103_a(Rarity p_208103_1_) { this.field_208104_e = p_208103_1_; return this; +@@ -377,5 +424,20 @@ + this.field_234688_g_ = true; + return this; } + + public Item.Properties setNoRepair() { diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index dc7384472..249842677 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,37 +1,37 @@ --- a/net/minecraft/item/ItemStack.java +++ b/net/minecraft/item/ItemStack.java -@@ -66,7 +66,7 @@ +@@ -72,7 +72,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public final class ItemStack { +public final class ItemStack extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeItemStack { - 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(); + public static final Codec field_234691_a_ = RecordCodecBuilder.create((p_234698_0_) -> { + return p_234698_0_.group(Registry.field_212630_s.fieldOf("id").forGetter((p_234706_0_) -> { + return p_234706_0_.field_151002_e; @@ -82,6 +82,9 @@ - private CachedBlockInfo field_179550_j; - private boolean field_179551_k; - + return Optional.ofNullable(p_234704_0_.field_77990_d); + })).apply(p_234698_0_, ItemStack::new); + }); + private net.minecraftforge.registries.IRegistryDelegate delegate; + private CompoundNBT capNBT; + - private static DecimalFormat func_208306_D() { - DecimalFormat decimalformat = new DecimalFormat("#.##"); - decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); -@@ -92,7 +95,10 @@ - this(p_i48203_1_, 1); + 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 = Util.func_200696_a(new DecimalFormat("#.##"), (p_234699_0_) -> { +@@ -109,7 +112,10 @@ + p_i231596_3_.ifPresent(this::func_77982_d); } - public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_) { -+ public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_) { this(p_i48204_1_, p_i48204_2_, null); } ++ public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_) { this(p_i48204_1_, p_i48204_2_, (CompoundNBT) null); } + 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(); this.field_77994_a = p_i48204_2_; if (this.field_151002_e != null && this.field_151002_e.func_77645_m()) { -@@ -100,6 +106,7 @@ +@@ -117,6 +123,7 @@ } this.func_190923_F(); @@ -39,7 +39,7 @@ } private void func_190923_F() { -@@ -108,6 +115,8 @@ +@@ -125,6 +132,8 @@ } private ItemStack(CompoundNBT p_i47263_1_) { @@ -48,7 +48,7 @@ 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)) { -@@ -120,6 +129,7 @@ +@@ -137,6 +146,7 @@ } this.func_190923_F(); @@ -56,7 +56,7 @@ } public static ItemStack func_199557_a(CompoundNBT p_199557_0_) { -@@ -134,7 +144,7 @@ +@@ -151,7 +161,7 @@ public boolean func_190926_b() { if (this == field_190927_a) { return true; @@ -65,7 +65,7 @@ return this.field_77994_a <= 0; } else { return true; -@@ -150,10 +160,19 @@ +@@ -167,10 +177,19 @@ } public Item func_77973_b() { @@ -86,16 +86,16 @@ 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); -@@ -161,7 +180,7 @@ +@@ -178,7 +197,7 @@ return ActionResultType.PASS; } else { Item item = this.func_77973_b(); - ActionResultType actionresulttype = item.func_195939_a(p_196084_1_); + ActionResultType actionresulttype = callback.apply(p_196084_1_); - if (playerentity != null && actionresulttype == ActionResultType.SUCCESS) { + if (playerentity != null && actionresulttype.func_226246_a_()) { playerentity.func_71029_a(Stats.field_75929_E.func_199076_b(item)); } -@@ -189,12 +208,15 @@ +@@ -206,12 +225,15 @@ if (this.field_77990_d != null) { p_77955_1_.func_218657_a("tag", this.field_77990_d.func_74737_b()); } @@ -113,7 +113,7 @@ } public boolean func_77985_e() { -@@ -202,7 +224,7 @@ +@@ -219,7 +241,7 @@ } public boolean func_77984_f() { @@ -122,7 +122,7 @@ CompoundNBT compoundnbt = this.func_77978_p(); return compoundnbt == null || !compoundnbt.func_74767_n("Unbreakable"); } else { -@@ -211,19 +233,19 @@ +@@ -228,19 +250,19 @@ } public boolean func_77951_h() { @@ -146,7 +146,7 @@ } public boolean func_96631_a(int p_96631_1_, Random p_96631_2_, @Nullable ServerPlayerEntity p_96631_3_) { -@@ -259,6 +281,7 @@ +@@ -276,6 +298,7 @@ public void func_222118_a(int p_222118_1_, T p_222118_2_, Consumer p_222118_3_) { if (!p_222118_2_.field_70170_p.field_72995_K && (!(p_222118_2_ instanceof PlayerEntity) || !((PlayerEntity)p_222118_2_).field_71075_bZ.field_75098_d)) { if (this.func_77984_f()) { @@ -154,7 +154,7 @@ if (this.func_96631_a(p_222118_1_, p_222118_2_.func_70681_au(), p_222118_2_ instanceof ServerPlayerEntity ? (ServerPlayerEntity)p_222118_2_ : null)) { p_222118_3_.accept(p_222118_2_); Item item = this.func_77973_b(); -@@ -291,7 +314,7 @@ +@@ -308,7 +331,7 @@ } public boolean func_150998_b(BlockState p_150998_1_) { @@ -162,8 +162,8 @@ + return this.func_77973_b().canHarvestBlock(this, p_150998_1_); } - public boolean func_111282_a(PlayerEntity p_111282_1_, LivingEntity p_111282_2_, Hand p_111282_3_) { -@@ -302,7 +325,7 @@ + public ActionResultType func_111282_a_(PlayerEntity p_111282_1_, LivingEntity p_111282_2_, Hand p_111282_3_) { +@@ -319,7 +342,7 @@ if (this.func_190926_b()) { return field_190927_a; } else { @@ -172,7 +172,7 @@ itemstack.func_190915_d(this.func_190921_D()); if (this.field_77990_d != null) { itemstack.field_77990_d = this.field_77990_d.func_74737_b(); -@@ -319,7 +342,7 @@ +@@ -336,7 +359,7 @@ if (p_77970_0_.field_77990_d == null && p_77970_1_.field_77990_d != null) { return false; } else { @@ -181,7 +181,7 @@ } } else { return false; -@@ -342,7 +365,7 @@ +@@ -359,7 +382,7 @@ } else if (this.field_77990_d == null && p_77959_1_.field_77990_d != null) { return false; } else { @@ -190,7 +190,7 @@ } } -@@ -652,6 +675,7 @@ +@@ -673,6 +696,7 @@ } } @@ -198,7 +198,7 @@ return list; } -@@ -772,7 +796,7 @@ +@@ -802,7 +826,7 @@ } } } else { @@ -206,8 +206,8 @@ + multimap = this.func_77973_b().getAttributeModifiers(p_111283_1_, this); } - multimap.values().forEach((p_226631_0_) -> { -@@ -915,6 +939,35 @@ + return multimap; +@@ -939,6 +963,35 @@ return this.func_77973_b().func_219971_r(); } diff --git a/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch b/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch index 133b3f114..6316a4da3 100644 --- a/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch +++ b/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/MilkBucketItem.java +++ b/net/minecraft/item/MilkBucketItem.java -@@ -15,6 +15,8 @@ +@@ -16,6 +16,8 @@ } public ItemStack func_77654_b(ItemStack p_77654_1_, World p_77654_2_, LivingEntity p_77654_3_) { @@ -9,7 +9,7 @@ if (p_77654_3_ instanceof ServerPlayerEntity) { ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)p_77654_3_; CriteriaTriggers.field_193138_y.func_193148_a(serverplayerentity, p_77654_1_); -@@ -25,10 +27,6 @@ +@@ -26,10 +28,6 @@ p_77654_1_.func_190918_g(1); } @@ -21,8 +21,8 @@ } @@ -44,4 +42,9 @@ - p_77659_2_.func_184598_c(p_77659_3_); - return ActionResult.func_226248_a_(p_77659_2_.func_184586_b(p_77659_3_)); + public ActionResult func_77659_a(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) { + return DrinkHelper.func_234707_a_(p_77659_1_, p_77659_2_, p_77659_3_); } + + @Override diff --git a/patches/minecraft/net/minecraft/item/MinecartItem.java.patch b/patches/minecraft/net/minecraft/item/MinecartItem.java.patch index 957a16961..3a0f3ef8b 100644 --- a/patches/minecraft/net/minecraft/item/MinecartItem.java.patch +++ b/patches/minecraft/net/minecraft/item/MinecartItem.java.patch @@ -7,23 +7,8 @@ - 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 (blockstate.func_235714_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(); diff --git a/patches/minecraft/net/minecraft/item/MusicDiscItem.java.patch b/patches/minecraft/net/minecraft/item/MusicDiscItem.java.patch index 915348992..de34a7e02 100644 --- a/patches/minecraft/net/minecraft/item/MusicDiscItem.java.patch +++ b/patches/minecraft/net/minecraft/item/MusicDiscItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/MusicDiscItem.java +++ b/net/minecraft/item/MusicDiscItem.java -@@ -21,17 +21,40 @@ +@@ -22,17 +22,40 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class MusicDiscItem extends Item { @@ -41,7 +41,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(); -@@ -76,6 +99,6 @@ +@@ -77,6 +100,6 @@ @OnlyIn(Dist.CLIENT) public SoundEvent func_185075_h() { diff --git a/patches/minecraft/net/minecraft/item/PickaxeItem.java.patch b/patches/minecraft/net/minecraft/item/PickaxeItem.java.patch index 9df23559a..a7b5841b4 100644 --- a/patches/minecraft/net/minecraft/item/PickaxeItem.java.patch +++ b/patches/minecraft/net/minecraft/item/PickaxeItem.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/item/PickaxeItem.java +++ b/net/minecraft/item/PickaxeItem.java -@@ -11,24 +11,17 @@ - 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); +@@ -11,25 +11,16 @@ + 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_235334_I_, 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, Blocks.field_150331_J, Blocks.field_150320_F, Blocks.field_150332_K); public 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_); @@ -9,19 +9,20 @@ } 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) { -- return i == 3; -- } else if (block != Blocks.field_150484_ah && block != Blocks.field_150482_ag && block != Blocks.field_150412_bA && block != Blocks.field_150475_bE && block != Blocks.field_150340_R && block != Blocks.field_150352_o && block != Blocks.field_150450_ax) { -- if (block != Blocks.field_150339_S && block != Blocks.field_150366_p && block != Blocks.field_150368_y && block != Blocks.field_150369_x) { -- Material material = p_150897_1_.func_185904_a(); -- return material == Material.field_151576_e || material == Material.field_151573_f || material == Material.field_151574_g; +- if (!p_150897_1_.func_203425_a(Blocks.field_150343_Z) && !p_150897_1_.func_203425_a(Blocks.field_235399_ni_) && !p_150897_1_.func_203425_a(Blocks.field_235397_ng_) && !p_150897_1_.func_203425_a(Blocks.field_235400_nj_) && !p_150897_1_.func_203425_a(Blocks.field_235398_nh_)) { +- if (!p_150897_1_.func_203425_a(Blocks.field_150484_ah) && !p_150897_1_.func_203425_a(Blocks.field_150482_ag) && !p_150897_1_.func_203425_a(Blocks.field_150412_bA) && !p_150897_1_.func_203425_a(Blocks.field_150475_bE) && !p_150897_1_.func_203425_a(Blocks.field_150340_R) && !p_150897_1_.func_203425_a(Blocks.field_150352_o) && !p_150897_1_.func_203425_a(Blocks.field_150450_ax)) { +- if (!p_150897_1_.func_203425_a(Blocks.field_150339_S) && !p_150897_1_.func_203425_a(Blocks.field_150366_p) && !p_150897_1_.func_203425_a(Blocks.field_150368_y) && !p_150897_1_.func_203425_a(Blocks.field_150369_x)) { +- Material material = p_150897_1_.func_185904_a(); +- return material == Material.field_151576_e || material == Material.field_151573_f || material == Material.field_151574_g || p_150897_1_.func_203425_a(Blocks.field_235334_I_); +- } else { +- return i >= 1; +- } - } else { -- return i >= 1; +- return i >= 2; - } - } else { -- return i >= 2; +- return i >= 3; + if (p_150897_1_.getHarvestTool() == net.minecraftforge.common.ToolType.PICKAXE) { + return i >= p_150897_1_.getHarvestLevel(); } diff --git a/patches/minecraft/net/minecraft/item/ShearsItem.java.patch b/patches/minecraft/net/minecraft/item/ShearsItem.java.patch index 2cb1d3f8e..2eaa61523 100644 --- a/patches/minecraft/net/minecraft/item/ShearsItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ShearsItem.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/item/ShearsItem.java +++ b/net/minecraft/item/ShearsItem.java -@@ -38,4 +38,26 @@ +@@ -34,4 +34,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; ++ public net.minecraft.util.ActionResultType func_111207_a(ItemStack stack, net.minecraft.entity.player.PlayerEntity playerIn, LivingEntity entity, net.minecraft.util.Hand hand) { ++ if (entity.field_70170_p.field_72995_K) return net.minecraft.util.ActionResultType.PASS; + if (entity instanceof net.minecraftforge.common.IShearable) { + net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; + BlockPos pos = new BlockPos(entity.func_226277_ct_(), entity.func_226278_cu_(), entity.func_226281_cx_()); @@ -22,8 +22,8 @@ + }); + stack.func_222118_a(1, entity, e -> e.func_213334_d(hand)); + } -+ return true; ++ return net.minecraft.util.ActionResultType.SUCCESS; + } -+ return false; ++ return net.minecraft.util.ActionResultType.PASS; + } } diff --git a/patches/minecraft/net/minecraft/item/ShovelItem.java.patch b/patches/minecraft/net/minecraft/item/ShovelItem.java.patch index 4e504aa46..14dc462f8 100644 --- a/patches/minecraft/net/minecraft/item/ShovelItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ShovelItem.java.patch @@ -9,7 +9,7 @@ } public boolean func_150897_b(BlockState p_150897_1_) { -@@ -40,7 +40,7 @@ +@@ -39,7 +39,7 @@ PlayerEntity playerentity = p_195939_1_.func_195999_j(); BlockState blockstate1 = field_195955_e.get(blockstate.func_177230_c()); BlockState blockstate2 = null; diff --git a/patches/minecraft/net/minecraft/item/ToolItem.java.patch b/patches/minecraft/net/minecraft/item/ToolItem.java.patch index 86958c9e0..c8f1ea440 100644 --- a/patches/minecraft/net/minecraft/item/ToolItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ToolItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/ToolItem.java +++ b/net/minecraft/item/ToolItem.java -@@ -26,6 +26,7 @@ +@@ -33,6 +33,7 @@ } public float func_150893_a(ItemStack p_150893_1_, BlockState p_150893_2_) { diff --git a/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch b/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch index 6d1c6fd51..4e483fc0a 100644 --- a/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch @@ -9,7 +9,7 @@ IRecipeSerializer field_222157_a = func_222156_a("crafting_shaped", new ShapedRecipe.Serializer()); IRecipeSerializer field_222158_b = func_222156_a("crafting_shapeless", new ShapelessRecipe.Serializer()); SpecialRecipeSerializer field_222159_c = func_222156_a("crafting_special_armordye", new SpecialRecipeSerializer<>(ArmorDyeRecipe::new)); -@@ -29,6 +29,7 @@ +@@ -30,6 +30,7 @@ T func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_); diff --git a/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch b/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch index 29df8567b..ff7f9642e 100644 --- a/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/crafting/Ingredient.java +++ b/net/minecraft/item/crafting/Ingredient.java -@@ -28,6 +28,12 @@ +@@ -28,15 +28,24 @@ import net.minecraft.util.registry.Registry; public class Ingredient implements Predicate { @@ -10,17 +10,14 @@ + INSTANCES.stream().filter(e -> e != null).forEach(i -> i.invalidate()); + } + - private static final Predicate field_209362_b = (p_209361_0_) -> { - return !p_209361_0_.func_199799_a().stream().allMatch(ItemStack::func_190926_b); - }; -@@ -35,11 +41,14 @@ + public static final Ingredient field_193370_a = new Ingredient(Stream.empty()); private final Ingredient.IItemList[] field_199807_b; private ItemStack[] field_193371_b; private IntList field_194140_c; + private final boolean isSimple; protected Ingredient(Stream p_i49381_1_) { - this.field_199807_b = p_i49381_1_.filter(field_209362_b).toArray((p_209360_0_) -> { + this.field_199807_b = p_i49381_1_.toArray((p_209360_0_) -> { return new Ingredient.IItemList[p_209360_0_]; }); + this.isSimple = !Arrays.stream(field_199807_b).anyMatch(list -> list.func_199799_a().stream().anyMatch(stack -> stack.func_77973_b().func_77645_m())); @@ -28,7 +25,7 @@ } public ItemStack[] func_193365_a() { -@@ -93,6 +102,10 @@ +@@ -91,6 +100,10 @@ public final void func_199564_a(PacketBuffer p_199564_1_) { this.func_199806_d(); @@ -39,7 +36,7 @@ p_199564_1_.func_150787_b(this.field_193371_b.length); for(int i = 0; i < this.field_193371_b.length; ++i) { -@@ -119,6 +132,25 @@ +@@ -117,6 +130,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()); } @@ -58,14 +55,14 @@ + } + + public net.minecraftforge.common.crafting.IIngredientSerializer getSerializer() { -+ if (!isVanilla()) throw new IllegalStateException("Modderrs must implement Ingredient.getSerializer in their custom Ingredients: " + this); ++ if (!isVanilla()) throw new IllegalStateException("Modders must implement Ingredient.getSerializer in their custom Ingredients: " + this); + return net.minecraftforge.common.crafting.VanillaIngredientSerializer.INSTANCE; + } + 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; -@@ -142,6 +174,9 @@ +@@ -144,6 +176,9 @@ public static Ingredient func_199566_b(PacketBuffer p_199566_0_) { int i = p_199566_0_.func_150792_a(); @@ -75,7 +72,7 @@ return func_209357_a(Stream.generate(() -> { return new Ingredient.SingleItemList(p_199566_0_.func_150791_c()); }).limit((long)i)); -@@ -149,6 +184,8 @@ +@@ -151,6 +186,8 @@ public static Ingredient func_199802_a(@Nullable JsonElement p_199802_0_) { if (p_199802_0_ != null && !p_199802_0_.isJsonNull()) { @@ -84,11 +81,11 @@ if (p_199802_0_.isJsonObject()) { return func_209357_a(Stream.of(func_199803_a(p_199802_0_.getAsJsonObject()))); } else if (p_199802_0_.isJsonArray()) { -@@ -190,6 +227,12 @@ +@@ -192,6 +229,12 @@ } } -+ //Merges several vanilla Ingredients together. As a qwerk of how the json is structured, we can't tell if its a single Ingredient type or multiple so we split per item and remerge here. ++ //Merges several vanilla Ingredients together. As a quirk of how the json is structured, we can't tell if its a single Ingredient type or multiple so we split per item and re-merge here. + //Only public for internal use, so we can access a private field in here. + public static Ingredient merge(Collection parts) { + return func_209357_a(parts.stream().flatMap(i -> Arrays.stream(i.field_199807_b))); @@ -97,12 +94,12 @@ public interface IItemList { Collection func_199799_a(); -@@ -228,6 +271,9 @@ +@@ -230,6 +273,9 @@ list.add(new ItemStack(item)); } + if (list.size() == 0 && !net.minecraftforge.common.ForgeConfig.SERVER.treatEmptyTagsAsAir.get()) { -+ list.add(new ItemStack(net.minecraft.block.Blocks.field_180401_cv).func_200302_a(new net.minecraft.util.text.StringTextComponent("Empty Tag: " + field_199800_a.func_199886_b().toString()))); ++ list.add(new ItemStack(net.minecraft.block.Blocks.field_180401_cv).func_200302_a(new net.minecraft.util.text.StringTextComponent("Empty Tag: " + TagCollectionManager.func_232928_e_().func_232925_b_().func_232975_b_(this.field_199800_a).toString()))); + } return list; } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch index 152ea533f..5325729d7 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/item/crafting/RecipeManager.java +++ b/net/minecraft/item/crafting/RecipeManager.java -@@ -50,9 +50,18 @@ +@@ -51,9 +51,18 @@ - for(Entry entry : p_212853_1_.entrySet()) { + for(Entry entry : p_212853_1_.entrySet()) { ResourceLocation resourcelocation = entry.getKey(); + if (resourcelocation.func_110623_a().startsWith("_")) continue; //Forge: filter anything beginning with "_" as it's used for metadata. try { -+ if (!net.minecraftforge.common.crafting.CraftingHelper.processConditions(entry.getValue(), "conditions")) { ++ if (entry.getValue().isJsonObject() && !net.minecraftforge.common.crafting.CraftingHelper.processConditions(entry.getValue().getAsJsonObject(), "conditions")) { + field_199521_c.debug("Skipping loading recipe {} as it's conditions were not met", resourcelocation); + continue; + } - IRecipe irecipe = func_215377_a(resourcelocation, entry.getValue()); + IRecipe irecipe = func_215377_a(resourcelocation, JSONUtils.func_151210_l(entry.getValue(), "top element")); + if (irecipe == null) { + field_199521_c.info("Skipping loading recipe {} as it's serializer returned null", resourcelocation); + continue; diff --git a/patches/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch index fc263ce75..bdffaa92e 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/crafting/RepairItemRecipe.java +++ b/net/minecraft/item/crafting/RepairItemRecipe.java -@@ -22,7 +22,7 @@ +@@ -27,7 +27,7 @@ list.add(itemstack); if (list.size() > 1) { ItemStack itemstack1 = list.get(0); @@ -9,7 +9,7 @@ return false; } } -@@ -41,7 +41,7 @@ +@@ -46,7 +46,7 @@ list.add(itemstack); if (list.size() > 1) { ItemStack itemstack1 = list.get(0); @@ -18,7 +18,7 @@ return ItemStack.field_190927_a; } } -@@ -51,12 +51,12 @@ +@@ -56,12 +56,12 @@ if (list.size() == 2) { ItemStack itemstack3 = list.get(0); ItemStack itemstack4 = list.get(1); diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch index 93b58b6c4..0a4181255 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch @@ -43,7 +43,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()); -@@ -194,15 +217,15 @@ +@@ -192,15 +215,15 @@ private static String[] func_192407_a(JsonArray p_192407_0_) { String[] astring = new String[p_192407_0_.size()]; @@ -63,7 +63,7 @@ } if (i > 0 && astring[0].length() != s.length()) { -@@ -244,11 +267,12 @@ +@@ -242,11 +265,12 @@ throw new JsonParseException("Disallowed data tag found"); } else { int i = JSONUtils.func_151208_a(p_199798_0_, "count", 1); diff --git a/patches/minecraft/net/minecraft/item/crafting/SmithingRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/SmithingRecipe.java.patch new file mode 100644 index 000000000..ffcb24528 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/SmithingRecipe.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/item/crafting/SmithingRecipe.java ++++ b/net/minecraft/item/crafting/SmithingRecipe.java +@@ -69,7 +69,7 @@ + return IRecipeType.field_234827_g_; + } + +- public static class Serializer implements IRecipeSerializer { ++ public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements IRecipeSerializer { + public SmithingRecipe func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { + Ingredient ingredient = Ingredient.func_199802_a(JSONUtils.func_152754_s(p_199425_2_, "base")); + Ingredient ingredient1 = Ingredient.func_199802_a(JSONUtils.func_152754_s(p_199425_2_, "addition")); diff --git a/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch b/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch index eaca9d010..acbf25abe 100644 --- a/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/nbt/CompoundNBT.java +++ b/net/minecraft/nbt/CompoundNBT.java -@@ -39,6 +39,7 @@ +@@ -49,6 +49,7 @@ while((b0 = CompoundNBT.func_152447_a(p_225649_1_, p_225649_3_)) != 0) { String s = CompoundNBT.func_152448_b(p_225649_1_, p_225649_3_); p_225649_3_.func_152450_a((long)(224 + 16 * s.length())); @@ -8,7 +8,7 @@ INBT inbt = CompoundNBT.func_229680_b_(NBTTypes.func_229710_a_(b0), s, p_225649_1_, p_225649_2_ + 1, p_225649_3_); if (map.put(s, inbt) != null) { p_225649_3_.func_152450_a(288L); -@@ -94,6 +95,7 @@ +@@ -104,6 +105,7 @@ @Nullable public INBT func_218657_a(String p_218657_1_, INBT p_218657_2_) { @@ -16,7 +16,7 @@ return this.field_74784_a.put(p_218657_1_, p_218657_2_); } -@@ -410,11 +412,12 @@ +@@ -408,11 +410,12 @@ } private static byte func_152447_a(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException { diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index cf6e70f88..5055d8d3f 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/nbt/CompressedStreamTools.java +++ b/net/minecraft/nbt/CompressedStreamTools.java -@@ -110,10 +110,12 @@ +@@ -92,10 +92,12 @@ 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(); diff --git a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch index fd756db38..15a9249eb 100644 --- a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -16,7 +16,7 @@ try { this.func_150723_a(ProtocolType.HANDSHAKING); -@@ -173,7 +175,7 @@ +@@ -171,7 +173,7 @@ ++this.field_211395_r; if (protocoltype1 != protocoltype) { field_150735_g.debug("Disabled auto read"); @@ -25,7 +25,7 @@ } if (this.field_150746_k.eventLoop().inEventLoop()) { -@@ -257,7 +259,9 @@ +@@ -255,7 +257,9 @@ @OnlyIn(Dist.CLIENT) public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) { @@ -35,7 +35,7 @@ Class oclass; LazyValue lazyvalue; if (Epoll.isAvailable() && p_181124_2_) { -@@ -285,6 +289,7 @@ +@@ -282,6 +286,7 @@ @OnlyIn(Dist.CLIENT) public static NetworkManager func_150722_a(SocketAddress p_150722_0_) { final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND); @@ -43,7 +43,7 @@ (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); -@@ -376,6 +381,14 @@ +@@ -373,6 +378,14 @@ return this.field_211397_t; } diff --git a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch index 53b4733d3..d680e83f4 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 -@@ -42,11 +42,12 @@ +@@ -41,11 +41,12 @@ public class NetworkSystem { private static final Logger field_151275_b = LogManager.getLogger(); @@ -15,7 +15,7 @@ }); private final MinecraftServer field_151273_d; public volatile boolean field_151277_a; -@@ -59,6 +60,7 @@ +@@ -58,6 +59,7 @@ } public void func_151265_a(@Nullable InetAddress p_151265_1_, int p_151265_2_) throws IOException { @@ -23,8 +23,8 @@ synchronized(this.field_151274_e) { Class oclass; LazyValue lazyvalue; -@@ -80,7 +82,7 @@ - ; +@@ -78,7 +80,7 @@ + } catch (ChannelException channelexception) { } - 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)); diff --git a/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch b/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch index 9b6d57a65..4718c51fb 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 -@@ -35,7 +35,7 @@ +@@ -39,7 +39,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -9,7 +9,7 @@ private final ByteBuf field_150794_a; public PacketBuffer(ByteBuf p_i45154_1_) { -@@ -265,6 +265,15 @@ +@@ -288,6 +288,15 @@ } public PacketBuffer func_150788_a(ItemStack p_150788_1_) { @@ -25,7 +25,7 @@ if (p_150788_1_.func_190926_b()) { this.writeBoolean(false); } else { -@@ -274,7 +283,7 @@ +@@ -297,7 +306,7 @@ this.writeByte(p_150788_1_.func_190916_E()); CompoundNBT compoundnbt = null; if (item.func_77645_m() || item.func_77651_p()) { @@ -34,7 +34,7 @@ } this.func_150786_a(compoundnbt); -@@ -290,7 +299,7 @@ +@@ -313,7 +322,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/datasync/EntityDataManager.java.patch b/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch index c2ebd8ff1..22b2dcd78 100644 --- a/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch +++ b/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch @@ -14,5 +14,5 @@ + if (field_190303_a.isDebugEnabled()) field_190303_a.warn("defineId called for: {} from {}", p_187226_0_, oclass, new RuntimeException()); + else field_190303_a.warn("defineId called for: {} from {}", p_187226_0_, oclass); } - } catch (ClassNotFoundException var5) { - ; + } catch (ClassNotFoundException classnotfoundexception) { + } diff --git a/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch b/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch index 0e83ffd3d..60095e033 100644 --- a/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch +++ b/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/handshake/ServerHandshakeNetHandler.java +++ b/net/minecraft/network/handshake/ServerHandshakeNetHandler.java -@@ -21,6 +21,7 @@ +@@ -23,6 +23,7 @@ } public void func_147383_a(CHandshakePacket p_147383_1_) { diff --git a/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch b/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch index a76cabf10..7a57a033d 100644 --- a/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch +++ b/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/play/ServerPlayNetHandler.java +++ b/net/minecraft/network/play/ServerPlayNetHandler.java -@@ -336,9 +336,11 @@ +@@ -347,9 +347,11 @@ } entity.func_70080_a(d3, d4, d5, f, f1); @@ -12,18 +12,27 @@ this.field_147371_a.func_179290_a(new SMoveVehiclePacket(entity)); return; } -@@ -845,7 +847,9 @@ +@@ -366,7 +368,7 @@ + } + + private boolean func_241162_a_(Entity p_241162_1_) { +- return p_241162_1_.field_70170_p.func_234853_a_(p_241162_1_.func_174813_aQ().func_186662_g(0.0625D).func_72321_a(0.0D, -0.55D, 0.0D)).allMatch(AbstractBlock.AbstractBlockState::func_196958_f); ++ return BlockPos.func_239581_a_(p_241162_1_.func_174813_aQ().func_186662_g(0.0625D).func_72321_a(0.0D, -0.55D, 0.0D)).allMatch(b -> p_241162_1_.field_70170_p.func_180495_p(b).isAir(p_241162_1_.field_70170_p, b)); + } + + public void func_184339_a(CConfirmTeleportPacket p_184339_1_) { +@@ -887,7 +889,9 @@ Direction direction = blockraytraceresult.func_216354_b(); this.field_147369_b.func_143004_u(); - if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z() - 1 || direction != Direction.UP && blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) { + if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) { - if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && serverworld.func_175660_a(this.field_147369_b, blockpos)) { + double dist = field_147369_b.func_110148_a(net.minecraft.entity.player.PlayerEntity.REACH_DISTANCE).func_111126_e() + 3; + dist *= dist; + if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && serverworld.func_175660_a(this.field_147369_b, blockpos)) { ActionResultType actionresulttype = this.field_147369_b.field_71134_c.func_219441_a(this.field_147369_b, serverworld, itemstack, hand, blockraytraceresult); - if (actionresulttype.func_226247_b_()) { - this.field_147369_b.func_226292_a_(hand, true); -@@ -968,7 +972,9 @@ + if (direction == Direction.UP && !actionresulttype.func_226246_a_() && blockpos.func_177956_o() >= this.field_147367_d.func_71207_Z() - 1 && func_241166_a_(this.field_147369_b, itemstack)) { + ITextComponent itextcomponent = (new TranslationTextComponent("build.tooHigh", this.field_147367_d.func_71207_Z())).func_240699_a_(TextFormatting.RED); +@@ -1020,7 +1024,9 @@ if (s.startsWith("/")) { this.func_147361_d(s); } else { @@ -31,27 +40,18 @@ + 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); + this.field_147367_d.func_184103_al().func_232641_a_(itextcomponent, ChatType.CHAT, this.field_147369_b.func_110124_au()); } -@@ -1061,6 +1067,7 @@ - this.field_147369_b.func_190775_a(entity, hand); +@@ -1109,6 +1115,7 @@ + if (p_147340_1_.func_149565_c() == CUseEntityPacket.Action.INTERACT) { + optional = Optional.of(this.field_147369_b.func_190775_a(entity, hand)); } else if (p_147340_1_.func_149565_c() == CUseEntityPacket.Action.INTERACT_AT) { - Hand hand1 = p_147340_1_.func_186994_b(); -+ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), hand1) != null) return; - ActionResultType actionresulttype = entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), hand1); - if (actionresulttype.func_226247_b_()) { - this.field_147369_b.func_226292_a_(hand1, true); -@@ -1094,7 +1101,7 @@ - return; - } - -- this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, DimensionType.field_223227_a_, false); -+ this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, this.field_147369_b.field_71093_bK, false); - if (this.field_147367_d.func_71199_h()) { - this.field_147369_b.func_71033_a(GameType.SPECTATOR); - this.field_147369_b.func_71121_q().func_82736_K().func_223585_a(GameRules.field_223613_p).func_223570_a(false, this.field_147367_d); -@@ -1268,6 +1275,8 @@ ++ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), hand) != null) return; + optional = Optional.of(entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), hand)); + } 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) { +@@ -1320,6 +1327,8 @@ } public void func_147349_a(CCustomPayloadPacket p_147349_1_) { diff --git a/patches/minecraft/net/minecraft/network/play/server/SJoinGamePacket.java.patch b/patches/minecraft/net/minecraft/network/play/server/SJoinGamePacket.java.patch index 042734589..d3a8aa966 100644 --- a/patches/minecraft/net/minecraft/network/play/server/SJoinGamePacket.java.patch +++ b/patches/minecraft/net/minecraft/network/play/server/SJoinGamePacket.java.patch @@ -1,28 +1,10 @@ --- a/net/minecraft/network/play/server/SJoinGamePacket.java +++ b/net/minecraft/network/play/server/SJoinGamePacket.java @@ -21,6 +21,7 @@ - private int field_218729_g; - private boolean field_179745_h; - private boolean field_229741_j_; + private boolean field_149204_b; + private GameType field_149205_c; + private GameType field_241785_e_; + private int dimensionInt; - - public SJoinGamePacket() { - } -@@ -44,7 +45,7 @@ - this.field_149204_b = (i & 8) == 8; - i = i & -9; - this.field_149205_c = GameType.func_77146_a(i); -- this.field_149202_d = DimensionType.func_186069_a(p_148837_1_.readInt()); -+ this.dimensionInt = p_148837_1_.readInt(); - this.field_229740_b_ = p_148837_1_.readLong(); - this.field_149200_f = p_148837_1_.readUnsignedByte(); - this.field_149201_g = WorldType.func_77130_a(p_148837_1_.func_150789_c(16)); -@@ -100,7 +101,7 @@ - - @OnlyIn(Dist.CLIENT) - public DimensionType func_212642_e() { -- return this.field_149202_d; -+ return this.field_149202_d == null ? this.field_149202_d = net.minecraftforge.fml.network.NetworkHooks.getDummyDimType(this.dimensionInt) : this.field_149202_d; - } - - @OnlyIn(Dist.CLIENT) + private Set> field_240811_e_; + private IDynamicRegistries.Impl field_240812_f_; + private RegistryKey field_240813_g_; diff --git a/patches/minecraft/net/minecraft/network/play/server/SRespawnPacket.java.patch b/patches/minecraft/net/minecraft/network/play/server/SRespawnPacket.java.patch index 70c58689e..770416d5f 100644 --- a/patches/minecraft/net/minecraft/network/play/server/SRespawnPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/play/server/SRespawnPacket.java.patch @@ -1,28 +1,10 @@ --- a/net/minecraft/network/play/server/SRespawnPacket.java +++ b/net/minecraft/network/play/server/SRespawnPacket.java @@ -15,6 +15,7 @@ + public class SRespawnPacket implements IPacket { + private RegistryKey field_240822_a_; + private RegistryKey field_149088_a; ++ private int dimensionInt; private long field_229746_b_; private GameType field_149087_c; - private WorldType field_149085_d; -+ private int dimensionInt; - - public SRespawnPacket() { - } -@@ -31,7 +32,7 @@ - } - - public void func_148837_a(PacketBuffer p_148837_1_) throws IOException { -- this.field_149088_a = DimensionType.func_186069_a(p_148837_1_.readInt()); -+ this.dimensionInt = p_148837_1_.readInt(); - this.field_229746_b_ = p_148837_1_.readLong(); - this.field_149087_c = GameType.func_77146_a(p_148837_1_.readUnsignedByte()); - this.field_149085_d = WorldType.func_77130_a(p_148837_1_.func_150789_c(16)); -@@ -50,7 +51,7 @@ - - @OnlyIn(Dist.CLIENT) - public DimensionType func_212643_b() { -- return this.field_149088_a; -+ return this.field_149088_a == null ? this.field_149088_a = net.minecraftforge.fml.network.NetworkHooks.getDummyDimType(this.dimensionInt) : this.field_149088_a; - } - - @OnlyIn(Dist.CLIENT) + private GameType field_241787_e_; diff --git a/patches/minecraft/net/minecraft/particles/BlockParticleData.java.patch b/patches/minecraft/net/minecraft/particles/BlockParticleData.java.patch index 0611b41a4..d97bc3b09 100644 --- a/patches/minecraft/net/minecraft/particles/BlockParticleData.java.patch +++ b/patches/minecraft/net/minecraft/particles/BlockParticleData.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/particles/BlockParticleData.java +++ b/net/minecraft/particles/BlockParticleData.java -@@ -45,4 +45,15 @@ +@@ -54,4 +54,15 @@ public BlockState func_197584_c() { return this.field_197587_c; } diff --git a/patches/minecraft/net/minecraft/particles/ItemParticleData.java.patch b/patches/minecraft/net/minecraft/particles/ItemParticleData.java.patch index 7181811a3..d1092f07c 100644 --- a/patches/minecraft/net/minecraft/particles/ItemParticleData.java.patch +++ b/patches/minecraft/net/minecraft/particles/ItemParticleData.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/particles/ItemParticleData.java +++ b/net/minecraft/particles/ItemParticleData.java -@@ -28,7 +28,7 @@ +@@ -37,7 +37,7 @@ public ItemParticleData(ParticleType p_i47952_1_, ItemStack p_i47952_2_) { this.field_197558_b = p_i47952_1_; diff --git a/patches/minecraft/net/minecraft/particles/ParticleType.java.patch b/patches/minecraft/net/minecraft/particles/ParticleType.java.patch index 4d37db66b..a21e81177 100644 --- a/patches/minecraft/net/minecraft/particles/ParticleType.java.patch +++ b/patches/minecraft/net/minecraft/particles/ParticleType.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/particles/ParticleType.java +++ b/net/minecraft/particles/ParticleType.java -@@ -3,7 +3,7 @@ +@@ -4,7 +4,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; --public class ParticleType { -+public class ParticleType extends net.minecraftforge.registries.ForgeRegistryEntry> { +-public abstract class ParticleType { ++public abstract class ParticleType extends net.minecraftforge.registries.ForgeRegistryEntry>{ private final boolean field_197581_e; private final IParticleData.IDeserializer field_197582_f; diff --git a/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch b/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch index e0438e948..0747c59fd 100644 --- a/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch +++ b/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/particles/ParticleTypes.java +++ b/net/minecraft/particles/ParticleTypes.java -@@ -2,6 +2,7 @@ - +@@ -4,6 +4,7 @@ + import java.util.function.Function; import net.minecraft.util.registry.Registry; +@net.minecraftforge.registries.ObjectHolder("minecraft") diff --git a/patches/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch b/patches/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch index 012842b6d..7767d3c73 100644 --- a/patches/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/pathfinding/PathNodeType.java +++ b/net/minecraft/pathfinding/PathNodeType.java -@@ -33,4 +33,13 @@ +@@ -34,4 +34,13 @@ public float func_186289_a() { return this.field_186307_r; } diff --git a/patches/minecraft/net/minecraft/pathfinding/SwimmerPathNavigator.java.patch b/patches/minecraft/net/minecraft/pathfinding/SwimmerPathNavigator.java.patch deleted file mode 100644 index a0be4a92b..000000000 --- a/patches/minecraft/net/minecraft/pathfinding/SwimmerPathNavigator.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/pathfinding/SwimmerPathNavigator.java -+++ b/net/minecraft/pathfinding/SwimmerPathNavigator.java -@@ -68,7 +68,8 @@ - - int i = 6; - Vec3d vec3d2 = this.field_75514_c.func_186310_f(); -- if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d2.field_72450_a + 0.5D)) < (double)f1 && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d2.field_72449_c + 0.5D)) < (double)f1 && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d2.field_72448_b) < (double)(f1 * 2.0F)) { -+ // Forge: fix MC-94054 -+ if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d2.field_72450_a + ((int)(this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)f1 && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d2.field_72449_c + ((int)(this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)f1 && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d2.field_72448_b) < (double)(f1 * 2.0F)) { - this.field_75514_c.func_75875_a(); - } - diff --git a/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch b/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch index f1d47f3df..ca7ef63af 100644 --- a/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch @@ -1,35 +1,15 @@ --- a/net/minecraft/pathfinding/WalkNodeProcessor.java +++ b/net/minecraft/pathfinding/WalkNodeProcessor.java -@@ -383,16 +383,9 @@ - for(int j = -1; j <= 1; ++j) { - for(int k = -1; k <= 1; ++k) { - if (i != 0 || k != 0) { -- Block block = p_193578_0_.func_180495_p(blockpos$pooledmutable.func_181079_c(i + p_193578_1_, j + p_193578_2_, k + p_193578_3_)).func_177230_c(); -- if (block == Blocks.field_150434_aF) { -- p_193578_4_ = PathNodeType.DANGER_CACTUS; -- } else if (block != Blocks.field_150480_ab && block != Blocks.field_150353_l) { -- if (block == Blocks.field_222434_lW) { -- p_193578_4_ = PathNodeType.DANGER_OTHER; -- } -- } else { -- p_193578_4_ = PathNodeType.DANGER_FIRE; -- } -+ PathNodeType type = func_189553_b(p_193578_0_, p_193578_1_ + i, p_193578_2_ + j, p_193578_3_ + k).getDanger(); -+ if (type != null) -+ p_193578_4_ = type; - } - } - } -@@ -405,9 +398,11 @@ - protected static PathNodeType func_189553_b(IBlockReader p_189553_0_, int p_189553_1_, int p_189553_2_, int p_189553_3_) { - BlockPos blockpos = new BlockPos(p_189553_1_, p_189553_2_, p_189553_3_); - BlockState blockstate = p_189553_0_.func_180495_p(blockpos); -+ PathNodeType type = blockstate.getAiPathNodeType(p_189553_0_, blockpos); +@@ -478,9 +478,11 @@ + + protected static PathNodeType func_237238_b_(IBlockReader p_237238_0_, BlockPos p_237238_1_) { + BlockState blockstate = p_237238_0_.func_180495_p(p_237238_1_); ++ PathNodeType type = blockstate.getAiPathNodeType(p_237238_0_, p_237238_1_); + if (type != null) return type; Block block = blockstate.func_177230_c(); Material material = blockstate.func_185904_a(); - if (blockstate.func_196958_f()) { -+ if (blockstate.isAir(p_189553_0_, blockpos)) { ++ if (blockstate.isAir(p_237238_0_, p_237238_1_)) { return PathNodeType.OPEN; - } else if (!block.func_203417_a(BlockTags.field_212185_E) && block != Blocks.field_196651_dG) { - if (block == Blocks.field_150480_ab) { + } else if (!blockstate.func_235714_a_(BlockTags.field_212185_E) && !blockstate.func_203425_a(Blocks.field_196651_dG)) { + if (blockstate.func_203425_a(Blocks.field_150434_aF)) { diff --git a/patches/minecraft/net/minecraft/potion/Effect.java.patch b/patches/minecraft/net/minecraft/potion/Effect.java.patch index 5608193c0..8d1721897 100644 --- a/patches/minecraft/net/minecraft/potion/Effect.java.patch +++ b/patches/minecraft/net/minecraft/potion/Effect.java.patch @@ -6,6 +6,6 @@ -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 Map field_111188_I = Maps.newHashMap(); private final EffectType field_220305_b; private final int field_76414_N; diff --git a/patches/minecraft/net/minecraft/potion/EffectInstance.java.patch b/patches/minecraft/net/minecraft/potion/EffectInstance.java.patch index 50dd4ad31..285222c85 100644 --- a/patches/minecraft/net/minecraft/potion/EffectInstance.java.patch +++ b/patches/minecraft/net/minecraft/potion/EffectInstance.java.patch @@ -26,7 +26,7 @@ } public int func_76459_b() { -@@ -231,11 +232,12 @@ +@@ -230,11 +231,12 @@ this.field_230115_j_.func_82719_a(compoundnbt); p_230119_1_.func_218657_a("HiddenEffect", compoundnbt); } @@ -40,7 +40,7 @@ Effect effect = Effect.func_188412_a(i); return effect == null ? null : func_230116_a_(effect, p_82722_0_); } -@@ -259,7 +261,7 @@ +@@ -258,7 +260,7 @@ effectinstance = func_230116_a_(p_230116_0_, p_230116_1_.func_74775_l("HiddenEffect")); } @@ -49,7 +49,7 @@ } @OnlyIn(Dist.CLIENT) -@@ -274,6 +276,32 @@ +@@ -273,6 +275,32 @@ public int compareTo(EffectInstance p_compareTo_1_) { int i = 32147; diff --git a/patches/minecraft/net/minecraft/potion/Effects.java.patch b/patches/minecraft/net/minecraft/potion/Effects.java.patch index 7d0df2667..7975ade0d 100644 --- a/patches/minecraft/net/minecraft/potion/Effects.java.patch +++ b/patches/minecraft/net/minecraft/potion/Effects.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/potion/Effects.java +++ b/net/minecraft/potion/Effects.java -@@ -9,6 +9,7 @@ +@@ -8,6 +8,7 @@ import net.minecraft.world.Difficulty; import net.minecraft.world.server.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)); + public static final Effect field_76424_c = func_220308_a(1, "speed", (new Effect(EffectType.BENEFICIAL, 8171462)).func_220304_a(Attributes.field_233821_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(Attributes.field_233821_d_, "7107DE5E-7CE8-4030-940E-514C1F160890", (double)-0.15F, AttributeModifier.Operation.MULTIPLY_TOTAL)); diff --git a/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch b/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch index 7de69e80c..2bc631b7f 100644 --- a/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/potion/PotionBrewing.java +++ b/net/minecraft/potion/PotionBrewing.java -@@ -57,7 +57,7 @@ +@@ -56,7 +56,7 @@ int i = 0; for(int j = field_185213_a.size(); i < j; ++i) { @@ -9,7 +9,7 @@ return true; } } -@@ -79,7 +79,7 @@ +@@ -78,7 +78,7 @@ for(int j = field_185214_b.size(); i < j; ++i) { PotionBrewing.MixPredicate mixpredicate = field_185214_b.get(i); @@ -18,7 +18,7 @@ return true; } } -@@ -93,7 +93,7 @@ +@@ -92,7 +92,7 @@ for(int j = field_185213_a.size(); i < j; ++i) { PotionBrewing.MixPredicate mixpredicate = field_185213_a.get(i); @@ -27,29 +27,29 @@ return true; } } -@@ -109,8 +109,8 @@ +@@ -108,8 +108,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), potion); +- return PotionUtils.func_185188_a(new ItemStack(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()), potion); ++ return PotionUtils.func_185188_a(new ItemStack(mixpredicate.field_185200_c.get()), potion); } } -@@ -118,8 +118,8 @@ +@@ -117,8 +117,8 @@ for(int k = field_185213_a.size(); i < k; ++i) { 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); +- return PotionUtils.func_185188_a(new ItemStack(item), 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()); ++ return PotionUtils.func_185188_a(new ItemStack(item), mixpredicate1.field_185200_c.get()); } } } -@@ -212,15 +212,15 @@ +@@ -211,15 +211,15 @@ field_185213_a.add(new PotionBrewing.MixPredicate<>(p_193357_0_, Ingredient.func_199804_a(p_193357_1_), p_193357_2_)); } diff --git a/patches/minecraft/net/minecraft/resources/DataPackRegistries.java.patch b/patches/minecraft/net/minecraft/resources/DataPackRegistries.java.patch new file mode 100644 index 000000000..2f3311f00 --- /dev/null +++ b/patches/minecraft/net/minecraft/resources/DataPackRegistries.java.patch @@ -0,0 +1,28 @@ +--- a/net/minecraft/resources/DataPackRegistries.java ++++ b/net/minecraft/resources/DataPackRegistries.java +@@ -22,6 +22,8 @@ + private final AdvancementManager field_240958_h_ = new AdvancementManager(this.field_240956_f_); + private final FunctionReloader field_240959_i_; + ++ private final net.minecraftforge.common.loot.LootModifierManager lootManager = new net.minecraftforge.common.loot.LootModifierManager(); ++ + public DataPackRegistries(Commands.EnvironmentType p_i232598_1_, int p_i232598_2_) { + this.field_240953_c_ = new Commands(p_i232598_1_); + this.field_240959_i_ = new FunctionReloader(p_i232598_2_, this.field_240953_c_.func_197054_a()); +@@ -31,6 +33,7 @@ + this.field_240952_b_.func_219534_a(this.field_240957_g_); + this.field_240952_b_.func_219534_a(this.field_240959_i_); + this.field_240952_b_.func_219534_a(this.field_240958_h_); ++ this.field_240952_b_.func_219534_a(this.lootManager); + } + + public FunctionReloader func_240960_a_() { +@@ -85,4 +88,8 @@ + public void close() { + this.field_240952_b_.close(); + } ++ ++ public net.minecraftforge.common.loot.LootModifierManager getLootModifierManager() { ++ return lootManager; ++ } + } diff --git a/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch b/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch index 0c2d4a0ee..1bdd80b92 100644 --- a/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch @@ -12,7 +12,7 @@ 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 @@ +@@ -17,4 +22,9 @@ } void func_195410_a(IResourceManager p_195410_1_); diff --git a/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch b/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch index 4ff1e15fa..099ddb028 100644 --- a/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch +++ b/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch @@ -5,45 +5,45 @@ private final boolean field_195806_h; private final boolean field_195807_i; + private final boolean hidden; // Forge: Allow packs to be hidden from the UI entirely + private final IPackNameDecorator field_232611_k_; @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_) { @@ -53,7 +54,12 @@ return (T)null; } + @Deprecated - public ResourcePackInfo(String p_i47907_1_, boolean p_i47907_2_, Supplier p_i47907_3_, ITextComponent p_i47907_4_, ITextComponent p_i47907_5_, PackCompatibility p_i47907_6_, ResourcePackInfo.Priority p_i47907_7_, boolean p_i47907_8_) { -+ this(p_i47907_1_, p_i47907_2_, p_i47907_3_, p_i47907_4_, p_i47907_5_, p_i47907_6_, p_i47907_7_, p_i47907_8_, false); + public ResourcePackInfo(String p_i231422_1_, boolean p_i231422_2_, Supplier p_i231422_3_, ITextComponent p_i231422_4_, ITextComponent p_i231422_5_, PackCompatibility p_i231422_6_, ResourcePackInfo.Priority p_i231422_7_, boolean p_i231422_8_, IPackNameDecorator p_i231422_9_) { ++ this(p_i231422_1_, p_i231422_2_, p_i231422_3_, p_i231422_4_, p_i231422_5_, p_i231422_6_, p_i231422_7_, p_i231422_8_, p_i231422_9_, false); + } + -+ public ResourcePackInfo(String p_i47907_1_, boolean p_i47907_2_, Supplier p_i47907_3_, ITextComponent p_i47907_4_, ITextComponent p_i47907_5_, PackCompatibility p_i47907_6_, ResourcePackInfo.Priority p_i47907_7_, boolean p_i47907_8_, boolean hidden) { - this.field_195800_b = p_i47907_1_; - this.field_195801_c = p_i47907_3_; - this.field_195802_d = p_i47907_4_; -@@ -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_; ++ public ResourcePackInfo(String p_i231422_1_, boolean p_i231422_2_, Supplier p_i231422_3_, ITextComponent p_i231422_4_, ITextComponent p_i231422_5_, PackCompatibility p_i231422_6_, ResourcePackInfo.Priority p_i231422_7_, boolean p_i231422_8_, IPackNameDecorator p_i231422_9_, boolean hidden) { + this.field_195800_b = p_i231422_1_; + this.field_195801_c = p_i231422_3_; + this.field_195802_d = p_i231422_4_; +@@ -63,12 +69,18 @@ + this.field_195805_g = p_i231422_7_; + this.field_195807_i = p_i231422_8_; + this.field_232611_k_ = p_i231422_9_; + this.hidden = hidden; } + @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 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_i231421_1_, boolean p_i231421_2_, Supplier p_i231421_3_, IResourcePack p_i231421_4_, PackMetadataSection p_i231421_5_, ResourcePackInfo.Priority p_i231421_6_, IPackNameDecorator p_i231421_7_) { +- this(p_i231421_1_, p_i231421_2_, p_i231421_3_, new StringTextComponent(p_i231421_4_.func_195762_a()), p_i231421_5_.func_198963_a(), PackCompatibility.func_198969_a(p_i231421_5_.func_198962_b()), p_i231421_6_, false, p_i231421_7_); ++ this(p_i231421_1_, p_i231421_2_, p_i231421_3_, p_i231421_4_, p_i231421_5_, p_i231421_6_, p_i231421_7_, 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 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); ++ public ResourcePackInfo(String p_i231421_1_, boolean p_i231421_2_, Supplier p_i231421_3_, IResourcePack p_i231421_4_, PackMetadataSection p_i231421_5_, ResourcePackInfo.Priority p_i231421_6_, IPackNameDecorator p_i231421_7_, boolean hidden) { ++ this(p_i231421_1_, p_i231421_2_, p_i231421_3_, new StringTextComponent(p_i231421_4_.func_195762_a()), p_i231421_5_.func_198963_a(), PackCompatibility.func_198969_a(p_i231421_5_.func_198962_b()), p_i231421_6_, false, p_i231421_7_, hidden); + } + @OnlyIn(Dist.CLIENT) public ITextComponent func_195789_b() { return this.field_195802_d; -@@ -107,6 +119,8 @@ - public ResourcePackInfo.Priority func_195792_i() { - return this.field_195805_g; +@@ -113,6 +125,8 @@ + public IPackNameDecorator func_232614_i_() { + return this.field_232611_k_; } + + public boolean isHidden() { return hidden; } diff --git a/patches/minecraft/net/minecraft/resources/ResourcePackList.java.patch b/patches/minecraft/net/minecraft/resources/ResourcePackList.java.patch index db3e5cf11..d26dd08fd 100644 --- a/patches/minecraft/net/minecraft/resources/ResourcePackList.java.patch +++ b/patches/minecraft/net/minecraft/resources/ResourcePackList.java.patch @@ -1,11 +1,13 @@ --- a/net/minecraft/resources/ResourcePackList.java +++ b/net/minecraft/resources/ResourcePackList.java -@@ -48,7 +48,7 @@ - private void func_198986_e() { - List> list = Lists.newArrayList(this.field_198988_b.entrySet()); - this.field_198988_b.clear(); -- list.stream().sorted(Entry.comparingByKey()).forEachOrdered((p_198984_1_) -> { -+ list.stream().sorted(net.minecraftforge.fml.packs.ResourcePackLoader.getSorter()).forEachOrdered((p_198984_1_) -> { - ResourcePackInfo resourcepackinfo = (ResourcePackInfo)this.field_198988_b.put(p_198984_1_.getKey(), p_198984_1_.getValue()); - }); +@@ -85,6 +85,10 @@ + return this.field_198988_b.get(p_198981_1_); + } + ++ public void addPackFinder(IPackFinder packFinder) { ++ this.field_198987_a.add(packFinder); ++ } ++ + public void close() { + this.field_198988_b.values().forEach(ResourcePackInfo::close); } diff --git a/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch b/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch index 91b1519a3..f2d69301f 100644 --- a/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch +++ b/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/resources/VanillaPack.java +++ b/net/minecraft/resources/VanillaPack.java -@@ -176,7 +176,7 @@ +@@ -171,7 +171,7 @@ try { URL url = VanillaPack.class.getResource(s); - return func_223459_a(s, url) ? url.openStream() : null; + return func_223459_a(s, url) ? getExtraInputStream(p_195782_1_, s) : null; - } catch (IOException var6) { + } catch (IOException ioexception) { return VanillaPack.class.getResourceAsStream(s); } -@@ -192,7 +192,7 @@ +@@ -187,7 +187,7 @@ @Nullable protected InputStream func_200010_a(String p_200010_1_) { @@ -18,7 +18,7 @@ } public boolean func_195764_b(ResourcePackType p_195764_1_, ResourceLocation p_195764_2_) { -@@ -232,4 +232,18 @@ +@@ -226,4 +226,18 @@ public void close() { } diff --git a/patches/minecraft/net/minecraft/server/Main.java.patch b/patches/minecraft/net/minecraft/server/Main.java.patch new file mode 100644 index 000000000..f942dce50 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/Main.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/server/Main.java ++++ b/net/minecraft/server/Main.java +@@ -72,6 +72,7 @@ + OptionSpec optionspec11 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1); + OptionSpec optionspec12 = optionparser.accepts("serverId").withRequiredArg(); + OptionSpec optionspec13 = optionparser.nonOptions(); ++ optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); //Forge: Consume this argument, we use it in the launcher, and the client side. + + try { + OptionSet optionset = optionparser.parse(p_main_0_); +@@ -105,6 +106,10 @@ + GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); + PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(file1, MinecraftServer.field_152367_a.getName())); + String s = Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(serverpropertiesprovider.func_219034_a().field_219021_o); ++ if (s == null || s.isEmpty() || new File(file1, s).getAbsolutePath().equals(new File(s).getAbsolutePath())) { ++ field_240759_a_.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + s); ++ return; ++ } + SaveFormat saveformat = SaveFormat.func_237269_a_(file1.toPath()); + SaveFormat.LevelSave saveformat$levelsave = saveformat.func_237274_c_(s); + MinecraftServer.func_240777_a_(saveformat$levelsave); diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 8cf20075d..6c76ed77e 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,80 +1,48 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -196,7 +196,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_); - }); -@@ -221,6 +221,7 @@ - private final LootTableManager field_200256_aj = new LootTableManager(this.field_229734_an_); - private final AdvancementManager field_200257_ak = new AdvancementManager(); - private final FunctionManager field_200258_al = new FunctionManager(this); -+ private final net.minecraftforge.common.loot.LootModifierManager lootManager = new net.minecraftforge.common.loot.LootModifierManager(); - private final FrameTimer field_213215_ap = new FrameTimer(); - private boolean field_205745_an; - private boolean field_212205_ao; -@@ -249,6 +250,7 @@ - this.field_195576_ac.func_219534_a(this.field_200256_aj); - this.field_195576_ac.func_219534_a(this.field_200258_al); - this.field_195576_ac.func_219534_a(this.field_200257_ak); -+ field_195576_ac.func_219534_a(lootManager); - this.field_213217_au = Util.func_215072_e(); - this.field_71294_K = p_i50590_10_; - } -@@ -336,6 +338,8 @@ - this.func_200245_b(new TranslationTextComponent("menu.loadingLevel")); - SaveHandler savehandler = this.func_71254_M().func_197715_a(p_71247_1_, this); - this.func_175584_a(this.func_71270_I(), savehandler); +@@ -336,6 +336,8 @@ + ServerWorld serverworld = new ServerWorld(this, this.field_213217_au, this.field_71310_m, iserverworldinfo, World.field_234918_g_, registrykey, dimensiontype, p_240787_1_, chunkgenerator, flag, j, list, true); + this.field_71305_c.put(World.field_234918_g_, serverworld); + DimensionSavedDataManager dimensionsaveddatamanager = serverworld.func_217481_x(); + // Move factory creation earlier to prevent startupquery deadlock + IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11); - WorldInfo worldinfo = savehandler.func_75757_d(); - WorldSettings worldsettings; - if (worldinfo == null) { -@@ -357,13 +361,13 @@ - - worldinfo.func_230145_a_(this.getServerModName(), this.func_230045_q_().isPresent()); - this.func_195560_a(savehandler.func_75765_b(), worldinfo); -- IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11); - this.func_213194_a(savehandler, worldinfo, worldsettings, ichunkstatuslistener); - this.func_147139_a(this.func_147135_j(), true); - this.func_213186_a(ichunkstatuslistener); - } - - protected void func_213194_a(SaveHandler p_213194_1_, WorldInfo p_213194_2_, WorldSettings p_213194_3_, IChunkStatusListener p_213194_4_) { -+ net.minecraftforge.common.DimensionManager.fireRegister(); - if (this.func_71242_L()) { - p_213194_2_.func_176127_a(field_213219_c); - } -@@ -407,6 +411,7 @@ - if (dimensiontype != DimensionType.field_223227_a_) { - 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_)); + this.func_213204_a(dimensionsaveddatamanager); + this.field_229733_al_ = new CommandStorage(dimensionsaveddatamanager); + WorldBorder worldborder = serverworld.func_175723_af(); +@@ -380,6 +382,7 @@ + worldborder.func_177737_a(new IBorderListener.Impl(serverworld1.func_175723_af())); + this.field_71305_c.put(registrykey2, serverworld1); } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(field_71305_c.get(dimensiontype))); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(field_71305_c.get(registrykey1))); } } -@@ -565,6 +570,7 @@ +@@ -391,6 +394,7 @@ + } else if (p_240786_3_) { + p_240786_1_.func_176143_a(BlockPos.field_177992_a.func_177984_a()); + } else { ++ //if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(p_240786_0_, settings)) return; //TODO, Re-Evaluate what settings to pass into here. + BiomeProvider biomeprovider = chunkgenerator.func_202090_b(); + List list = biomeprovider.func_76932_a(); + Random random = new Random(p_240786_0_.func_72905_C()); +@@ -569,6 +573,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); -@@ -605,6 +611,7 @@ - public void run() { + } catch (IOException ioexception1) { + field_147145_h.error("Exception closing the level", (Throwable)ioexception1); +@@ -617,6 +622,7 @@ + protected void func_240802_v_() { 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 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())); -@@ -636,9 +643,15 @@ - this.field_71304_b.func_219897_b(); +@@ -646,9 +652,15 @@ + this.func_240795_b_(longtickdetector); this.field_71296_Q = true; } + net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStopping(this); @@ -89,7 +57,7 @@ } catch (Throwable throwable1) { field_147145_h.error("Encountered an unexpected exception", throwable1); CrashReport crashreport; -@@ -655,6 +668,7 @@ +@@ -665,6 +677,7 @@ field_147145_h.error("We were unable to save this crash report to disk."); } @@ -97,7 +65,7 @@ this.func_71228_a(crashreport); } finally { try { -@@ -663,6 +677,7 @@ +@@ -673,6 +686,7 @@ } catch (Throwable throwable) { field_147145_h.error("Exception stopping the server", throwable); } finally { @@ -105,7 +73,7 @@ this.func_71240_o(); } -@@ -764,6 +779,7 @@ +@@ -774,6 +788,7 @@ protected void func_71217_p(BooleanSupplier p_71217_1_) { long i = Util.func_211178_c(); @@ -113,7 +81,7 @@ ++this.field_71315_w; this.func_71190_q(p_71217_1_); if (i - this.field_147142_T >= 5000000000L) { -@@ -778,6 +794,7 @@ +@@ -788,6 +803,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.field_147147_p.func_151318_b().func_151330_a(agameprofile); @@ -121,7 +89,7 @@ } if (this.field_71315_w % 6000 == 0) { -@@ -805,6 +822,7 @@ +@@ -815,6 +831,7 @@ long i1 = Util.func_211178_c(); this.field_213215_ap.func_181747_a(i1 - i); this.field_71304_b.func_76319_b(); @@ -129,118 +97,44 @@ } protected void func_71190_q(BooleanSupplier p_71190_1_) { -@@ -812,7 +830,8 @@ +@@ -822,7 +839,8 @@ this.func_193030_aL().func_73660_a(); this.field_71304_b.func_219895_b("levels"); - for(ServerWorld serverworld : this.func_212370_w()) { + for(ServerWorld serverworld : this.getWorldArray()) { + long tickStart = Util.func_211178_c(); - if (serverworld.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ || this.func_71255_r()) { - this.field_71304_b.func_194340_a(() -> { - return serverworld.func_72912_H().func_76065_j() + " " + Registry.field_212622_k.func_177774_c(serverworld.field_73011_w.func_186058_p()); -@@ -824,6 +843,7 @@ - } - - this.field_71304_b.func_76320_a("tick"); -+ net.minecraftforge.fml.hooks.BasicEventHooks.onPreWorldTick(serverworld); - - try { - serverworld.func_72835_b(p_71190_1_); -@@ -832,12 +852,16 @@ - serverworld.func_72914_a(crashreport); - throw new ReportedException(crashreport); - } -+ net.minecraftforge.fml.hooks.BasicEventHooks.onPostWorldTick(serverworld); - - this.field_71304_b.func_76319_b(); - this.field_71304_b.func_76319_b(); + this.field_71304_b.func_194340_a(() -> { + return serverworld + " " + serverworld.func_234923_W_().func_240901_a_(); + }); +@@ -833,6 +851,7 @@ } -+ perWorldTickTimes.computeIfAbsent(serverworld.func_201675_m().func_186058_p(), k -> new long[100])[this.field_71315_w % 100] = Util.func_211178_c() - tickStart; - } -+ 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_219895_b("connection"); - this.func_147137_ag().func_151269_c(); - this.field_71304_b.func_219895_b("players"); -@@ -878,6 +902,7 @@ - OptionSpec optionspec10 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1); - OptionSpec optionspec11 = optionparser.accepts("serverId").withRequiredArg(); - OptionSpec optionspec12 = optionparser.nonOptions(); -+ optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); //Forge: Consume this argument, we use it in the launcher, and the client side. + this.field_71304_b.func_76320_a("tick"); ++ net.minecraftforge.fml.hooks.BasicEventHooks.onPreWorldTick(serverworld); - try { - OptionSet optionset = optionparser.parse(p_main_0_); -@@ -888,7 +913,7 @@ + try { + serverworld.func_72835_b(p_71190_1_); +@@ -931,6 +950,7 @@ + p_71230_1_.func_85056_g().func_189529_a("Data Packs", () -> { + StringBuilder stringbuilder = new StringBuilder(); - Path path = Paths.get("server.properties"); - ServerPropertiesProvider serverpropertiesprovider = new ServerPropertiesProvider(path); -- serverpropertiesprovider.func_219035_b(); -+ if (optionset.has(optionspec1) || !Files.exists(path)) serverpropertiesprovider.func_219035_b(); - Path path1 = Paths.get("eula.txt"); - ServerEula servereula = new ServerEula(path1); - if (optionset.has(optionspec1)) { -@@ -910,6 +935,10 @@ - GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); - PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(s, field_152367_a.getName())); - String s1 = Optional.ofNullable(optionset.valueOf(optionspec9)).orElse(serverpropertiesprovider.func_219034_a().field_219021_o); -+ if (s1 == null || s1.isEmpty() || new File(s, s1).getAbsolutePath().equals(new File(s).getAbsolutePath())) { -+ field_147145_h.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + s1); -+ return; -+ } - final DedicatedServer dedicatedserver = new DedicatedServer(new File(s), serverpropertiesprovider, DataFixesManager.func_210901_a(), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, playerprofilecache, LoggingChunkStatusListener::new, s1); - dedicatedserver.func_71224_l(optionset.valueOf(optionspec7)); - dedicatedserver.func_71208_b(optionset.valueOf(optionspec10)); -@@ -927,6 +956,7 @@ - Thread thread = new Thread("Server Shutdown Thread") { - public void run() { - dedicatedserver.func_71263_m(true); + LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end. - } - }; - thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(field_147145_h)); -@@ -971,7 +1001,7 @@ - } - - 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() { -@@ -1010,7 +1040,7 @@ - } - - public String getServerModName() { -- return "vanilla"; -+ return net.minecraftforge.fml.BrandingControl.getServerBranding(); - } - - public CrashReport func_71230_b(CrashReport p_71230_1_) { -@@ -1396,6 +1426,10 @@ - public FunctionManager func_193030_aL() { - return this.field_200258_al; - } -+ -+ public net.minecraftforge.common.loot.LootModifierManager getLootModifierManager() { -+ return lootManager; -+ } - - public void func_193031_aM() { - if (!this.func_213162_bc()) { -@@ -1567,6 +1601,31 @@ + for(ResourcePackInfo resourcepackinfo : this.field_195577_ad.func_198980_d()) { + if (stringbuilder.length() > 0) { + stringbuilder.append(", "); +@@ -1437,6 +1457,31 @@ public abstract boolean func_213199_b(GameProfile p_213199_1_); -+ private Map perWorldTickTimes = Maps.newIdentityHashMap(); ++ private Map, long[]> perWorldTickTimes = Maps.newIdentityHashMap(); + @Nullable -+ public long[] getTickTime(DimensionType dim) { ++ public long[] getTickTime(RegistryKey dim) { + return perWorldTickTimes.get(dim); + } + + @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, ServerWorld> forgeGetWorldMap() { + return this.field_71305_c; + } + private int worldArrayMarker = 0; diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 721e91509..145f17fa2 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,14 +1,26 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -97,6 +97,7 @@ +@@ -12,10 +12,7 @@ + import java.net.InetAddress; + import java.net.Proxy; + import java.nio.charset.StandardCharsets; +-import java.util.Collections; +-import java.util.List; +-import java.util.Locale; +-import java.util.Optional; ++import java.util.*; + import java.util.function.BooleanSupplier; + import java.util.regex.Pattern; + import javax.annotation.Nullable; +@@ -77,6 +74,7 @@ public boolean func_71197_b() throws IOException { Thread thread = new Thread("Server console handler") { public void run() { + if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); - String s3; -@@ -118,7 +119,9 @@ + String s1; +@@ -98,7 +96,9 @@ field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } @@ -18,47 +30,47 @@ ServerProperties serverproperties = this.field_71340_o.func_219034_a(); if (this.func_71264_H()) { this.func_71189_e("127.0.0.1"); -@@ -175,6 +178,7 @@ - if (!PreYggdrasilConverter.func_219587_e(this)) { - return false; - } else { -+ net.minecraftforge.fml.server.ServerModLoader.end(); - this.func_184105_a(new DedicatedPlayerList(this)); - long i = Util.func_211178_c(); - String s = serverproperties.field_219022_p; -@@ -196,6 +200,7 @@ +@@ -159,11 +159,13 @@ SkullTileEntity.func_184293_a(this.func_152358_ax()); SkullTileEntity.func_184294_a(this.func_147130_as()); PlayerProfileCache.func_187320_a(this.func_71266_T()); + if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; - field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I()); - JsonObject jsonobject = new JsonObject(); - if (worldtype == WorldType.field_77138_c) { -@@ -208,6 +213,7 @@ - long l = Util.func_211178_c() - i; - String s2 = String.format(Locale.ROOT, "%.3fs", (double)l / 1.0E9D); - field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s2); + field_155771_h.info("Preparing level \"{}\"", (Object)this.func_230542_k__()); + this.func_240800_l__(); + long j = Util.func_211178_c() - i; + String s = String.format(Locale.ROOT, "%.3fs", (double)j / 1.0E9D); + field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s); + this.field_211151_aa = Util.func_211177_b(); //Forge: Update server time to prevent watchdog/spaming during long load. if (serverproperties.field_219027_u != null) { this.func_200252_aR().func_223585_a(GameRules.field_223620_w).func_223570_a(serverproperties.field_219027_u, this); } -@@ -233,7 +239,8 @@ +@@ -175,6 +177,7 @@ } - 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); - } + if (serverproperties.field_219030_x) { ++ net.minecraftforge.fml.server.ServerModLoader.end(); + field_155771_h.info("Starting remote control listener"); + this.field_71339_n = new MainThread(this); + this.field_71339_n.func_72602_a(); +@@ -306,7 +309,8 @@ } -@@ -547,4 +554,9 @@ - public boolean func_213199_b(GameProfile p_213199_1_) { + public boolean func_71262_S() { +- return true; ++ // <3 you Grum for this, saves us ~30 patch files! --^ ++ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this); + } + + public boolean func_181035_ah() { +@@ -506,6 +510,11 @@ return false; } -+ + + @Override //Forge: Enable formated text for colors in console. -+ public void func_145747_a(net.minecraft.util.text.ITextComponent message) { -+ field_155771_h.info(message.func_150254_d()); ++ public void func_145747_a(net.minecraft.util.text.ITextComponent message, UUID p_145747_2_) { ++ field_155771_h.info(message.getString()); + } - } ++ + public int func_230512_b_(int p_230512_1_) { + return this.func_213221_d_().field_241081_R_ * p_230512_1_ / 100; + } diff --git a/patches/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch b/patches/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch index 912daf292..bf14788b6 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch @@ -6,6 +6,6 @@ try (OutputStream outputstream = Files.newOutputStream(p_218970_1_)) { - this.field_73672_b.store(outputstream, "Minecraft server properties"); + net.minecraftforge.common.util.SortedProperties.store(field_73672_b, outputstream, "Minecraft server properties"); - } catch (IOException var15) { + } catch (IOException ioexception) { field_164440_a.error("Failed to store properties to file: " + p_218970_1_); } diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch index 4e062f2c5..7f110b023 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 -@@ -138,8 +138,10 @@ +@@ -137,8 +137,10 @@ return jpanel; } @@ -11,7 +11,7 @@ } public void func_219050_b() { -@@ -154,6 +156,9 @@ +@@ -153,6 +155,9 @@ } public void func_164247_a(JTextArea p_164247_1_, JScrollPane p_164247_2_, String p_164247_3_) { diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 49f4f78f2..d46982521 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -1,43 +1,6 @@ --- a/net/minecraft/server/integrated/IntegratedServer.java +++ b/net/minecraft/server/integrated/IntegratedServer.java -@@ -64,6 +64,8 @@ - this.func_71237_c(p_71247_1_); - SaveHandler savehandler = this.func_71254_M().func_197715_a(p_71247_1_, this); - this.func_175584_a(this.func_71270_I(), savehandler); -+ // Move factory creation earlier to prevent startupquery deadlock -+ IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11); - WorldInfo worldinfo = savehandler.func_75757_d(); - if (worldinfo == null) { - worldinfo = new WorldInfo(this.field_71350_m, p_71247_2_); -@@ -73,7 +75,6 @@ - - worldinfo.func_230145_a_(this.getServerModName(), this.func_230045_q_().isPresent()); - this.func_195560_a(savehandler.func_75765_b(), worldinfo); -- IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11); - this.func_213194_a(savehandler, worldinfo, this.field_71350_m, ichunkstatuslistener); - if (this.func_71218_a(DimensionType.field_223227_a_).func_72912_H().func_176130_y() == null) { - this.func_147139_a(this.field_71349_l.field_71474_y.field_74318_M, true); -@@ -91,9 +92,10 @@ - this.func_71245_h(true); - field_147148_h.info("Generating keypair"); - this.func_71253_a(CryptManager.func_75891_b()); -+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; - this.func_71247_a(this.func_71270_I(), this.func_71221_J(), this.field_71350_m.func_77160_d(), this.field_71350_m.func_77165_h(), this.field_71350_m.func_205391_j()); - this.func_71205_p(this.func_71214_G() + " - " + this.func_71218_a(DimensionType.field_223227_a_).func_72912_H().func_76065_j()); -- return true; -+ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this); - } - - public void func_71217_p(BooleanSupplier p_71217_1_) { -@@ -128,6 +130,7 @@ - } - - 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(); - } - -@@ -219,6 +222,7 @@ +@@ -171,6 +171,7 @@ } public void func_71263_m(boolean p_71263_1_) { diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch index 19f4ddbd7..2a0972cb2 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/management/PlayerInteractionManager.java +++ b/net/minecraft/server/management/PlayerInteractionManager.java -@@ -77,7 +77,7 @@ +@@ -87,7 +87,7 @@ ++this.field_73100_i; if (this.field_73097_j) { BlockState blockstate = this.field_73092_a.func_180495_p(this.field_180241_i); @@ -9,7 +9,7 @@ this.field_73097_j = false; } else { float f = this.func_229859_a_(blockstate, this.field_180241_i, this.field_73093_n); -@@ -88,7 +88,7 @@ +@@ -98,7 +98,7 @@ } } else if (this.field_73088_d) { BlockState blockstate1 = this.field_73092_a.func_180495_p(this.field_180240_f); @@ -18,7 +18,7 @@ this.field_73092_a.func_175715_c(this.field_73090_b.func_145782_y(), this.field_180240_f, -1); this.field_73094_o = -1; this.field_73088_d = false; -@@ -116,7 +116,15 @@ +@@ -126,7 +126,15 @@ double d1 = this.field_73090_b.func_226278_cu_() - ((double)p_225416_1_.func_177956_o() + 0.5D) + 1.5D; double d2 = this.field_73090_b.func_226281_cx_() - ((double)p_225416_1_.func_177952_p() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -35,7 +35,7 @@ this.field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, this.field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "too far")); } else if (p_225416_1_.func_177956_o() >= p_225416_4_) { this.field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, this.field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "too high")); -@@ -146,12 +154,13 @@ +@@ -150,12 +158,13 @@ this.field_73089_e = this.field_73100_i; float f = 1.0F; BlockState blockstate = this.field_73092_a.func_180495_p(p_225416_1_); @@ -51,7 +51,7 @@ this.func_229860_a_(p_225416_1_, p_225416_2_, "insta mine"); } else { if (this.field_73088_d) { -@@ -214,7 +223,8 @@ +@@ -218,7 +227,8 @@ public boolean func_180237_b(BlockPos p_180237_1_) { BlockState blockstate = this.field_73092_a.func_180495_p(p_180237_1_); @@ -61,69 +61,8 @@ return false; } else { TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_); -@@ -222,38 +232,53 @@ - if ((block instanceof CommandBlockBlock || block instanceof StructureBlock || block instanceof JigsawBlock) && !this.field_73090_b.func_195070_dx()) { - this.field_73092_a.func_184138_a(p_180237_1_, blockstate, blockstate, 3); - return false; -+ } else if (field_73090_b.func_184614_ca().onBlockStartBreak(p_180237_1_, field_73090_b)) { -+ return false; - } else if (this.field_73090_b.func_223729_a(this.field_73092_a, p_180237_1_, this.field_73091_c)) { - return false; - } else { -- block.func_176208_a(this.field_73092_a, p_180237_1_, blockstate, this.field_73090_b); -- boolean flag = this.field_73092_a.func_217377_a(p_180237_1_, false); -- if (flag) { -- block.func_176206_d(this.field_73092_a, p_180237_1_, blockstate); -- } -- - if (this.func_73083_d()) { -+ removeBlock(p_180237_1_, false); - return true; - } else { - ItemStack itemstack = this.field_73090_b.func_184614_ca(); - ItemStack itemstack1 = itemstack.func_77946_l(); -- boolean flag1 = this.field_73090_b.func_184823_b(blockstate); -+ -+ boolean flag1 = blockstate.canHarvestBlock(this.field_73092_a, p_180237_1_, this.field_73090_b); - itemstack.func_179548_a(this.field_73092_a, blockstate, p_180237_1_, this.field_73090_b); -+ if (itemstack.func_190926_b() && !itemstack1.func_190926_b()) -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, itemstack1, Hand.MAIN_HAND); -+ boolean flag = removeBlock(p_180237_1_, flag1); -+ - if (flag && flag1) { - block.func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, blockstate, tileentity, itemstack1); - } - -+ if (flag && exp > 0) -+ blockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); -+ - return true; - } - } - } - } - -+ private boolean removeBlock(BlockPos p_180235_1_, boolean canHarvest) { -+ BlockState state = this.field_73092_a.func_180495_p(p_180235_1_); -+ boolean removed = state.removedByPlayer(this.field_73092_a, p_180235_1_, this.field_73090_b, canHarvest, this.field_73092_a.func_204610_c(p_180235_1_)); -+ if (removed) -+ state.func_177230_c().func_176206_d(this.field_73092_a, p_180235_1_, state); -+ return removed; -+ } -+ - public ActionResultType func_187250_a(PlayerEntity p_187250_1_, World p_187250_2_, ItemStack p_187250_3_, Hand p_187250_4_) { - if (this.field_73091_c == GameType.SPECTATOR) { - return ActionResultType.PASS; - } else if (p_187250_1_.func_184811_cZ().func_185141_a(p_187250_3_.func_77973_b())) { - return ActionResultType.PASS; - } else { -+ ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_); -+ if (cancelResult != null) return cancelResult; - int i = p_187250_3_.func_190916_E(); - int j = p_187250_3_.func_77952_i(); - ActionResult actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_); -@@ -287,6 +312,8 @@ - public ActionResultType func_219441_a(PlayerEntity p_219441_1_, World p_219441_2_, ItemStack p_219441_3_, Hand p_219441_4_, BlockRayTraceResult p_219441_5_) { +@@ -291,6 +301,8 @@ + public ActionResultType func_219441_a(ServerPlayerEntity p_219441_1_, World p_219441_2_, ItemStack p_219441_3_, Hand p_219441_4_, BlockRayTraceResult p_219441_5_) { BlockPos blockpos = p_219441_5_.func_216350_a(); BlockState blockstate = p_219441_2_.func_180495_p(blockpos); + net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(p_219441_1_, p_219441_4_, blockpos, p_219441_5_.func_216354_b()); @@ -131,29 +70,30 @@ if (this.field_73091_c == GameType.SPECTATOR) { INamedContainerProvider inamedcontainerprovider = blockstate.func_215699_b(p_219441_2_, blockpos); if (inamedcontainerprovider != null) { -@@ -296,9 +323,14 @@ +@@ -300,10 +312,15 @@ return ActionResultType.PASS; } } else { + ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_); + if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { -+ ActionResultType result = p_219441_3_.onItemUseFirst(itemusecontext); -+ if (result != ActionResultType.PASS) return result; ++ ActionResultType result = p_219441_3_.onItemUseFirst(itemusecontext); ++ if (result != ActionResultType.PASS) return result; + } boolean flag = !p_219441_1_.func_184614_ca().func_190926_b() || !p_219441_1_.func_184592_cb().func_190926_b(); - boolean flag1 = p_219441_1_.func_226563_dT_() && flag; -- if (!flag1) { + boolean flag1 = (p_219441_1_.func_226563_dT_() && flag) && !(p_219441_1_.func_184614_ca().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_) && p_219441_1_.func_184592_cb().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_)); + ItemStack itemstack = p_219441_3_.func_77946_l(); +- if (!flag1) { + if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1) { ActionResultType actionresulttype = blockstate.func_227031_a_(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_); if (actionresulttype.func_226246_a_()) { - return actionresulttype; -@@ -306,7 +338,7 @@ + CriteriaTriggers.field_232607_M_.func_226695_a_(p_219441_1_, blockpos, itemstack); +@@ -312,7 +329,7 @@ } if (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b())) { - ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_); + if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return ActionResultType.PASS; + ActionResultType actionresulttype1; if (this.func_73083_d()) { int i = p_219441_3_.func_190916_E(); - ActionResultType actionresulttype1 = p_219441_3_.func_196084_a(itemusecontext); diff --git a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch index 993a5fb4f..dd83574d0 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch @@ -1,60 +1,31 @@ --- a/net/minecraft/server/management/PlayerList.java +++ b/net/minecraft/server/management/PlayerList.java -@@ -94,6 +94,7 @@ +@@ -107,6 +107,7 @@ private GameType field_72410_m; private boolean field_72407_n; private int field_72408_o; + private final List playersView = java.util.Collections.unmodifiableList(field_72404_b); - public PlayerList(MinecraftServer p_i50688_1_, int p_i50688_2_) { - this.field_72400_f = p_i50688_1_; -@@ -109,7 +110,15 @@ - String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName(); - playerprofilecache.func_152649_a(gameprofile); - CompoundNBT compoundnbt = this.func_72380_a(p_72355_2_); -- ServerWorld serverworld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); -+ -+ //Forge: Make sure the dimension hasn't been deleted, if so stick them in the overworld. -+ ServerWorld serverworld = p_72355_2_.field_71093_bK != null ? this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK) : null ; -+ if (serverworld == null) { -+ p_72355_2_.field_71093_bK = DimensionType.field_223227_a_; -+ serverworld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); -+ p_72355_2_.func_70107_b(serverworld.func_72912_H().func_76079_c(), serverworld.func_72912_H().func_76075_d(), serverworld.func_72912_H().func_76074_e()); -+ } -+ - p_72355_2_.func_70029_a(serverworld); - p_72355_2_.field_71134_c.func_73080_a((ServerWorld)p_72355_2_.field_70170_p); - String s1 = "local"; -@@ -121,6 +130,8 @@ - WorldInfo worldinfo = serverworld.func_72912_H(); - this.func_72381_a(p_72355_2_, (ServerPlayerEntity)null, serverworld); + public PlayerList(MinecraftServer p_i231425_1_, IDynamicRegistries.Impl p_i231425_2_, PlayerData p_i231425_3_, int p_i231425_4_) { + this.field_72400_f = p_i231425_1_; +@@ -143,6 +144,7 @@ + IWorldInfo iworldinfo = serverworld1.func_72912_H(); + this.func_72381_a(p_72355_2_, (ServerPlayerEntity)null, serverworld1); ServerPlayNetHandler serverplaynethandler = new ServerPlayNetHandler(this.field_72400_f, p_72355_1_, p_72355_2_); + net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(p_72355_1_, "PLAY_TO_CLIENT"); -+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(p_72355_1_, p_72355_2_); - GameRules gamerules = serverworld.func_82736_K(); + GameRules gamerules = serverworld1.func_82736_K(); boolean flag = gamerules.func_223586_b(GameRules.field_226683_z_); boolean flag1 = gamerules.func_223586_b(GameRules.field_223612_o); -@@ -145,7 +156,7 @@ +@@ -167,7 +169,7 @@ - this.func_148539_a(itextcomponent.func_211708_a(TextFormatting.YELLOW)); + this.func_232641_a_(iformattabletextcomponent.func_240699_a_(TextFormatting.YELLOW), ChatType.SYSTEM, Util.field_240973_b_); serverplaynethandler.func_147364_a(p_72355_2_.func_226277_ct_(), p_72355_2_.func_226278_cu_(), p_72355_2_.func_226281_cx_(), p_72355_2_.field_70177_z, p_72355_2_.field_70125_A); - this.field_72404_b.add(p_72355_2_); + this.addPlayer(p_72355_2_); this.field_177454_f.put(p_72355_2_.func_110124_au(), p_72355_2_); this.func_148540_a(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, p_72355_2_)); -@@ -166,8 +177,9 @@ - - if (compoundnbt != null && compoundnbt.func_150297_b("RootVehicle", 10)) { - CompoundNBT compoundnbt1 = compoundnbt.func_74775_l("RootVehicle"); -+ final ServerWorld worldf = serverworld; - Entity entity1 = EntityType.func_220335_a(compoundnbt1.func_74775_l("Entity"), serverworld, (p_217885_1_) -> { -- return !serverworld.func_217470_d(p_217885_1_) ? null : p_217885_1_; -+ return !worldf.func_217470_d(p_217885_1_) ? null : p_217885_1_; - }); - if (entity1 != null) { - UUID uuid = compoundnbt1.func_186857_a("Attach"); -@@ -194,6 +206,7 @@ +@@ -222,6 +224,7 @@ } p_72355_2_.func_71116_b(); @@ -62,23 +33,23 @@ } protected void func_96456_a(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) { -@@ -255,6 +268,7 @@ +@@ -282,6 +285,7 @@ compoundnbt1 = compoundnbt; p_72380_1_.func_70020_e(compoundnbt); field_148546_d.debug("loading single player"); + net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.field_72412_k, p_72380_1_.func_110124_au().toString()); } else { - compoundnbt1 = this.field_72412_k.func_75752_b(p_72380_1_); + compoundnbt1 = this.field_72412_k.func_237336_b_(p_72380_1_); } -@@ -263,6 +277,7 @@ +@@ -290,6 +294,7 @@ } protected void func_72391_b(ServerPlayerEntity p_72391_1_) { + if (p_72391_1_.field_71135_a == null) return; - this.field_72412_k.func_75753_a(p_72391_1_); + this.field_72412_k.func_237335_a_(p_72391_1_); ServerStatisticsManager serverstatisticsmanager = this.field_148547_k.get(p_72391_1_.func_110124_au()); if (serverstatisticsmanager != null) { -@@ -277,6 +292,7 @@ +@@ -304,6 +309,7 @@ } public void func_72367_e(ServerPlayerEntity p_72367_1_) { @@ -86,7 +57,7 @@ ServerWorld serverworld = p_72367_1_.func_71121_q(); p_72367_1_.func_195066_a(Stats.field_75947_j); this.func_72391_b(p_72367_1_); -@@ -298,7 +314,7 @@ +@@ -327,7 +333,7 @@ p_72367_1_.func_213319_R(); serverworld.func_217434_e(p_72367_1_); p_72367_1_.func_192039_O().func_192745_a(); @@ -95,69 +66,28 @@ this.field_72400_f.func_201300_aS().func_201382_b(p_72367_1_); UUID uuid = p_72367_1_.func_110124_au(); ServerPlayerEntity serverplayerentity = this.field_177454_f.get(uuid); -@@ -367,10 +383,18 @@ - } +@@ -420,6 +426,7 @@ + ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.field_72400_f, serverworld1, p_232644_1_.func_146103_bH(), playerinteractionmanager); + serverplayerentity.field_71135_a = p_232644_1_.field_71135_a; + serverplayerentity.func_193104_a(p_232644_1_, p_232644_2_); ++ p_232644_1_.remove(false); // Forge: clone event had a chance to see old data, now discard it + serverplayerentity.func_145769_d(p_232644_1_.func_145782_y()); + serverplayerentity.func_184819_a(p_232644_1_.func_184591_cq()); - public ServerPlayerEntity func_72368_a(ServerPlayerEntity p_72368_1_, DimensionType p_72368_2_, boolean p_72368_3_) { -- this.field_72404_b.remove(p_72368_1_); -- p_72368_1_.func_71121_q().func_217434_e(p_72368_1_); -- BlockPos blockpos = p_72368_1_.func_180470_cg(); -- boolean flag = p_72368_1_.func_82245_bX(); -+ ServerWorld world = field_72400_f.func_71218_a(p_72368_2_); -+ if (world == null) -+ p_72368_2_ = p_72368_1_.getSpawnDimension(); -+ else if (!world.func_201675_m().func_76567_e()) -+ p_72368_2_ = world.func_201675_m().getRespawnDimension(p_72368_1_); -+ if (field_72400_f.func_71218_a(p_72368_2_) == null) -+ p_72368_2_ = DimensionType.field_223227_a_; -+ -+ this.removePlayer(p_72368_1_); -+ p_72368_1_.func_71121_q().removePlayer(p_72368_1_, true); // Forge: keep data until copyFrom called -+ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_); -+ boolean flag = p_72368_1_.isSpawnForced(p_72368_2_); - p_72368_1_.field_71093_bK = p_72368_2_; - PlayerInteractionManager playerinteractionmanager; - if (this.field_72400_f.func_71242_L()) { -@@ -382,6 +406,8 @@ - ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager); - serverplayerentity.field_71135_a = p_72368_1_.field_71135_a; - serverplayerentity.func_193104_a(p_72368_1_, p_72368_3_); -+ p_72368_1_.remove(false); // Forge: clone event had a chance to see old data, now discard it -+ serverplayerentity.field_71093_bK = p_72368_2_; - serverplayerentity.func_145769_d(p_72368_1_.func_145782_y()); - serverplayerentity.func_184819_a(p_72368_1_.func_184591_cq()); - -@@ -396,7 +422,7 @@ - if (optional.isPresent()) { - Vec3d vec3d = optional.get(); - serverplayerentity.func_70012_b(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 0.0F, 0.0F); -- serverplayerentity.func_226560_a_(blockpos, flag, false); -+ serverplayerentity.setSpawnPoint(blockpos, flag, false, p_72368_2_); - } else { - serverplayerentity.field_71135_a.func_147359_a(new SChangeGameStatePacket(0, 0.0F)); - } -@@ -407,6 +433,7 @@ - } - - WorldInfo worldinfo = serverplayerentity.field_70170_p.func_72912_H(); -+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(serverplayerentity.field_71135_a.field_147371_a, serverplayerentity); - serverplayerentity.field_71135_a.func_147359_a(new SRespawnPacket(serverplayerentity.field_71093_bK, WorldInfo.func_227498_c_(worldinfo.func_76063_b()), worldinfo.func_76067_t(), serverplayerentity.field_71134_c.func_73081_b())); - BlockPos blockpos1 = serverworld.func_175694_M(); - serverplayerentity.field_71135_a.func_147364_a(serverplayerentity.func_226277_ct_(), serverplayerentity.func_226278_cu_(), serverplayerentity.func_226281_cx_(), serverplayerentity.field_70177_z, serverplayerentity.field_70125_A); -@@ -416,10 +443,11 @@ - this.func_72354_b(serverplayerentity, serverworld); +@@ -451,10 +458,11 @@ + this.func_72354_b(serverplayerentity, serverworld1); this.func_187243_f(serverplayerentity); - serverworld.func_217433_d(serverplayerentity); + serverworld1.func_217433_d(serverplayerentity); - this.field_72404_b.add(serverplayerentity); + this.addPlayer(serverplayerentity); this.field_177454_f.put(serverplayerentity.func_110124_au(), serverplayerentity); serverplayerentity.func_71116_b(); serverplayerentity.func_70606_j(serverplayerentity.func_110143_aJ()); -+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent(serverplayerentity, p_72368_3_); - return serverplayerentity; - } - -@@ -739,7 +767,7 @@ ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent(serverplayerentity, p_232644_2_); + if (flag1) { + serverplayerentity.field_71135_a.func_147359_a(new SPlaySoundEffectPacket(SoundEvents.field_232818_ms_, SoundCategory.BLOCKS, (double)blockpos.func_177958_n(), (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p(), 1.0F, 1.0F)); + } +@@ -772,7 +780,7 @@ } public List func_181057_v() { @@ -166,16 +96,16 @@ } @Nullable -@@ -769,4 +797,12 @@ +@@ -802,4 +810,12 @@ public boolean func_206257_x() { return this.field_72407_n; } + + public boolean addPlayer(ServerPlayerEntity player) { -+ return net.minecraftforge.common.DimensionManager.rebuildPlayerMap(this, this.field_72404_b.add(player)); ++ return field_72404_b.add(player); + } + + public boolean removePlayer(ServerPlayerEntity player) { -+ return net.minecraftforge.common.DimensionManager.rebuildPlayerMap(this, this.field_72404_b.remove(player)); ++ return this.field_72404_b.remove(player); + } } diff --git a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch index c8762c1a6..eb6207b2d 100644 --- a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch @@ -1,13 +1,19 @@ --- a/net/minecraft/tags/BlockTags.java +++ b/net/minecraft/tags/BlockTags.java -@@ -76,6 +76,10 @@ - return field_199899_c; +@@ -76,6 +76,7 @@ + public static final ITag.INamedTag field_232873_an_ = func_199894_a("nylium"); + public static final ITag.INamedTag field_232874_ao_ = func_199894_a("wart_blocks"); + public static final ITag.INamedTag field_232875_ap_ = func_199894_a("beacon_base_blocks"); ++ + public static final ITag.INamedTag field_232876_aq_ = func_199894_a("soul_speed_blocks"); + public static final ITag.INamedTag field_232877_ar_ = func_199894_a("wall_post_override"); + public static final ITag.INamedTag field_232878_as_ = func_199894_a("climbable"); +@@ -92,7 +93,7 @@ + public static final ITag.INamedTag field_241278_aD_ = func_199894_a("infiniburn_nether"); + public static final ITag.INamedTag field_241279_aE_ = func_199894_a("infiniburn_end"); + +- private static ITag.INamedTag func_199894_a(String p_199894_0_) { ++ public static ITag.INamedTag func_199894_a(String p_199894_0_) { + return field_199899_c.func_232937_a_(p_199894_0_); } -+ public static int getGeneration() { -+ return field_199900_d; -+ } -+ - private static Tag func_199894_a(String p_199894_0_) { - return new BlockTags.Wrapper(new ResourceLocation(p_199894_0_)); - } diff --git a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch b/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch deleted file mode 100644 index 31102526c..000000000 --- a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/tags/EntityTypeTags.java -+++ b/net/minecraft/tags/EntityTypeTags.java -@@ -24,6 +24,10 @@ - return field_219766_c; - } - -+ public static int getGeneration() { -+ return field_219767_d; -+ } -+ - private static Tag> func_219763_a(String p_219763_0_) { - return new EntityTypeTags.Wrapper(new ResourceLocation(p_219763_0_)); - } diff --git a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch index 2764b38c2..c4f1acdaa 100644 --- a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch @@ -1,13 +1,11 @@ --- a/net/minecraft/tags/ItemTags.java +++ b/net/minecraft/tags/ItemTags.java -@@ -62,6 +62,10 @@ - return field_199906_c; +@@ -63,7 +63,7 @@ + public static final ITag.INamedTag field_232909_aa_ = func_199901_a("stone_tool_materials"); + public static final ITag.INamedTag field_232910_ab_ = func_199901_a("furnace_materials"); + +- private static ITag.INamedTag func_199901_a(String p_199901_0_) { ++ public static ITag.INamedTag func_199901_a(String p_199901_0_) { + return field_199906_c.func_232937_a_(p_199901_0_); } -+ public static int getGeneration() { -+ return field_199907_d; -+ } -+ - private static Tag func_199901_a(String p_199901_0_) { - return new ItemTags.Wrapper(new ResourceLocation(p_199901_0_)); - } diff --git a/patches/minecraft/net/minecraft/tags/NetworkTagManager.java.patch b/patches/minecraft/net/minecraft/tags/NetworkTagManager.java.patch index 563dda411..bb75b6c87 100644 --- a/patches/minecraft/net/minecraft/tags/NetworkTagManager.java.patch +++ b/patches/minecraft/net/minecraft/tags/NetworkTagManager.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/tags/NetworkTagManager.java +++ b/net/minecraft/tags/NetworkTagManager.java @@ -69,6 +69,7 @@ - ItemTags.func_199902_a(this.field_199720_b); - FluidTags.func_206953_a(this.field_205705_c); - EntityTypeTags.func_219759_a(this.field_215299_d); + TagCollectionManager.func_232924_a_(this.field_199719_a, this.field_199720_b, this.field_205705_c, this.field_215299_d); + Multimap multimap = HashMultimap.create(); + multimap.putAll("blocks", BlockTags.func_232892_b_(this.field_199719_a)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this)); - }, p_215226_6_); - } - + multimap.putAll("items", ItemTags.func_232917_b_(this.field_199720_b)); + multimap.putAll("fluids", FluidTags.func_232901_b_(this.field_205705_c)); + multimap.putAll("entity_types", EntityTypeTags.func_232897_b_(this.field_215299_d)); diff --git a/patches/minecraft/net/minecraft/tags/Tag.java.patch b/patches/minecraft/net/minecraft/tags/Tag.java.patch index 69fbf0f7d..8d9fc88be 100644 --- a/patches/minecraft/net/minecraft/tags/Tag.java.patch +++ b/patches/minecraft/net/minecraft/tags/Tag.java.patch @@ -1,112 +1,15 @@ --- a/net/minecraft/tags/Tag.java +++ b/net/minecraft/tags/Tag.java -@@ -22,6 +22,7 @@ - private final ResourceLocation field_199888_a; - private final Set field_199889_b; - private final Collection> field_200150_c; -+ private boolean replace = false; - - public Tag(ResourceLocation p_i48236_1_) { - this.field_199888_a = p_i48236_1_; -@@ -30,6 +31,9 @@ +@@ -18,10 +18,12 @@ + this.field_241282_b_ = ImmutableList.copyOf(p_i241226_1_); } - public Tag(ResourceLocation p_i48224_1_, Collection> p_i48224_2_, boolean p_i48224_3_) { -+ this(p_i48224_1_, p_i48224_2_, p_i48224_3_, false); -+ } -+ private Tag(ResourceLocation p_i48224_1_, Collection> p_i48224_2_, boolean p_i48224_3_, boolean replace) { - this.field_199888_a = p_i48224_1_; - this.field_199889_b = (Set)(p_i48224_3_ ? Sets.newLinkedHashSet() : Sets.newHashSet()); - this.field_200150_c = p_i48224_2_; -@@ -45,11 +49,18 @@ - JsonArray jsonarray = new JsonArray(); - - for(Tag.ITagEntry itagentry : this.field_200150_c) { -+ if (!(itagentry instanceof net.minecraftforge.common.data.IOptionalTagEntry)) - itagentry.func_200576_a(jsonarray, p_200571_1_); - } -+ JsonArray optional = new JsonArray(); -+ for(Tag.ITagEntry itagentry : this.field_200150_c) { -+ if (itagentry instanceof net.minecraftforge.common.data.IOptionalTagEntry) -+ itagentry.func_200576_a(optional, p_200571_1_); -+ } - -- jsonobject.addProperty("replace", false); -+ jsonobject.addProperty("replace", replace); - jsonobject.add("values", jsonarray); -+ if (optional.size() > 0) jsonobject.add("optional", optional); - return jsonobject; ++ //TODO: empty + public static Tag func_241284_a_() { + return new Tag<>(ImmutableSet.of(), Void.class); } -@@ -74,9 +85,10 @@ - return this.field_199888_a; ++ //TODO OF + public static Tag func_241286_a_(Set p_241286_0_) { + return new Tag<>(p_241286_0_, func_241287_c_(p_241286_0_)); } - -- public static class Builder { -+ public static class Builder implements net.minecraftforge.common.extensions.IForgeTagBuilder { - private final Set> field_200052_a = Sets.newLinkedHashSet(); - private boolean field_200053_b; -+ private boolean replace = false; - - public static Tag.Builder func_200047_a() { - return new Tag.Builder<>(); -@@ -103,6 +115,22 @@ - return this; - } - -+ @SafeVarargs -+ public final Tag.Builder add(Tag... tags) { -+ for (Tag tag : tags) -+ func_200574_a(tag); -+ return this; -+ } -+ -+ public Tag.Builder replace(boolean value) { -+ this.replace = value; -+ return this; -+ } -+ -+ public Tag.Builder replace() { -+ return replace(true); -+ } -+ - public Tag.Builder func_200045_a(boolean p_200045_1_) { - this.field_200053_b = p_200045_1_; - return this; -@@ -119,7 +147,7 @@ - } - - public Tag func_200051_a(ResourceLocation p_200051_1_) { -- return new Tag<>(p_200051_1_, this.field_200052_a, this.field_200053_b); -+ return new Tag<>(p_200051_1_, this.field_200052_a, this.field_200053_b, this.replace); - } - - public Tag.Builder func_219783_a(Function> p_219783_1_, JsonObject p_219783_2_) { -@@ -143,8 +171,10 @@ - } - - 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 { -@@ -183,6 +213,8 @@ - public Collection func_200578_a() { - return this.field_200165_a; - } -+ @Override public int hashCode() { return this.field_200165_a.hashCode(); } -+ @Override public boolean equals(Object o) { return o == this || (o instanceof Tag.ListEntry && this.field_200165_a.equals(((Tag.ListEntry) o).field_200165_a)); } - } - - public static class TagEntry implements Tag.ITagEntry { -@@ -229,5 +261,7 @@ - public void func_200576_a(JsonArray p_200576_1_, Function p_200576_2_) { - p_200576_1_.add("#" + this.func_200577_a()); - } -+ @Override public int hashCode() { return java.util.Objects.hashCode(this.field_200163_a); } -+ @Override public boolean equals(Object o) { return o == this || (o instanceof Tag.TagEntry && java.util.Objects.equals(this.field_200163_a, ((Tag.TagEntry) o).field_200163_a)); } - } - } diff --git a/patches/minecraft/net/minecraft/tags/TagCollection.java.patch b/patches/minecraft/net/minecraft/tags/TagCollection.java.patch index ca95d1454..5c262afb4 100644 --- a/patches/minecraft/net/minecraft/tags/TagCollection.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagCollection.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/tags/TagCollection.java +++ b/net/minecraft/tags/TagCollection.java -@@ -154,4 +154,8 @@ - public Map> func_200039_c() { +@@ -167,4 +167,8 @@ + public Map> func_200039_c() { return this.field_199921_d; } + diff --git a/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch index 068593287..39e954a03 100644 --- a/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tileentity/AbstractFurnaceTileEntity.java +++ b/net/minecraft/tileentity/AbstractFurnaceTileEntity.java -@@ -85,6 +85,7 @@ +@@ -91,6 +91,7 @@ this.field_214014_c = p_i49964_2_; } @@ -8,7 +8,7 @@ public static Map func_214001_f() { Map map = Maps.newLinkedHashMap(); func_213996_a(map, Items.field_151129_at, 20000); -@@ -98,18 +99,8 @@ +@@ -104,18 +105,8 @@ func_213992_a(map, ItemTags.field_202899_i, 150); func_213992_a(map, ItemTags.field_212188_k, 300); func_213992_a(map, ItemTags.field_202900_j, 300); @@ -29,20 +29,25 @@ func_213996_a(map, Blocks.field_196586_al, 300); func_213996_a(map, Blocks.field_150342_X, 300); func_213996_a(map, Blocks.field_222428_lQ, 300); -@@ -169,9 +160,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"); +@@ -184,13 +175,13 @@ + return this.field_214018_j > 0; + } -@@ -185,9 +176,9 @@ +- public void func_230337_a_(BlockState p_230337_1_, CompoundNBT p_230337_2_) { ++ public void func_230337_a_(BlockState p_230337_1_, CompoundNBT p_230337_2_) { //TODO: MARK + super.func_230337_a_(p_230337_1_, p_230337_2_); + this.field_214012_a = NonNullList.func_191197_a(this.func_70302_i_(), ItemStack.field_190927_a); + ItemStackHelper.func_191283_b(p_230337_2_, this.field_214012_a); +- this.field_214018_j = p_230337_2_.func_74765_d("BurnTime"); +- this.field_214020_l = p_230337_2_.func_74765_d("CookTime"); +- this.field_214021_m = p_230337_2_.func_74765_d("CookTimeTotal"); ++ this.field_214018_j = p_230337_2_.func_74762_e("BurnTime"); ++ this.field_214020_l = p_230337_2_.func_74762_e("CookTime"); ++ this.field_214021_m = p_230337_2_.func_74762_e("CookTimeTotal"); + this.field_214019_k = this.func_213997_a(this.field_214012_a.get(1)); + CompoundNBT compoundnbt = p_230337_2_.func_74775_l("RecipesUsed"); + +@@ -202,9 +193,9 @@ public CompoundNBT func_189515_b(CompoundNBT p_189515_1_) { super.func_189515_b(p_189515_1_); @@ -53,9 +58,9 @@ + 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 +208,14 @@ + CompoundNBT compoundnbt = new CompoundNBT(); + this.field_214022_n.forEach((p_235643_1_, p_235643_2_) -> { +@@ -230,12 +221,14 @@ this.field_214019_k = this.field_214018_j; if (this.func_214006_r()) { flag1 = true; @@ -72,7 +77,7 @@ } } } -@@ -266,10 +259,10 @@ +@@ -279,10 +272,10 @@ return true; } else if (!itemstack1.func_77969_a(itemstack)) { return false; @@ -85,7 +90,7 @@ } } } else { -@@ -285,7 +278,7 @@ +@@ -298,7 +291,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()) { @@ -94,7 +99,7 @@ } if (!this.field_145850_b.field_72995_K) { -@@ -305,7 +298,7 @@ +@@ -318,7 +311,7 @@ return 0; } else { Item item = p_213997_1_.func_77973_b(); @@ -103,7 +108,7 @@ } } -@@ -314,7 +307,7 @@ +@@ -327,7 +320,7 @@ } public static boolean func_213991_b(ItemStack p_213991_0_) { @@ -112,7 +117,7 @@ } public int[] func_180463_a(Direction p_180463_1_) { -@@ -462,4 +455,27 @@ +@@ -474,4 +467,27 @@ } } diff --git a/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch b/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch index a2e4469c2..b615c598a 100644 --- a/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/tileentity/BannerPattern.java +++ b/net/minecraft/tileentity/BannerPattern.java -@@ -14,7 +14,7 @@ +@@ -12,7 +12,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.apache.commons.lang3.tuple.Pair; -public enum BannerPattern { +public enum BannerPattern implements net.minecraftforge.common.IExtensibleEnum { - BASE("base", "b"), - SQUARE_BOTTOM_LEFT("square_bottom_left", "bl", " ", " ", "# "), - SQUARE_BOTTOM_RIGHT("square_bottom_right", "br", " ", " ", " #"), -@@ -107,6 +107,14 @@ + BASE("base", "b", false), + SQUARE_BOTTOM_LEFT("square_bottom_left", "bl"), + SQUARE_BOTTOM_RIGHT("square_bottom_right", "br"), +@@ -102,6 +102,14 @@ return null; } -+ public static BannerPattern create(String enumName, String p_i47246_3_, String p_i47246_4_, ItemStack p_i47246_5_) { ++ public static BannerPattern create(String enumName, String p_i47246_3_, String p_i47246_4_, net.minecraft.item.ItemStack p_i47246_5_) { + throw new IllegalStateException("Enum not extended"); + } + diff --git a/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch index e0bc78c55..2ef969f53 100644 --- a/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tileentity/BeaconTileEntity.java +++ b/net/minecraft/tileentity/BeaconTileEntity.java -@@ -111,8 +111,8 @@ +@@ -112,8 +112,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(); @@ -11,12 +11,11 @@ if (this.field_213934_g.size() <= 1) { beacontileentity$beamsegment = new BeaconTileEntity.BeamSegment(afloat); this.field_213934_g.add(beacontileentity$beamsegment); -@@ -183,8 +183,7 @@ +@@ -184,7 +184,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)).func_235714_a_(BlockTags.field_232875_ap_)) { + 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/ChestTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch index aeb6a29f3..44dcdc22f 100644 --- a/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch @@ -12,7 +12,7 @@ public static int func_195481_a(IBlockReader p_195481_0_, BlockPos p_195481_1_) { BlockState blockstate = p_195481_0_.func_180495_p(p_195481_1_); -- if (blockstate.func_177230_c().func_149716_u()) { +- if (blockstate.func_177230_c().func_235695_q_()) { + if (blockstate.hasTileEntity()) { TileEntity tileentity = p_195481_0_.func_175625_s(p_195481_1_); if (tileentity instanceof ChestTileEntity) { diff --git a/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch index 2f91940c2..1e8a4052a 100644 --- a/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch @@ -21,7 +21,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 (block.func_235695_q_()) { + } else if (blockstate.hasTileEntity()) { TileEntity tileentity = p_145893_0_.func_175625_s(blockpos); if (tileentity instanceof IInventory) { diff --git a/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch index f73a95fca..6324afff4 100644 --- a/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tileentity/LockableTileEntity.java +++ b/net/minecraft/tileentity/LockableTileEntity.java -@@ -80,4 +80,22 @@ +@@ -81,4 +81,22 @@ } protected abstract Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_); diff --git a/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch index 3d6a3748b..5dd8af426 100644 --- a/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/tileentity/PistonTileEntity.java +++ b/net/minecraft/tileentity/PistonTileEntity.java -@@ -105,7 +105,7 @@ - AxisAlignedBB axisalignedbb = this.func_190607_a(this.func_191515_a(list)); - List list1 = this.field_145850_b.func_72839_b((Entity)null, AabbHelper.func_227019_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.isSlimeBlock(); //TODO: Merge with isStickyBlock? Look into further how vanilla splits slime vs honey +@@ -107,7 +107,7 @@ + List list = this.field_145850_b.func_72839_b((Entity)null, AabbHelper.func_227019_a_(axisalignedbb, direction, d0).func_111270_a(axisalignedbb)); + if (!list.isEmpty()) { + List list1 = voxelshape.func_197756_d(); +- boolean flag = this.field_200231_a.func_203425_a(Blocks.field_180399_cE); ++ boolean flag = this.field_200231_a.isSlimeBlock(); //TODO: is this patch really needed the logic of the original seems sound revisit later - for(Entity entity : list1) { + for(Entity entity : list) { if (entity.func_184192_z() != PushReaction.IGNORE) { diff --git a/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch index 201050a88..34b00e95e 100644 --- a/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/tileentity/ShulkerBoxTileEntity.java +++ b/net/minecraft/tileentity/ShulkerBoxTileEntity.java -@@ -280,6 +280,11 @@ - return new ShulkerBoxContainer(p_213906_1_, p_213906_2_, this); +@@ -284,6 +284,11 @@ + return this.field_190599_i == ShulkerBoxTileEntity.AnimationStatus.CLOSED; } + @Override diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index d8048f17b..2fb20af62 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -24,10 +24,10 @@ @Nullable @@ -47,6 +50,8 @@ - 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 void func_230337_a_(BlockState p_230337_1_, CompoundNBT p_230337_2_) { + this.field_174879_c = new BlockPos(p_230337_2_.func_74762_e("x"), p_230337_2_.func_74762_e("y"), p_230337_2_.func_74762_e("z")); ++ if (p_230337_2_.func_74764_b("ForgeData")) this.customTileData = p_230337_2_.func_74775_l("ForgeData"); ++ if (getCapabilities() != null && p_230337_2_.func_74764_b("ForgeCaps")) deserializeCaps(p_230337_2_.func_74775_l("ForgeCaps")); } public CompoundNBT func_189515_b(CompoundNBT p_189515_1_) { @@ -49,7 +49,7 @@ this.field_145850_b.func_175666_e(this.field_174879_c, this.field_195045_e.func_177230_c()); } } -@@ -140,6 +147,8 @@ +@@ -133,6 +140,8 @@ public void func_145843_s() { this.field_145846_f = true; @@ -58,7 +58,7 @@ } public void func_145829_t() { -@@ -182,6 +191,13 @@ +@@ -175,6 +184,13 @@ return this.field_200663_e; } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch index 5083d1d95..f310a7d70 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tileentity/TileEntityType.java +++ b/net/minecraft/tileentity/TileEntityType.java -@@ -18,7 +18,7 @@ +@@ -16,7 +16,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch index 5620c15dd..7cce810a9 100644 --- a/patches/minecraft/net/minecraft/util/Session.java.patch +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -31,19 +31,19 @@ + GameProfile ret = new GameProfile(uuid, this.func_111285_a()); //Forge: Adds cached GameProfile properties to returned GameProfile. + if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service, + return ret; // which helps to fix MC-52974. - } catch (IllegalArgumentException var2) { + } catch (IllegalArgumentException illegalargumentexception) { return new GameProfile((UUID)null, this.func_111285_a()); } } + //For internal use only. Modders should never need to use this. + public void setProperties(com.mojang.authlib.properties.PropertyMap properties) { -+ if (this.properties == null) -+ this.properties = properties; ++ if (this.properties == null) ++ this.properties = properties; + } + + public boolean hasCachedProperties() { -+ return properties != null; ++ return properties != null; + } + @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/util/SharedConstants.java.patch b/patches/minecraft/net/minecraft/util/SharedConstants.java.patch index e0b080dd5..d6e69c0e0 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 -@@ -57,6 +57,7 @@ +@@ -40,6 +40,7 @@ } static { diff --git a/patches/minecraft/net/minecraft/util/SoundEvent.java.patch b/patches/minecraft/net/minecraft/util/SoundEvent.java.patch index 0ee27eff1..e43dc3148 100644 --- a/patches/minecraft/net/minecraft/util/SoundEvent.java.patch +++ b/patches/minecraft/net/minecraft/util/SoundEvent.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/util/SoundEvent.java +++ b/net/minecraft/util/SoundEvent.java -@@ -3,7 +3,7 @@ +@@ -4,7 +4,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -public class SoundEvent { +public class SoundEvent extends net.minecraftforge.registries.ForgeRegistryEntry { - private final ResourceLocation field_187506_b; - - public SoundEvent(ResourceLocation p_i46834_1_) { + public static final Codec field_232678_a_ = ResourceLocation.field_240908_a_.xmap(SoundEvent::new, (p_232679_0_) -> { + return p_232679_0_.field_187506_b; + }); diff --git a/patches/minecraft/net/minecraft/util/SoundEvents.java.patch b/patches/minecraft/net/minecraft/util/SoundEvents.java.patch index 4dfb06a40..71dad5e55 100644 --- a/patches/minecraft/net/minecraft/util/SoundEvents.java.patch +++ b/patches/minecraft/net/minecraft/util/SoundEvents.java.patch @@ -7,4 +7,4 @@ +@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"); + public static final SoundEvent field_232692_b_ = func_219592_a("ambient.basalt_deltas.additions"); diff --git a/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch b/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch index 508e4d06d..f0cfcbd27 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 -@@ -8,7 +8,12 @@ - } +@@ -5,7 +5,12 @@ - public abstract RayTraceResult.Type func_216346_c(); + public abstract class RayTraceResult { + protected final Vector3d field_72307_f; + /** Used to determine what sub-segment is hit */ + public int subHit = -1; + /** Used to add extra hit info */ + public Object hitInfo = null; + - public Vec3d func_216347_e() { - return this.field_72307_f; + protected RayTraceResult(Vector3d p_i51183_1_) { + this.field_72307_f = p_i51183_1_; } diff --git a/patches/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch b/patches/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch index 6e95eb98c..7c8c502f1 100644 --- a/patches/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch +++ b/patches/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch @@ -1,27 +1,18 @@ --- a/net/minecraft/util/math/shapes/EntitySelectionContext.java +++ b/net/minecraft/util/math/shapes/EntitySelectionContext.java -@@ -18,6 +18,11 @@ - private final Item field_216382_d; +@@ -25,6 +25,11 @@ + private final Predicate field_237493_e_; - protected EntitySelectionContext(boolean p_i51181_1_, double p_i51181_2_, Item p_i51181_4_) { -+ this(null, p_i51181_1_, p_i51181_2_, p_i51181_4_); + protected EntitySelectionContext(boolean p_i232177_1_, double p_i232177_2_, Item p_i232177_4_, Predicate p_i232177_5_) { ++ this(null, p_i232177_1_, p_i232177_2_, p_i232177_4_, p_i232177_5_); + } + -+ protected EntitySelectionContext(@javax.annotation.Nullable Entity entityIn, boolean p_i51181_1_, double p_i51181_2_, Item p_i51181_4_) { -+ this.entity = entityIn; - this.field_227579_b_ = p_i51181_1_; - this.field_216381_c = p_i51181_2_; - this.field_216382_d = p_i51181_4_; -@@ -25,7 +30,7 @@ - - @Deprecated - protected EntitySelectionContext(Entity p_i51182_1_) { -- this(p_i51182_1_.func_226274_bn_(), p_i51182_1_.func_226278_cu_(), p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).func_184614_ca().func_77973_b() : Items.field_190931_a); -+ this(p_i51182_1_, p_i51182_1_.func_226274_bn_(), p_i51182_1_.func_226278_cu_(), p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).func_184614_ca().func_77973_b() : Items.field_190931_a); - } - - public boolean func_216375_a(Item p_216375_1_) { -@@ -39,4 +44,11 @@ ++ protected EntitySelectionContext(@javax.annotation.Nullable Entity entity, boolean p_i232177_1_, double p_i232177_2_, Item p_i232177_4_, Predicate p_i232177_5_) { ++ this.entity = entity; + this.field_227579_b_ = p_i232177_1_; + this.field_216381_c = p_i232177_2_; + this.field_216382_d = p_i232177_4_; +@@ -53,4 +58,11 @@ public boolean func_216378_a(VoxelShape p_216378_1_, BlockPos p_216378_2_, boolean p_216378_3_) { return this.field_216381_c > (double)p_216378_2_.func_177956_o() + p_216378_1_.func_197758_c(Direction.Axis.Y) - (double)1.0E-5F; } diff --git a/patches/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch b/patches/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch index 13cd00bf6..1eb4e13cd 100644 --- a/patches/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch +++ b/patches/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/math/shapes/ISelectionContext.java +++ b/net/minecraft/util/math/shapes/ISelectionContext.java -@@ -4,7 +4,7 @@ +@@ -6,7 +6,7 @@ import net.minecraft.item.Item; import net.minecraft.util.math.BlockPos; diff --git a/patches/minecraft/net/minecraft/util/math/vector/Matrix3f.java.patch b/patches/minecraft/net/minecraft/util/math/vector/Matrix3f.java.patch new file mode 100644 index 000000000..1bd87cb72 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/math/vector/Matrix3f.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/util/math/vector/Matrix3f.java ++++ b/net/minecraft/util/math/vector/Matrix3f.java +@@ -444,4 +444,11 @@ + public Matrix3f func_226121_d_() { + return new Matrix3f(this); + } ++ ++ // Forge start ++ public void multiplyBackward(Matrix3f other) { ++ Matrix3f copy = other.func_226121_d_(); ++ copy.func_226118_b_(this); ++ this.func_226114_a_(copy); ++ } + } diff --git a/patches/minecraft/net/minecraft/util/math/vector/Matrix4f.java.patch b/patches/minecraft/net/minecraft/util/math/vector/Matrix4f.java.patch new file mode 100644 index 000000000..85378c944 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/math/vector/Matrix4f.java.patch @@ -0,0 +1,81 @@ +--- a/net/minecraft/util/math/vector/Matrix4f.java ++++ b/net/minecraft/util/math/vector/Matrix4f.java +@@ -386,4 +386,78 @@ + matrix4f.field_226586_l_ = p_226599_2_; + return matrix4f; + } ++ ++ // Forge start ++ public Matrix4f(float[] values) { ++ field_226575_a_ = values[0]; ++ field_226576_b_ = values[1]; ++ field_226577_c_ = values[2]; ++ field_226578_d_ = values[3]; ++ field_226579_e_ = values[4]; ++ field_226580_f_ = values[5]; ++ field_226581_g_ = values[6]; ++ field_226582_h_ = values[7]; ++ field_226583_i_ = values[8]; ++ field_226584_j_ = values[9]; ++ field_226585_k_ = values[10]; ++ field_226586_l_ = values[11]; ++ field_226587_m_ = values[12]; ++ field_226588_n_ = values[13]; ++ field_226589_o_ = values[14]; ++ field_226590_p_ = values[15]; ++ } ++ ++ public void set(Matrix4f mat) { ++ this.field_226575_a_ = mat.field_226575_a_; ++ this.field_226576_b_ = mat.field_226576_b_; ++ this.field_226577_c_ = mat.field_226577_c_; ++ this.field_226578_d_ = mat.field_226578_d_; ++ this.field_226579_e_ = mat.field_226579_e_; ++ this.field_226580_f_ = mat.field_226580_f_; ++ this.field_226581_g_ = mat.field_226581_g_; ++ this.field_226582_h_ = mat.field_226582_h_; ++ this.field_226583_i_ = mat.field_226583_i_; ++ this.field_226584_j_ = mat.field_226584_j_; ++ this.field_226585_k_ = mat.field_226585_k_; ++ this.field_226586_l_ = mat.field_226586_l_; ++ this.field_226587_m_ = mat.field_226587_m_; ++ this.field_226588_n_ = mat.field_226588_n_; ++ this.field_226589_o_ = mat.field_226589_o_; ++ this.field_226590_p_ = mat.field_226590_p_; ++ } ++ ++ public void add(Matrix4f other) { ++ field_226575_a_ += other.field_226575_a_; ++ field_226576_b_ += other.field_226576_b_; ++ field_226577_c_ += other.field_226577_c_; ++ field_226578_d_ += other.field_226578_d_; ++ field_226579_e_ += other.field_226579_e_; ++ field_226580_f_ += other.field_226580_f_; ++ field_226581_g_ += other.field_226581_g_; ++ field_226582_h_ += other.field_226582_h_; ++ field_226583_i_ += other.field_226583_i_; ++ field_226584_j_ += other.field_226584_j_; ++ field_226585_k_ += other.field_226585_k_; ++ field_226586_l_ += other.field_226586_l_; ++ field_226587_m_ += other.field_226587_m_; ++ field_226588_n_ += other.field_226588_n_; ++ field_226589_o_ += other.field_226589_o_; ++ field_226590_p_ += other.field_226590_p_; ++ } ++ ++ public void multiplyBackward(Matrix4f other) { ++ Matrix4f copy = other.func_226601_d_(); ++ copy.func_226595_a_(this); ++ this.set(copy); ++ } ++ ++ public void setTranslation(float x, float y, float z) { ++ this.field_226575_a_ = 1.0F; ++ this.field_226580_f_ = 1.0F; ++ this.field_226585_k_ = 1.0F; ++ this.field_226590_p_ = 1.0F; ++ this.field_226578_d_ = x; ++ this.field_226582_h_ = y; ++ this.field_226586_l_ = z; ++ } + } diff --git a/patches/minecraft/net/minecraft/util/math/vector/TransformationMatrix.java.patch b/patches/minecraft/net/minecraft/util/math/vector/TransformationMatrix.java.patch new file mode 100644 index 000000000..0bd0f40d0 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/math/vector/TransformationMatrix.java.patch @@ -0,0 +1,44 @@ +--- a/net/minecraft/util/math/vector/TransformationMatrix.java ++++ b/net/minecraft/util/math/vector/TransformationMatrix.java +@@ -9,7 +9,7 @@ + import org.apache.commons.lang3.tuple.Triple; + + @OnlyIn(Dist.CLIENT) +-public final class TransformationMatrix { ++public final class TransformationMatrix implements net.minecraftforge.client.extensions.IForgeTransformationMatrix { + private final Matrix4f field_227976_a_; + private boolean field_227977_b_; + @Nullable +@@ -133,4 +133,32 @@ + public int hashCode() { + return Objects.hash(this.field_227976_a_); + } ++ ++ // FORGE START ++ public Vector3f getTranslation() { ++ func_227990_e_(); ++ return field_227978_c_.func_229195_e_(); ++ } ++ public Vector3f getScale() { ++ func_227990_e_(); ++ return field_227980_e_.func_229195_e_(); ++ } ++ ++ public Quaternion getRightRot() { ++ func_227990_e_(); ++ return field_227981_f_.func_227068_g_(); ++ } ++ ++ private Matrix3f normalTransform = null; ++ public Matrix3f getNormalMatrix() { ++ checkNormalTransform(); ++ return normalTransform; ++ } ++ private void checkNormalTransform() { ++ if (normalTransform == null) { ++ normalTransform = new Matrix3f(field_227976_a_); ++ normalTransform.func_226123_f_(); ++ normalTransform.func_226110_a_(); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/util/math/vector/Vector3f.java.patch b/patches/minecraft/net/minecraft/util/math/vector/Vector3f.java.patch new file mode 100644 index 000000000..78e510f82 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/math/vector/Vector3f.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/util/math/vector/Vector3f.java ++++ b/net/minecraft/util/math/vector/Vector3f.java +@@ -196,4 +196,17 @@ + public String toString() { + return "[" + this.field_229184_g_ + ", " + this.field_229185_h_ + ", " + this.field_229186_i_ + "]"; + } ++ ++ // Forge start ++ public Vector3f(float[] values) { ++ set(values); ++ } ++ public void set(float[] values) { ++ this.field_229184_g_ = values[0]; ++ this.field_229185_h_ = values[1]; ++ this.field_229186_i_ = values[2]; ++ } ++ public void setX(float x) { this.field_229184_g_ = x; } ++ public void setY(float y) { this.field_229185_h_ = y; } ++ public void setZ(float z) { this.field_229186_i_ = z; } + } diff --git a/patches/minecraft/net/minecraft/util/math/vector/Vector4f.java.patch b/patches/minecraft/net/minecraft/util/math/vector/Vector4f.java.patch new file mode 100644 index 000000000..f8a6138d5 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/math/vector/Vector4f.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/util/math/vector/Vector4f.java ++++ b/net/minecraft/util/math/vector/Vector4f.java +@@ -128,4 +128,16 @@ + public String toString() { + return "[" + this.field_229368_a_ + ", " + this.field_229369_b_ + ", " + this.field_229370_c_ + ", " + this.field_229371_d_ + "]"; + } ++ ++ // Forge start ++ public void set(float[] values) { ++ this.field_229368_a_ = values[0]; ++ this.field_229369_b_ = values[1]; ++ this.field_229370_c_ = values[2]; ++ this.field_229371_d_ = values[3]; ++ } ++ public void setX(float x) { this.field_229368_a_ = x; } ++ public void setY(float y) { this.field_229369_b_ = y; } ++ public void setZ(float z) { this.field_229370_c_ = z; } ++ public void setW(float z) { this.field_229371_d_ = z; } + } diff --git a/patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch b/patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch index 5c5ec295b..ddcb127c6 100644 --- a/patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch +++ b/patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/palette/PalettedContainer.java +++ b/net/minecraft/util/palette/PalettedContainer.java -@@ -65,8 +65,11 @@ +@@ -66,8 +66,11 @@ } private void func_186012_b(int p_186012_1_) { @@ -13,8 +13,8 @@ + this.field_186024_e = bitsIn; if (this.field_186024_e <= 4) { this.field_186024_e = 4; - this.field_186022_c = new PaletteArray<>(this.field_205523_d, this.field_186024_e, this, this.field_205524_e); -@@ -75,6 +78,8 @@ + this.field_186022_c = new ArrayPalette<>(this.field_205523_d, this.field_186024_e, this, this.field_205524_e); +@@ -76,6 +79,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()); @@ -23,7 +23,7 @@ } this.field_186022_c.func_186041_a(this.field_205526_g); -@@ -137,12 +142,16 @@ +@@ -138,12 +143,16 @@ this.func_210459_b(); int i = p_186010_1_.readByte(); if (this.field_186024_e != i) { diff --git a/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch b/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch index 652058f95..07e3a979c 100644 --- a/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/registry/Bootstrap.java +++ b/net/minecraft/util/registry/Bootstrap.java -@@ -43,6 +43,7 @@ +@@ -46,6 +46,7 @@ EntityOptions.func_197445_a(); IDispenseItemBehavior.func_218401_c(); ArgumentTypes.func_197483_a(); diff --git a/patches/minecraft/net/minecraft/util/registry/Registry.java.patch b/patches/minecraft/net/minecraft/util/registry/Registry.java.patch index 7745a7fdc..081d4a6ec 100644 --- a/patches/minecraft/net/minecraft/util/registry/Registry.java.patch +++ b/patches/minecraft/net/minecraft/util/registry/Registry.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/registry/Registry.java +++ b/net/minecraft/util/registry/Registry.java -@@ -70,88 +70,90 @@ +@@ -85,6 +85,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -8,175 +8,174 @@ + * 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 necessary for syncing and management. + */ - public abstract class Registry implements IObjectIntIterable { + public abstract class Registry implements Codec, Keyable, 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, () -> { +@@ -141,64 +145,64 @@ + public static final RegistryKey> field_239698_ad_ = func_239741_a_("dimension_type"); + public static final RegistryKey> field_239699_ae_ = func_239741_a_("dimension"); + public static final RegistryKey> field_239700_af_ = func_239741_a_("dimension"); +- public static final Registry field_212633_v = func_239746_a_(field_239708_i_, () -> { ++ @Deprecated public static final Registry field_212633_v = forge(field_239708_i_, SoundEvent.class, () -> { return SoundEvents.field_187638_cR; }); -- public static final DefaultedRegistry field_212619_h = func_222933_a("fluid", "empty", () -> { -+ @Deprecated public static final DefaultedRegistry field_212619_h = forgeDefaulted("fluid", Fluid.class, () -> { +- public static final DefaultedRegistry field_212619_h = func_239745_a_(field_239709_j_, "empty", () -> { ++ @Deprecated public static final DefaultedRegistry field_212619_h = forgeDefaulted(field_239709_j_, Fluid.class, () -> { 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, () -> { +- public static final Registry field_212631_t = func_239746_a_(field_239710_k_, () -> { ++ @Deprecated public static final Registry field_212631_t = forge(field_239710_k_, 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, () -> { +- public static final DefaultedRegistry field_212618_g = func_239745_a_(field_239711_l_, "air", () -> { ++ @Deprecated public static final DefaultedRegistry field_212618_g = forgeDefaulted(field_239711_l_, 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, () -> { +- public static final Registry field_212628_q = func_239746_a_(field_239712_m_, () -> { ++ @Deprecated public static final Registry field_212628_q = forge(field_239712_m_, 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, () -> { +- public static final DefaultedRegistry> field_212629_r = func_239745_a_(field_239713_n_, "pig", () -> { ++ @Deprecated public static final DefaultedRegistry> field_212629_r = forgeDefaulted(field_239713_n_, 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, () -> { +- public static final DefaultedRegistry field_212630_s = func_239745_a_(field_239714_o_, "air", () -> { ++ @Deprecated public static final DefaultedRegistry field_212630_s = forgeDefaulted(field_239714_o_, 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, () -> { +- public static final DefaultedRegistry field_212621_j = func_239745_a_(field_239715_p_, "empty", () -> { ++ @Deprecated public static final DefaultedRegistry field_212621_j = forgeDefaulted(field_239715_p_, Potion.class, () -> { return Potions.field_185229_a; }); -- public static final Registry> field_218377_o = func_222935_a("carver", () -> { -+ @Deprecated public static final Registry> field_218377_o = forge("carver", WorldCarver.class, () -> { +- public static final Registry> field_218377_o = func_239746_a_(field_239716_q_, () -> { ++ @Deprecated public static final Registry> field_218377_o = forge(field_239716_q_, WorldCarver.class, () -> { return WorldCarver.field_222709_a; }); -- public static final Registry> field_218378_p = func_222935_a("surface_builder", () -> { -+ @Deprecated public static final Registry> field_218378_p = forge("surface_builder", SurfaceBuilder.class, () -> { +- public static final Registry> field_218378_p = func_239746_a_(field_239717_r_, () -> { ++ @Deprecated public static final Registry> field_218378_p = forge(field_239717_r_, SurfaceBuilder.class, () -> { return SurfaceBuilder.field_215396_G; }); -- public static final Registry> field_218379_q = func_222935_a("feature", () -> { -+ @Deprecated public static final Registry> field_218379_q = forge("feature", Feature.class, () -> { +- public static final Registry> field_218379_q = func_239746_a_(field_239718_s_, () -> { ++ @Deprecated public static final Registry> field_218379_q = forge(field_239718_s_, Feature.class, () -> { return Feature.field_202290_aj; }); -- public static final Registry> field_218380_r = func_222935_a("decorator", () -> { -+ @Deprecated public static final Registry> field_218380_r = forge("decorator", Placement.class, () -> { +- public static final Registry> field_218380_r = func_239746_a_(field_239719_t_, () -> { ++ @Deprecated public static final Registry> field_218380_r = forge(field_239719_t_, Placement.class, () -> { 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, () -> { +- public static final Registry field_212624_m = func_239746_a_(field_239720_u_, () -> { ++ @Deprecated public static final Registry field_212624_m = forge(field_239720_u_, Biome.class, () -> { return Biomes.field_180279_ad; }); -- public static final Registry> field_229387_t_ = func_222935_a("block_state_provider_type", () -> { -+ @Deprecated public static final Registry> field_229387_t_ = forge("block_state_provider_type", BlockStateProviderType.class, () -> { +- public static final Registry> field_229387_t_ = func_239746_a_(field_239721_v_, () -> { ++ @Deprecated public static final Registry> field_229387_t_ = forge(field_239721_v_, BlockStateProviderType.class, () -> { return BlockStateProviderType.field_227394_a_; }); -- public static final Registry> field_229388_u_ = func_222935_a("block_placer_type", () -> { -+ @Deprecated public static final Registry> field_229388_u_ = forge("block_placer_type", BlockPlacerType.class, () -> { +- public static final Registry> field_229388_u_ = func_239746_a_(field_239722_w_, () -> { ++ @Deprecated public static final Registry> field_229388_u_ = forge(field_239722_w_, BlockPlacerType.class, () -> { return BlockPlacerType.field_227259_a_; }); -- public static final Registry> field_229389_v_ = func_222935_a("foliage_placer_type", () -> { -+ @Deprecated public static final Registry> field_229389_v_ = forge("foliage_placer_type", FoliagePlacerType.class, () -> { +- public static final Registry> field_229389_v_ = func_239746_a_(field_239723_x_, () -> { ++ @Deprecated public static final Registry> field_229389_v_ = forge(field_239723_x_, FoliagePlacerType.class, () -> { return FoliagePlacerType.field_227386_a_; }); -- public static final Registry> field_229390_w_ = func_222935_a("tree_decorator_type", () -> { -+ @Deprecated public static final Registry> field_229390_w_ = forge("tree_decorator_type", TreeDecoratorType.class, () -> { + public static final Registry> field_239701_aw_ = func_239746_a_(field_239724_y_, () -> { + return TrunkPlacerType.field_236920_a_; + }); +- public static final Registry> field_229390_w_ = func_239746_a_(field_239725_z_, () -> { ++ @Deprecated public static final Registry> field_229390_w_ = forge(field_239725_z_, TreeDecoratorType.class, () -> { return TreeDecoratorType.field_227426_b_; }); -- public static final Registry> field_212632_u = func_222935_a("particle_type", () -> { -+ @Deprecated public static final Registry> field_212632_u = forge("particle_type", ParticleType.class, () -> { + public static final Registry> field_239702_ay_ = func_239746_a_(field_239663_A_, () -> { + return FeatureSizeType.field_236711_a_; + }); +- public static final Registry> field_212632_u = func_239746_a_(field_239664_B_, () -> { ++ @Deprecated public static final Registry> field_212632_u = forge(field_239664_B_, ParticleType.class, () -> { return ParticleTypes.field_197611_d; }); -- public static final Registry> field_212625_n = func_222935_a("biome_source_type", () -> { -+ @Deprecated public static final Registry> field_212625_n = forge("biome_source_type", BiomeProviderType.class, () -> { - return BiomeProviderType.field_206859_d; + public static final Registry> field_239689_aA_ = func_239742_a_(field_239665_C_, Lifecycle.stable(), () -> { +@@ -207,16 +211,16 @@ + public static final Registry> field_239690_aB_ = func_239742_a_(field_239666_D_, Lifecycle.stable(), () -> { + return ChunkGenerator.field_235948_a_; }); -- 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, () -> { +- public static final Registry> field_212626_o = func_239746_a_(field_239667_E_, () -> { ++ @Deprecated public static final Registry> field_212626_o = forge(field_239667_E_, TileEntityType.class, () -> { return TileEntityType.field_200971_b; }); -- public static final Registry> field_212627_p = func_222935_a("chunk_generator_type", () -> { -+ @Deprecated public static final Registry> field_212627_p = forge("chunk_generator_type", ChunkGeneratorType.class, () -> { - return ChunkGeneratorType.field_205489_f; - }); -- public static final Registry field_212622_k = func_222935_a("dimension_type", () -> { -+ @Deprecated public static final Registry field_212622_k = func_222939_a("dimension_type", net.minecraftforge.common.DimensionManager.getRegistry(), () -> { - return DimensionType.field_223227_a_; - }); -- public static final DefaultedRegistry field_212620_i = func_222933_a("motive", "kebab", () -> { -+ @Deprecated public static final DefaultedRegistry field_212620_i = forgeDefaulted("motive", PaintingType.class, () -> { +- public static final DefaultedRegistry field_212620_i = func_239745_a_(field_239668_F_, "kebab", () -> { ++ @Deprecated public static final DefaultedRegistry field_212620_i = forgeDefaulted(field_239668_F_, PaintingType.class, () -> { return PaintingType.field_200843_b; }); - public static final Registry field_212623_l = func_222935_a("custom_stat", () -> { + public static final Registry field_212623_l = func_239746_a_(field_239669_G_, () -> { return Stats.field_75953_u; }); -- public static final DefaultedRegistry field_218360_A = func_222933_a("chunk_status", "empty", () -> { -+ @Deprecated public static final DefaultedRegistry field_218360_A = forgeDefaulted("chunk_status", ChunkStatus.class, () -> { +- public static final DefaultedRegistry field_218360_A = func_239745_a_(field_239670_H_, "empty", () -> { ++ @Deprecated public static final DefaultedRegistry field_218360_A = forgeDefaulted(field_239670_H_, ChunkStatus.class, () -> { return ChunkStatus.field_223226_a_; }); -- public static final Registry> field_218361_B = func_222935_a("structure_feature", () -> { -- return Structures.field_215143_a; -- }); -+ @Deprecated public static final Registry> field_218361_B = net.minecraftforge.registries.GameData.getStructureFeatures(); - public static final Registry field_218362_C = func_222935_a("structure_piece", () -> { - return IStructurePieceType.field_214782_c; - }); -@@ -164,37 +166,37 @@ - public static final Registry field_218365_F = func_222935_a("structure_pool_element", () -> { + public static final Registry> field_218361_B = func_239746_a_(field_239671_I_, () -> { +@@ -237,40 +241,40 @@ + public static final Registry> field_218365_F = func_239746_a_(field_239676_N_, () -> { return IJigsawDeserializer.field_214931_e; }); -- public static final Registry> field_218366_G = func_222935_a("menu", () -> { -+ @Deprecated public static final Registry> field_218366_G = forge("menu", ContainerType.class, () -> { +- public static final Registry> field_218366_G = func_239746_a_(field_239677_O_, () -> { ++ @Deprecated public static final Registry> field_218366_G = forge(field_239677_O_, ContainerType.class, () -> { return ContainerType.field_221514_h; }); - public static final Registry> field_218367_H = func_222935_a("recipe_type", () -> { + public static final Registry> field_218367_H = func_239746_a_(field_239678_P_, () -> { return IRecipeType.field_222149_a; }); -- public static final Registry> field_218368_I = func_222935_a("recipe_serializer", () -> { -+ @Deprecated public static final Registry> field_218368_I = forge("recipe_serializer", IRecipeSerializer.class, () -> { +- public static final Registry> field_218368_I = func_239746_a_(field_239679_Q_, () -> { ++ @Deprecated public static final Registry> field_218368_I = forge(field_239679_Q_, IRecipeSerializer.class, () -> { return IRecipeSerializer.field_222158_b; }); -- public static final Registry> field_212634_w = func_222935_a("stat_type", () -> { -+ @Deprecated public static final Registry> field_212634_w = forge("stat_type", StatType.class, () -> { + public static final Registry field_239692_aP_ = func_239746_a_(field_239680_R_, () -> { + return Attributes.field_233828_k_; + }); +- public static final Registry> field_212634_w = func_239746_a_(field_239681_S_, () -> { ++ @Deprecated public static final Registry> field_212634_w = forge(field_239681_S_, StatType.class, () -> { return Stats.field_75929_E; }); - public static final DefaultedRegistry field_218369_K = func_222933_a("villager_type", "plains", () -> { + public static final DefaultedRegistry field_218369_K = func_239745_a_(field_239682_T_, "plains", () -> { return IVillagerType.field_221175_c; }); -- public static final DefaultedRegistry field_218370_L = func_222933_a("villager_profession", "none", () -> { -+ @Deprecated public static final DefaultedRegistry field_218370_L = forgeDefaulted("villager_profession", VillagerProfession.class, () -> { +- public static final DefaultedRegistry field_218370_L = func_239745_a_(field_239683_U_, "none", () -> { ++ @Deprecated public static final DefaultedRegistry field_218370_L = forgeDefaulted(field_239683_U_, VillagerProfession.class, () -> { return VillagerProfession.field_221151_a; }); -- public static final DefaultedRegistry field_218371_M = func_222933_a("point_of_interest_type", "unemployed", () -> { -+ @Deprecated public static final DefaultedRegistry field_218371_M = forgeDefaulted("point_of_interest_type", PointOfInterestType.class, () -> { +- public static final DefaultedRegistry field_218371_M = func_239745_a_(field_239684_V_, "unemployed", () -> { ++ @Deprecated public static final DefaultedRegistry field_218371_M = forgeDefaulted(field_239684_V_, PointOfInterestType.class, () -> { return PointOfInterestType.field_221054_b; }); -- public static final DefaultedRegistry> field_218372_N = func_222933_a("memory_module_type", "dummy", () -> { -+ @Deprecated public static final DefaultedRegistry> field_218372_N = forgeDefaulted("memory_module_type", MemoryModuleType.class, () -> { +- public static final DefaultedRegistry> field_218372_N = func_239745_a_(field_239685_W_, "dummy", () -> { ++ @Deprecated public static final DefaultedRegistry> field_218372_N = forgeDefaulted(field_239685_W_, MemoryModuleType.class, () -> { return MemoryModuleType.field_220940_a; }); -- public static final DefaultedRegistry> field_218373_O = func_222933_a("sensor_type", "dummy", () -> { -+ @Deprecated public static final DefaultedRegistry> field_218373_O = forgeDefaulted("sensor_type", SensorType.class, () -> { +- public static final DefaultedRegistry> field_218373_O = func_239745_a_(field_239686_X_, "dummy", () -> { ++ @Deprecated public static final DefaultedRegistry> field_218373_O = forgeDefaulted(field_239686_X_, SensorType.class, () -> { return SensorType.field_220997_a; }); -- public static final Registry field_218374_P = func_222935_a("schedule", () -> { -+ @Deprecated public static final Registry field_218374_P = forge("schedule", Schedule.class, () -> { +- public static final Registry field_218374_P = func_239746_a_(field_239687_Y_, () -> { ++ @Deprecated public static final Registry field_218374_P = forge(field_239687_Y_, Schedule.class, () -> { return Schedule.field_221383_a; }); -- public static final Registry field_218375_Q = func_222935_a("activity", () -> { -+ @Deprecated public static final Registry field_218375_Q = forge("activity", Activity.class, () -> { +- public static final Registry field_218375_Q = func_239746_a_(field_239688_Z_, () -> { ++ @Deprecated public static final Registry field_218375_Q = forge(field_239688_Z_, Activity.class, () -> { return Activity.field_221366_b; }); - -@@ -246,6 +248,14 @@ - return ((MutableRegistry)p_218343_0_).func_218382_a(p_218343_1_, new ResourceLocation(p_218343_2_), p_218343_3_); + public static final Registry field_239693_aY_ = func_239746_a_(field_239695_aa_, () -> { +@@ -407,6 +411,14 @@ + return ((MutableRegistry)p_218343_0_).func_218382_a(p_218343_1_, RegistryKey.func_240903_a_(p_218343_0_.field_239703_b_, 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 > Registry forge(RegistryKey> key, Class cls, Supplier def) { ++ return func_239743_a_(key, 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); ++ private static > DefaultedRegistry forgeDefaulted(RegistryKey> key, Class cls, Supplier def) { ++ return Registry.func_239743_a_(key, net.minecraftforge.registries.GameData.getWrapperDefaulted(cls), def); + } + static { - field_218376_a.entrySet().forEach((p_229397_0_) -> { - if (p_229397_0_.getValue().get() == null) { + field_218376_a.forEach((p_239747_0_, p_239747_1_) -> { + if (p_239747_1_.get() == null) { diff --git a/patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch b/patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch index 5f9fad508..f1815acd2 100644 --- a/patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch +++ b/patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/util/text/LanguageMap.java +++ b/net/minecraft/util/text/LanguageMap.java @@ -36,6 +36,7 @@ - this.field_74816_c.put(entry.getKey(), s); - } - -+ net.minecraftforge.fml.server.LanguageHook.captureLanguageMap(this.field_74816_c); - this.field_150511_e = Util.func_211177_b(); - } catch (JsonParseException | IOException ioexception) { field_201045_a.error("Couldn't read strings from /assets/minecraft/lang/en_us.json", (Throwable)ioexception); + } + ++ //net.minecraftforge.fml.server.LanguageHook.captureLanguageMap(this.languageList); //TODO + final Map map = builder.build(); + return new LanguageMap() { + public String func_230503_a_(String p_230503_1_) { diff --git a/patches/minecraft/net/minecraft/util/text/Style.java.patch b/patches/minecraft/net/minecraft/util/text/Style.java.patch new file mode 100644 index 000000000..706c7617b --- /dev/null +++ b/patches/minecraft/net/minecraft/util/text/Style.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/util/text/Style.java ++++ b/net/minecraft/util/text/Style.java +@@ -120,6 +120,18 @@ + return new Style(this.field_150247_b, this.field_150248_c, p_240722_1_, this.field_150246_e, this.field_150243_f, this.field_150244_g, this.field_150251_h, this.field_150252_i, this.field_179990_j, this.field_240710_l_); + } + ++ public Style setUnderlined(@Nullable Boolean underlined) { ++ return new Style(this.field_150247_b, this.field_150248_c, this.field_150245_d, underlined, this.field_150243_f, this.field_150244_g, this.field_150251_h, this.field_150252_i, this.field_179990_j, this.field_240710_l_); ++ } ++ ++ public Style setStrikethrough(@Nullable Boolean strikethrough) { ++ return new Style(this.field_150247_b, this.field_150248_c, this.field_150245_d, this.field_150246_e, strikethrough, this.field_150244_g, this.field_150251_h, this.field_150252_i, this.field_179990_j, this.field_240710_l_); ++ } ++ ++ public Style setObfuscated(@Nullable Boolean obfuscated) { ++ return new Style(this.field_150247_b, this.field_150248_c, this.field_150245_d, this.field_150246_e, this.field_150243_f, obfuscated, this.field_150251_h, this.field_150252_i, this.field_179990_j, this.field_240710_l_); ++ } ++ + public Style func_240715_a_(@Nullable ClickEvent p_240715_1_) { + return new Style(this.field_150247_b, this.field_150248_c, this.field_150245_d, this.field_150246_e, this.field_150243_f, this.field_150244_g, p_240715_1_, this.field_150252_i, this.field_179990_j, this.field_240710_l_); + } diff --git a/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch b/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch index 38a1be77c..02c1ae0d9 100644 --- a/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch +++ b/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/util/text/TranslationTextComponent.java +++ b/net/minecraft/util/text/TranslationTextComponent.java -@@ -100,6 +100,10 @@ +@@ -88,6 +88,10 @@ } } + if (j == 0) { + // if we failed to match above, lets try the messageformat handler instead. -+ j = net.minecraftforge.fml.TextComponentMessageFormatHandler.handle(this, this.field_150278_b, this.field_150277_e, p_150269_1_); ++ j = net.minecraftforge.fml.TextComponentMessageFormatHandler.handle(this, this.field_150278_b, this.field_150277_e, p_240758_1_); + } - if (j < p_150269_1_.length()) { - ITextComponent itextcomponent1 = new StringTextComponent(String.format(p_150269_1_.substring(j))); - itextcomponent1.func_150256_b().func_150221_a(this.func_150256_b()); + if (j < p_240758_1_.length()) { + String s3 = p_240758_1_.substring(j); + if (s3.indexOf(37) != -1) { diff --git a/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch b/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch index 5a5b12d7b..183e811d0 100644 --- a/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch +++ b/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/village/PointOfInterestType.java +++ b/net/minecraft/village/PointOfInterestType.java -@@ -19,7 +19,7 @@ +@@ -21,7 +21,7 @@ import net.minecraft.util.Util; import net.minecraft.util.registry.Registry; -public class PointOfInterestType { +public class PointOfInterestType extends net.minecraftforge.registries.ForgeRegistryEntry { - private static final Predicate field_221071_s = (p_221041_0_) -> { - return Registry.field_218370_L.func_201756_e().map(VillagerProfession::func_221149_b).collect(Collectors.toSet()).contains(p_221041_0_); - }; + private static final Supplier> field_234168_y_ = Suppliers.memoize(() -> { + return Registry.field_218370_L.func_201756_e().map(VillagerProfession::func_221149_b).collect(Collectors.toSet()); + }); diff --git a/patches/minecraft/net/minecraft/village/VillageSiege.java.patch b/patches/minecraft/net/minecraft/village/VillageSiege.java.patch index caa0c6a1d..c360419a0 100644 --- a/patches/minecraft/net/minecraft/village/VillageSiege.java.patch +++ b/patches/minecraft/net/minecraft/village/VillageSiege.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/village/VillageSiege.java +++ b/net/minecraft/village/VillageSiege.java -@@ -74,7 +74,9 @@ +@@ -75,7 +75,9 @@ this.field_75532_g = blockpos.func_177958_n() + MathHelper.func_76141_d(MathHelper.func_76134_b(f) * 32.0F); this.field_75538_h = blockpos.func_177956_o(); this.field_75539_i = blockpos.func_177952_p() + MathHelper.func_76141_d(MathHelper.func_76126_a(f) * 32.0F); - if (this.func_225476_a(p_75529_1_, new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)) != null) { -+ Vec3d siegeLocation = this.func_225476_a(p_75529_1_, new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)); ++ Vector3d siegeLocation = this.func_225476_a(p_75529_1_, new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)); + if (siegeLocation != null) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.village.VillageSiegeEvent(this, p_75529_1_, playerentity, siegeLocation))) return false; this.field_75534_e = 0; this.field_75533_d = 20; break; -@@ -94,7 +96,7 @@ - if (vec3d != null) { +@@ -95,7 +97,7 @@ + if (vector3d != null) { ZombieEntity zombieentity; try { - zombieentity = new ZombieEntity(p_75530_1_); + zombieentity = EntityType.field_200725_aD.func_200721_a(p_75530_1_); //Forge: Direct Initialization is deprecated, use EntityType. - zombieentity.func_213386_a(p_75530_1_, p_75530_1_.func_175649_E(new BlockPos(zombieentity)), SpawnReason.EVENT, (ILivingEntityData)null, (CompoundNBT)null); + zombieentity.func_213386_a(p_75530_1_, p_75530_1_.func_175649_E(zombieentity.func_233580_cy_()), SpawnReason.EVENT, (ILivingEntityData)null, (CompoundNBT)null); } catch (Exception exception) { exception.printStackTrace(); diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index 8c6e8b342..d01819f4a 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,56 +1,30 @@ --- a/net/minecraft/world/Explosion.java +++ b/net/minecraft/world/Explosion.java @@ -54,6 +54,7 @@ - private DamageSource field_199593_j; + private final Entity field_77283_e; + private final float field_77280_f; + private final DamageSource field_199593_j; ++ private final Vector3d position; + private final IExplosionContext field_234893_k_; private final List field_77281_g = Lists.newArrayList(); - 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_) { -@@ -76,6 +77,7 @@ - this.field_77286_a = p_i50007_10_; - this.field_222260_b = p_i50007_11_; - this.field_199593_j = DamageSource.func_94539_a(this); -+ this.position = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); - } - - public static float func_222259_a(Vec3d p_222259_0_, Entity p_222259_1_) { -@@ -135,8 +137,8 @@ - BlockPos blockpos = new BlockPos(d4, d6, d8); - BlockState blockstate = this.field_77287_j.func_180495_p(blockpos); - IFluidState ifluidstate = this.field_77287_j.func_204610_c(blockpos); -- if (!blockstate.func_196958_f() || !ifluidstate.func_206888_e()) { -- float f2 = Math.max(blockstate.func_177230_c().func_149638_a(), ifluidstate.func_210200_l()); -+ if (!blockstate.isAir(this.field_77287_j, blockpos) || !ifluidstate.func_206888_e()) { -+ float f2 = Math.max(blockstate.getExplosionResistance(this.field_77287_j, blockpos, field_77283_e, this), ifluidstate.getExplosionResistance(this.field_77287_j, blockpos, field_77283_e, this)); - if (this.field_77283_e != null) { - f2 = this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, blockstate, ifluidstate, f2); - } -@@ -166,6 +168,7 @@ - int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f3 - 1.0D); - int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f3 + 1.0D); + private final Map field_77288_k = Maps.newHashMap(); +@@ -81,6 +82,7 @@ + this.field_77284_b = p_i231610_5_; + this.field_77285_c = p_i231610_7_; + this.field_77282_d = p_i231610_9_; ++ this.position = new Vector3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); + this.field_77286_a = p_i231610_12_; + this.field_222260_b = p_i231610_13_; + this.field_199593_j = p_i231610_3_ == null ? DamageSource.func_94539_a(this) : p_i231610_3_; +@@ -175,6 +177,7 @@ + int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f2 - 1.0D); + int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f2 + 1.0D); 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)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.field_77287_j, this, list, f3); - Vec3d vec3d = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.field_77287_j, this, list, f2); + Vector3d vector3d = new Vector3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); for(int k2 = 0; k2 < list.size(); ++k2) { -@@ -224,11 +227,11 @@ - for(BlockPos blockpos : this.field_77281_g) { - BlockState blockstate = this.field_77287_j.func_180495_p(blockpos); - Block block = blockstate.func_177230_c(); -- if (!blockstate.func_196958_f()) { -+ if (!blockstate.isAir(this.field_77287_j, blockpos)) { - BlockPos blockpos1 = blockpos.func_185334_h(); - this.field_77287_j.func_217381_Z().func_76320_a("explosion_blocks"); -- if (block.func_149659_a(this) && this.field_77287_j instanceof ServerWorld) { -- TileEntity tileentity = block.func_149716_u() ? this.field_77287_j.func_175625_s(blockpos) : null; -+ if (blockstate.canDropFromExplosion(this.field_77287_j, blockpos, this) && this.field_77287_j instanceof ServerWorld) { -+ TileEntity tileentity = blockstate.hasTileEntity() ? this.field_77287_j.func_175625_s(blockpos) : null; - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_77287_j)).func_216023_a(this.field_77287_j.field_73012_v).func_216015_a(LootParameters.field_216286_f, blockpos).func_216015_a(LootParameters.field_216289_i, ItemStack.field_190927_a).func_216021_b(LootParameters.field_216288_h, tileentity).func_216021_b(LootParameters.field_216281_a, this.field_77283_e); - if (this.field_222260_b == Explosion.Mode.DESTROY) { - lootcontext$builder.func_216015_a(LootParameters.field_216290_j, this.field_77280_f); -@@ -239,8 +242,7 @@ +@@ -248,8 +251,7 @@ }); } @@ -60,11 +34,11 @@ this.field_77287_j.func_217381_Z().func_76319_b(); } } -@@ -311,6 +313,10 @@ +@@ -323,6 +325,10 @@ return this.field_77281_g; } -+ public Vec3d getPosition() { ++ public Vector3d getPosition() { + return this.position; + } + diff --git a/patches/minecraft/net/minecraft/world/IBlockReader.java.patch b/patches/minecraft/net/minecraft/world/IBlockReader.java.patch index 3d612f585..eac97204e 100644 --- a/patches/minecraft/net/minecraft/world/IBlockReader.java.patch +++ b/patches/minecraft/net/minecraft/world/IBlockReader.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/IBlockReader.java +++ b/net/minecraft/world/IBlockReader.java -@@ -23,7 +23,7 @@ - IFluidState func_204610_c(BlockPos p_204610_1_); +@@ -25,7 +25,7 @@ + FluidState func_204610_c(BlockPos p_204610_1_); default int func_217298_h(BlockPos p_217298_1_) { - return this.func_180495_p(p_217298_1_).func_185906_d(); diff --git a/patches/minecraft/net/minecraft/world/IWorldReader.java.patch b/patches/minecraft/net/minecraft/world/IWorldReader.java.patch index 97515e7f6..7312bc62a 100644 --- a/patches/minecraft/net/minecraft/world/IWorldReader.java.patch +++ b/patches/minecraft/net/minecraft/world/IWorldReader.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/IWorldReader.java +++ b/net/minecraft/world/IWorldReader.java -@@ -57,7 +57,7 @@ +@@ -68,7 +68,7 @@ } default boolean func_175623_d(BlockPos p_175623_1_) { @@ -9,7 +9,7 @@ } default boolean func_175710_j(BlockPos p_175710_1_) { -@@ -148,6 +148,10 @@ +@@ -157,6 +157,10 @@ return this.func_217354_b(p_175667_1_.func_177958_n() >> 4, p_175667_1_.func_177952_p() >> 4); } diff --git a/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch b/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch index 19359bd83..96fb48c48 100644 --- a/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/TrackedEntity.java +++ b/net/minecraft/world/TrackedEntity.java -@@ -80,9 +80,8 @@ +@@ -81,9 +81,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(); @@ -12,7 +12,7 @@ for(ServerPlayerEntity serverplayerentity : this.field_219460_b.func_217369_A()) { mapdata.func_76191_a(serverplayerentity, itemstack); IPacket ipacket = ((FilledMapItem)itemstack.func_77973_b()).func_150911_c(itemstack, this.field_219460_b, serverplayerentity); -@@ -186,12 +185,14 @@ +@@ -187,12 +186,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); diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 9f20a1d3d..aa89e22ae 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -1,114 +1,111 @@ --- a/net/minecraft/world/World.java +++ b/net/minecraft/world/World.java -@@ -62,13 +62,13 @@ +@@ -65,7 +65,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public abstract class World implements IWorld, AutoCloseable { +public abstract class World extends net.minecraftforge.common.capabilities.CapabilityProvider implements IWorld, AutoCloseable, net.minecraftforge.common.extensions.IForgeWorld { protected static final Logger field_195596_d = LogManager.getLogger(); - private static final Direction[] field_200007_a = Direction.values(); + public static final Codec> field_234917_f_ = ResourceLocation.field_240908_a_.xmap(RegistryKey.func_240902_a_(Registry.field_239699_ae_), RegistryKey::func_240901_a_); + public static final RegistryKey field_234918_g_ = RegistryKey.func_240903_a_(Registry.field_239699_ae_, new ResourceLocation("overworld")); +@@ -75,7 +75,7 @@ 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 Thread field_217407_c; + private final boolean field_234916_c_; private int field_73008_k; - protected int field_73005_l = (new Random()).nextInt(); -@@ -86,8 +86,12 @@ - protected boolean field_147481_N; - private final WorldBorder field_175728_M; +@@ -95,8 +95,12 @@ private final BiomeManager field_226689_w_; + private final RegistryKey field_73011_w; + private final RegistryKey field_234915_C_; + public boolean restoringBlockSnapshots = false; + public boolean captureBlockSnapshots = false; + public java.util.ArrayList capturedBlockSnapshots = new java.util.ArrayList(); - protected World(WorldInfo p_i50005_1_, DimensionType p_i50005_2_, BiFunction p_i50005_3_, IProfiler p_i50005_4_, boolean p_i50005_5_) { + protected World(ISpawnWorldInfo p_i231617_1_, RegistryKey p_i231617_2_, RegistryKey p_i231617_3_, DimensionType p_i231617_4_, Supplier p_i231617_5_, boolean p_i231617_6_, boolean p_i231617_7_, long p_i231617_8_) { + super(World.class); - this.field_72984_F = p_i50005_4_; - this.field_72986_A = p_i50005_1_; - this.field_73011_w = p_i50005_2_.func_218270_a(this); -@@ -158,23 +162,51 @@ + this.field_72984_F = p_i231617_5_; + this.field_72986_A = p_i231617_1_; + this.field_234921_x_ = p_i231617_4_; +@@ -222,17 +226,45 @@ } else { - Chunk chunk = this.func_175726_f(p_180501_1_); - Block block = p_180501_2_.func_177230_c(); + Chunk chunk = this.func_175726_f(p_241211_1_); + Block block = p_241211_2_.func_177230_c(); + -+ p_180501_1_ = p_180501_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks ++ p_241211_1_ = p_241211_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks + net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; + if (this.captureBlockSnapshots && !this.field_72995_K) { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_180501_1_, p_180501_3_); -+ this.capturedBlockSnapshots.add(blockSnapshot); ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_241211_1_, p_241211_3_); ++ this.capturedBlockSnapshots.add(blockSnapshot); + } + -+ BlockState old = func_180495_p(p_180501_1_); -+ int oldLight = old.getLightValue(this, p_180501_1_); -+ int oldOpacity = old.func_200016_a(this, p_180501_1_); ++ BlockState old = func_180495_p(p_241211_1_); ++ int oldLight = old.getLightValue(this, p_241211_1_); ++ int oldOpacity = old.func_200016_a(this, p_241211_1_); + - BlockState blockstate = chunk.func_177436_a(p_180501_1_, p_180501_2_, (p_180501_3_ & 64) != 0); + BlockState blockstate = chunk.func_177436_a(p_241211_1_, p_241211_2_, (p_241211_3_ & 64) != 0); if (blockstate == null) { + if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); return false; } else { - BlockState blockstate1 = this.func_180495_p(p_180501_1_); -- if (blockstate1 != blockstate && (blockstate1.func_200016_a(this, p_180501_1_) != blockstate.func_200016_a(this, p_180501_1_) || blockstate1.func_185906_d() != blockstate.func_185906_d() || blockstate1.func_215691_g() || blockstate.func_215691_g())) { -+ if (blockstate1 != blockstate && (blockstate1.func_200016_a(this, p_180501_1_) != oldOpacity || blockstate1.getLightValue(this, p_180501_1_) != oldLight || blockstate1.func_215691_g() || blockstate.func_215691_g())) { - this.field_72984_F.func_76320_a("queueCheckLight"); - this.func_72863_F().func_212863_j_().func_215568_a(p_180501_1_); - this.field_72984_F.func_76319_b(); + BlockState blockstate1 = this.func_180495_p(p_241211_1_); +- if (blockstate1 != blockstate && (blockstate1.func_200016_a(this, p_241211_1_) != blockstate.func_200016_a(this, p_241211_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_241211_1_) != oldOpacity || blockstate1.getLightValue(this, p_241211_1_) != oldLight || blockstate1.func_215691_g() || blockstate.func_215691_g())) { + this.func_217381_Z().func_76320_a("queueCheckLight"); + this.func_72863_F().func_212863_j_().func_215568_a(p_241211_1_); + this.func_217381_Z().func_76319_b(); } -+ if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates -+ this.markAndNotifyBlock(p_180501_1_, chunk, blockstate, p_180501_2_, p_180501_3_); -+ } -+ return true; -+ } -+ } -+ } ++ if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates ++ this.markAndNotifyBlock(p_241211_1_, chunk, blockstate, p_241211_2_, p_241211_3_, p_241211_4_); ++ } ++ return true; ++ } ++ } ++ } + -+ // 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_) ++ // Split off from original setBlockState(BlockPos, BlockState, int, int) method in order to directly send client and physic updates ++ public void markAndNotifyBlock(BlockPos p_241211_1_, @Nullable Chunk chunk, BlockState blockstate, BlockState p_241211_2_, int p_241211_3_, int p_241211_4_) + { -+ Block block = p_180501_2_.func_177230_c(); -+ BlockState blockstate1 = func_180495_p(p_180501_1_); -+ { -+ { - if (blockstate1 == p_180501_2_) { ++ Block block = p_241211_2_.func_177230_c(); ++ BlockState blockstate1 = func_180495_p(p_241211_1_); ++ { ++ { + if (blockstate1 == p_241211_2_) { if (blockstate != blockstate1) { - this.func_225319_b(p_180501_1_, blockstate, blockstate1); - } + this.func_225319_b(p_241211_1_, blockstate, blockstate1); +@@ -258,8 +290,6 @@ -- if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && (this.field_72995_K || chunk.func_217321_u() != null && chunk.func_217321_u().func_219065_a(ChunkHolder.LocationType.TICKING))) { -+ if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && (this.field_72995_K || chunk == null || chunk.func_217321_u() != null && chunk.func_217321_u().func_219065_a(ChunkHolder.LocationType.TICKING))) { - this.func_184138_a(p_180501_1_, blockstate, p_180501_2_, p_180501_3_); - } - -@@ -194,8 +226,6 @@ - - this.func_217393_a(p_180501_1_, blockstate, blockstate1); + this.func_217393_a(p_241211_1_, blockstate, blockstate1); } - - return true; } } } -@@ -210,13 +240,13 @@ +@@ -274,7 +304,7 @@ - public boolean func_225521_a_(BlockPos p_225521_1_, boolean p_225521_2_, @Nullable Entity p_225521_3_) { - BlockState blockstate = this.func_180495_p(p_225521_1_); + public boolean func_241212_a_(BlockPos p_241212_1_, boolean p_241212_2_, @Nullable Entity p_241212_3_, int p_241212_4_) { + BlockState blockstate = this.func_180495_p(p_241212_1_); - if (blockstate.func_196958_f()) { -+ if (blockstate.isAir(this, p_225521_1_)) { ++ if (blockstate.isAir(this, p_241212_1_)) { return false; } else { - IFluidState ifluidstate = this.func_204610_c(p_225521_1_); - this.func_217379_c(2001, p_225521_1_, Block.func_196246_j(blockstate)); - if (p_225521_2_) { -- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? this.func_175625_s(p_225521_1_) : null; -+ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_225521_1_) : null; - Block.func_220054_a(blockstate, this, p_225521_1_, tileentity, p_225521_3_, ItemStack.field_190927_a); + FluidState fluidstate = this.func_204610_c(p_241212_1_); +@@ -283,7 +313,7 @@ } -@@ -241,6 +271,8 @@ + if (p_241212_2_) { +- TileEntity tileentity = blockstate.func_177230_c().func_235695_q_() ? this.func_175625_s(p_241212_1_) : null; ++ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_241212_1_) : null; + Block.func_220054_a(blockstate, this, p_241212_1_, tileentity, p_241212_3_, ItemStack.field_190927_a); + } + +@@ -301,6 +331,8 @@ } public void func_195593_d(BlockPos p_195593_1_, Block p_195593_2_) { @@ -117,7 +114,7 @@ this.func_190524_a(p_195593_1_.func_177976_e(), p_195593_2_, p_195593_1_); this.func_190524_a(p_195593_1_.func_177974_f(), p_195593_2_, p_195593_1_); this.func_190524_a(p_195593_1_.func_177977_b(), p_195593_2_, p_195593_1_); -@@ -250,6 +282,11 @@ +@@ -310,6 +342,11 @@ } public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, Direction p_175695_3_) { @@ -129,28 +126,19 @@ if (p_175695_3_ != Direction.WEST) { this.func_190524_a(p_175695_1_.func_177976_e(), p_175695_2_, p_175695_1_); } -@@ -287,9 +324,9 @@ +@@ -347,9 +384,9 @@ CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block being updated"); crashreportcategory.func_189529_a("Source block type", () -> { try { - return String.format("ID #%s (%s // %s)", Registry.field_212618_g.func_177774_c(p_190524_2_), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName()); + return String.format("ID #%s (%s // %s)", p_190524_2_.getRegistryName(), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName()); - } catch (Throwable var2) { + } catch (Throwable throwable1) { - return "ID #" + Registry.field_212618_g.func_177774_c(p_190524_2_); + return "ID #" + p_190524_2_.getRegistryName(); } }); CrashReportCategory.func_175750_a(crashreportcategory, p_190524_1_, blockstate); -@@ -336,7 +373,7 @@ - } - - public boolean func_72935_r() { -- return this.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ && this.field_73008_k < 4; -+ return this.field_73011_w.isDaytime(); - } - - public boolean func_226690_K_() { -@@ -373,10 +410,12 @@ +@@ -433,10 +470,12 @@ } public boolean func_175700_a(TileEntity p_175700_1_) { @@ -163,7 +151,7 @@ } boolean flag = this.field_147482_g.add(p_175700_1_); -@@ -384,6 +423,8 @@ +@@ -444,6 +483,8 @@ this.field_175730_i.add(p_175700_1_); } @@ -172,7 +160,7 @@ if (this.field_72995_K) { BlockPos blockpos = p_175700_1_.func_174877_v(); BlockState blockstate = this.func_180495_p(blockpos); -@@ -395,6 +436,7 @@ +@@ -455,6 +496,7 @@ public void func_147448_a(Collection p_147448_1_) { if (this.field_147481_N) { @@ -180,7 +168,7 @@ this.field_147484_a.addAll(p_147448_1_); } else { for(TileEntity tileentity : p_147448_1_) { -@@ -407,13 +449,14 @@ +@@ -467,13 +509,14 @@ public void func_217391_K() { IProfiler iprofiler = this.func_217381_Z(); iprofiler.func_76320_a("blockEntities"); @@ -196,9 +184,9 @@ Iterator iterator = this.field_175730_i.iterator(); while(iterator.hasNext()) { -@@ -422,8 +465,9 @@ +@@ -482,8 +525,9 @@ BlockPos blockpos = tileentity.func_174877_v(); - if (this.field_73020_y.func_222866_a(blockpos) && this.func_175723_af().func_177746_a(blockpos)) { + if (this.func_72863_F().func_222866_a(blockpos) && this.func_175723_af().func_177746_a(blockpos)) { try { + net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackStart(tileentity); iprofiler.func_194340_a(() -> { @@ -207,7 +195,7 @@ }); if (tileentity.func_200662_C().func_223045_a(this.func_180495_p(blockpos).func_177230_c())) { ((ITickableTileEntity)tileentity).func_73660_a(); -@@ -436,8 +480,16 @@ +@@ -496,8 +540,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); @@ -224,7 +212,7 @@ } } -@@ -445,7 +497,10 @@ +@@ -505,7 +557,10 @@ iterator.remove(); this.field_147482_g.remove(tileentity); if (this.func_175667_e(tileentity.func_174877_v())) { @@ -236,7 +224,7 @@ } } } -@@ -477,12 +532,15 @@ +@@ -537,12 +592,15 @@ public void func_217390_a(Consumer p_217390_1_, Entity p_217390_2_) { try { @@ -252,35 +240,15 @@ } } -@@ -499,7 +557,7 @@ - for(int l1 = k; l1 < l; ++l1) { - for(int i2 = i1; i2 < j1; ++i2) { - BlockState blockstate = this.func_180495_p(blockpos$pooledmutable.func_181079_c(k1, l1, i2)); -- if (!blockstate.func_196958_f()) { -+ if (!blockstate.isAir(this, blockpos$pooledmutable)) { - boolean flag = true; - return flag; - } -@@ -523,8 +581,8 @@ - for(int k1 = i; k1 < j; ++k1) { - for(int l1 = k; l1 < l; ++l1) { - for(int i2 = i1; i2 < j1; ++i2) { -- Block block = this.func_180495_p(blockpos$pooledmutable.func_181079_c(k1, l1, i2)).func_177230_c(); -- if (block == Blocks.field_150480_ab || block == Blocks.field_150353_l) { -+ BlockState state = this.func_180495_p(blockpos$pooledmutable.func_181079_c(k1, l1, i2)); -+ if (state.isBurning(this, blockpos$pooledmutable)) { - boolean flag = true; - return flag; - } -@@ -594,6 +652,7 @@ - if (p_217401_2_ != null) { - explosion.func_199592_a(p_217401_2_); - } -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; +@@ -556,6 +614,7 @@ + public Explosion func_230546_a_(@Nullable Entity p_230546_1_, @Nullable DamageSource p_230546_2_, @Nullable IExplosionContext p_230546_3_, double p_230546_4_, double p_230546_6_, double p_230546_8_, float p_230546_10_, boolean p_230546_11_, Explosion.Mode p_230546_12_) { + Explosion explosion = new Explosion(this, p_230546_1_, p_230546_2_, p_230546_3_, p_230546_4_, p_230546_6_, p_230546_8_, p_230546_10_, p_230546_11_, p_230546_12_); ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; explosion.func_77278_a(); explosion.func_77279_a(true); -@@ -654,6 +713,7 @@ + return explosion; +@@ -604,6 +663,7 @@ public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) { if (!func_189509_E(p_175690_1_)) { @@ -288,17 +256,19 @@ if (p_175690_2_ != null && !p_175690_2_.func_145837_r()) { if (this.field_147481_N) { p_175690_2_.func_226984_a_(this, p_175690_1_); -@@ -669,7 +729,8 @@ +@@ -619,8 +679,9 @@ this.field_147484_a.add(p_175690_2_); } else { - this.func_175726_f(p_175690_1_).func_177426_a(p_175690_1_, p_175690_2_); -+ Chunk chunk = this.func_175726_f(p_175690_1_); -+ if (chunk != null) chunk.func_177426_a(p_175690_1_, p_175690_2_); - this.func_175700_a(p_175690_2_); +- this.func_175700_a(p_175690_2_); ++ Chunk chunk = this.func_175726_f(p_175690_1_); ++ if (chunk != null) chunk.func_177426_a(p_175690_1_, p_175690_2_); ++ this.func_175700_a(p_175690_2_); } } -@@ -682,6 +743,8 @@ + +@@ -632,6 +693,8 @@ if (tileentity != null && this.field_147481_N) { tileentity.func_145843_s(); this.field_147484_a.remove(tileentity); @@ -307,7 +277,7 @@ } else { if (tileentity != null) { this.field_147484_a.remove(tileentity); -@@ -691,7 +754,7 @@ +@@ -641,7 +704,7 @@ this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); } @@ -316,22 +286,7 @@ } public boolean func_195588_v(BlockPos p_195588_1_) { -@@ -716,9 +779,14 @@ - - public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) { - this.func_72863_F().func_217203_a(p_72891_1_, p_72891_2_); -+ this.func_201675_m().setAllowedSpawnTypes(p_72891_1_, p_72891_2_); - } - - protected void func_72947_a() { -+ this.field_73011_w.calculateInitialWeather(); -+ } -+ -+ public void calculateInitialWeatherBody() { - if (this.field_72986_A.func_76059_o()) { - this.field_73004_o = 1.0F; - if (this.field_72986_A.func_76061_m()) { -@@ -740,10 +808,10 @@ +@@ -694,10 +757,10 @@ public List func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate p_175674_3_) { this.func_217381_Z().func_230035_c_("getEntities"); List list = Lists.newArrayList(); @@ -343,10 +298,10 @@ + int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + getMaxEntityRadius()) / 16.0D); + int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - getMaxEntityRadius()) / 16.0D); + int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + getMaxEntityRadius()) / 16.0D); + AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); for(int i1 = i; i1 <= j; ++i1) { - for(int j1 = k; j1 <= l; ++j1) { -@@ -759,10 +827,10 @@ +@@ -714,10 +777,10 @@ public List func_217394_a(@Nullable EntityType p_217394_1_, AxisAlignedBB p_217394_2_, Predicate p_217394_3_) { this.func_217381_Z().func_230035_c_("getEntities"); @@ -361,7 +316,7 @@ List list = Lists.newArrayList(); for(int i1 = i; i1 < j; ++i1) { -@@ -779,10 +847,10 @@ +@@ -734,10 +797,10 @@ public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate p_175647_3_) { this.func_217381_Z().func_230035_c_("getEntities"); @@ -376,7 +331,7 @@ List list = Lists.newArrayList(); AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); -@@ -800,10 +868,10 @@ +@@ -755,10 +818,10 @@ public List func_225316_b(Class p_225316_1_, AxisAlignedBB p_225316_2_, @Nullable Predicate p_225316_3_) { this.func_217381_Z().func_230035_c_("getLoadedEntities"); @@ -391,118 +346,48 @@ List list = Lists.newArrayList(); AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); -@@ -830,7 +898,8 @@ +@@ -781,7 +844,7 @@ + if (this.func_175667_e(p_175646_1_)) { + this.func_175726_f(p_175646_1_).func_76630_e(); + } +- ++ this.func_175666_e(p_175646_1_, func_180495_p(p_175646_1_).func_177230_c()); //Notify neighbors of changes } public int func_181545_F() { -- return 63; -+ // FORGE: Allow modded dimensions to customize this value via Dimension -+ return this.func_201675_m().getSeaLevel(); - } - - public World func_201672_e() { -@@ -878,7 +947,7 @@ - +@@ -830,7 +893,7 @@ public int func_175651_c(BlockPos p_175651_1_, Direction p_175651_2_) { BlockState blockstate = this.func_180495_p(p_175651_1_); -- return blockstate.func_215686_e(this, p_175651_1_) ? this.func_175676_y(p_175651_1_) : blockstate.func_185911_a(this, p_175651_1_, p_175651_2_); -+ return blockstate.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : blockstate.func_185911_a(this, p_175651_1_, p_175651_2_); + int i = blockstate.func_185911_a(this, p_175651_1_, p_175651_2_); +- return blockstate.func_215686_e(this, p_175651_1_) ? Math.max(i, this.func_175676_y(p_175651_1_)) : i; ++ return blockstate.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? Math.max(i, this.func_175676_y(p_175651_1_)) : i; } public boolean func_175640_z(BlockPos p_175640_1_) { -@@ -923,7 +992,7 @@ - } - - public long func_72905_C() { -- return this.field_72986_A.func_76063_b(); -+ return this.field_73011_w.getSeed(); - } - - public long func_82737_E() { -@@ -931,11 +1000,11 @@ - } - - public long func_72820_D() { -- return this.field_72986_A.func_76073_f(); -+ return this.field_73011_w.getWorldTime(); - } - - public void func_72877_b(long p_72877_1_) { -- this.field_72986_A.func_76068_b(p_72877_1_); -+ this.field_73011_w.setWorldTime(p_72877_1_); - } - - protected void func_217389_a() { -@@ -947,7 +1016,7 @@ - } - - public BlockPos func_175694_M() { -- BlockPos blockpos = new BlockPos(this.field_72986_A.func_76079_c(), this.field_72986_A.func_76075_d(), this.field_72986_A.func_76074_e()); -+ BlockPos blockpos = this.field_73011_w.getSpawnPoint(); - if (!this.func_175723_af().func_177746_a(blockpos)) { - blockpos = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(this.func_175723_af().func_177731_f(), 0.0D, this.func_175723_af().func_177721_g())); - } -@@ -956,10 +1025,14 @@ - } - - public void func_175652_B(BlockPos p_175652_1_) { -- this.field_72986_A.func_176143_a(p_175652_1_); -+ this.field_73011_w.setSpawnPoint(p_175652_1_); - } - - public boolean func_175660_a(PlayerEntity p_175660_1_, BlockPos p_175660_2_) { -+ return field_73011_w.canMineBlock(p_175660_1_, p_175660_2_); -+ } -+ -+ public boolean canMineBlockBody(PlayerEntity player, BlockPos pos) { - return true; - } - -@@ -1027,8 +1100,7 @@ - } - - public boolean func_180502_D(BlockPos p_180502_1_) { -- Biome biome = this.func_226691_t_(p_180502_1_); -- return biome.func_76736_e(); -+ return this.field_73011_w.isHighHumidity(p_180502_1_); - } - - @Nullable -@@ -1042,7 +1114,7 @@ - } - - public int func_72940_L() { -- return this.field_73011_w.func_177495_o() ? 128 : 256; -+ return this.field_73011_w.getActualHeight(); - } - - public CrashReportCategory func_72914_a(CrashReport p_72914_1_) { -@@ -1073,16 +1145,15 @@ +@@ -985,16 +1048,14 @@ public abstract Scoreboard func_96441_U(); public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { - for(Direction direction : Direction.Plane.HORIZONTAL) { -+ for(Direction direction : Direction.values()) { //Forge: TODO: change to VALUES once ATed ++ for(Direction direction : Direction.values()) { BlockPos blockpos = p_175666_1_.func_177972_a(direction); if (this.func_175667_e(blockpos)) { BlockState blockstate = this.func_180495_p(blockpos); -- if (blockstate.func_177230_c() == Blocks.field_196762_fd) { +- if (blockstate.func_203425_a(Blocks.field_196762_fd)) { - blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false); - } else if (blockstate.func_215686_e(this, blockpos)) { -+ blockstate.onNeighborChange(this, blockpos, p_175666_1_); + if (blockstate.func_215686_e(this, blockpos)) { blockpos = blockpos.func_177972_a(direction); blockstate = this.func_180495_p(blockpos); -- if (blockstate.func_177230_c() == Blocks.field_196762_fd) { +- if (blockstate.func_203425_a(Blocks.field_196762_fd)) { + if (blockstate.getWeakChanges(this, blockpos)) { blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false); } } -@@ -1150,4 +1221,16 @@ - public BiomeManager func_225523_d_() { +@@ -1075,6 +1136,18 @@ return this.field_226689_w_; } -+ + + private double maxEntityRadius = 2.0D; + @Override + public double getMaxEntityRadius() { @@ -514,4 +399,7 @@ + maxEntityRadius = value; + return maxEntityRadius; + } - } ++ + public final boolean func_234925_Z_() { + return this.field_234916_c_; + } diff --git a/patches/minecraft/net/minecraft/world/biome/Biome.java.patch b/patches/minecraft/net/minecraft/world/biome/Biome.java.patch index c8999d71f..4435294e8 100644 --- a/patches/minecraft/net/minecraft/world/biome/Biome.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/Biome.java.patch @@ -1,38 +1,24 @@ --- a/net/minecraft/world/biome/Biome.java +++ b/net/minecraft/world/biome/Biome.java -@@ -54,7 +54,7 @@ +@@ -68,7 +68,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 class Biome { ++public class Biome extends net.minecraftforge.registries.ForgeRegistryEntry { public static final Logger field_150586_aC = LogManager.getLogger(); - public static final Set field_201870_ab = Sets.newHashSet(); - public static final ObjectIntIdentityMap field_185373_j = new ObjectIntIdentityMap<>(); -@@ -143,11 +143,11 @@ - } - - 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(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() { -@@ -196,7 +196,7 @@ + public static final Codec field_235051_b_ = RecordCodecBuilder.create((p_235064_0_) -> { + return p_235064_0_.group(Biome.RainType.field_235121_d_.fieldOf("precipitation").forGetter((p_235088_0_) -> { +@@ -283,7 +283,7 @@ if (this.func_225486_c(p_201854_2_) >= 0.15F) { return false; } else { - if (p_201854_2_.func_177956_o() >= 0 && p_201854_2_.func_177956_o() < 256 && p_201854_1_.func_226658_a_(LightType.BLOCK, p_201854_2_) < 10) { -+ if (p_201854_2_.func_177956_o() >= 0 && p_201854_2_.func_177956_o() < p_201854_1_.func_201675_m().getHeight() && p_201854_1_.func_226658_a_(LightType.BLOCK, p_201854_2_) < 10) { ++ if (p_201854_2_.func_177956_o() >= 0 && p_201854_2_.func_177956_o() < 256/*TODO worldIn.getDimension().getHeight()*/ && p_201854_1_.func_226658_a_(LightType.BLOCK, p_201854_2_) < 10) { BlockState blockstate = p_201854_1_.func_180495_p(p_201854_2_); - 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) { -@@ -221,7 +221,7 @@ + FluidState fluidstate = p_201854_1_.func_204610_c(p_201854_2_); + if (fluidstate.func_206886_c() == Fluids.field_204546_a && blockstate.func_177230_c() instanceof FlowingFluidBlock) { +@@ -308,7 +308,7 @@ } else { if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_226658_a_(LightType.BLOCK, p_201850_2_) < 10) { BlockState blockstate = p_201850_1_.func_180495_p(p_201850_2_); @@ -41,8 +27,8 @@ return true; } } -@@ -375,6 +375,17 @@ - return this.field_185364_H; +@@ -589,6 +589,17 @@ + } } + public Biome getRiver() { @@ -59,7 +45,7 @@ public static class Builder { @Nullable private ConfiguredSurfaceBuilder field_205422_a; -@@ -526,6 +537,18 @@ +@@ -787,6 +798,18 @@ } } diff --git a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch index fb6822625..a0087287e 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 -@@ -134,6 +134,10 @@ +@@ -136,6 +136,10 @@ this.field_177758_a.add(p_177737_1_); } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 5f586df5d..049a3dde0 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -7,9 +7,9 @@ -public class Chunk implements IChunk { +public class Chunk extends net.minecraftforge.common.capabilities.CapabilityProvider implements IChunk, net.minecraftforge.common.extensions.IForgeChunk { private static final Logger field_150817_t = LogManager.getLogger(); + @Nullable public static final ChunkSection field_186036_a = null; - private final ChunkSection[] field_76652_q = new ChunkSection[16]; -@@ -91,6 +91,7 @@ +@@ -92,6 +92,7 @@ } public Chunk(World p_i225781_1_, ChunkPos p_i225781_2_, BiomeContainer p_i225781_3_, UpgradeData p_i225781_4_, ITickList p_i225781_5_, ITickList p_i225781_6_, long p_i225781_7_, @Nullable ChunkSection[] p_i225781_9_, @Nullable Consumer p_i225781_10_) { @@ -17,7 +17,7 @@ this.field_76645_j = new ClassInheritanceMultiMap[16]; this.field_76637_e = p_i225781_1_; this.field_212816_F = p_i225781_2_; -@@ -118,7 +119,7 @@ +@@ -119,7 +120,7 @@ field_150817_t.warn("Could not set level chunk sections, array length is {} instead of {}", p_i225781_9_.length, this.field_76652_q.length); } } @@ -26,24 +26,7 @@ } public Chunk(World p_i49947_1_, ChunkPrimer p_i49947_2_) { -@@ -263,14 +264,14 @@ - - if (!this.field_76637_e.field_72995_K) { - blockstate.func_196947_b(this.field_76637_e, p_177436_1_, p_177436_2_, p_177436_3_); -- } else if (block1 != block && block1 instanceof ITileEntityProvider) { -+ } else if ((block1 != block || !p_177436_2_.hasTileEntity()) && blockstate.hasTileEntity()) { - this.field_76637_e.func_175713_t(p_177436_1_); - } - - if (chunksection.func_177485_a(i, j & 15, k).func_177230_c() != block) { - return null; - } else { -- if (block1 instanceof ITileEntityProvider) { -+ if (blockstate.hasTileEntity()) { - TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.CreateEntityType.CHECK); - if (tileentity != null) { - tileentity.func_145836_u(); -@@ -281,10 +282,10 @@ +@@ -282,10 +283,10 @@ p_177436_2_.func_215705_a(this.field_76637_e, p_177436_1_, blockstate, p_177436_3_); } @@ -56,7 +39,7 @@ this.field_76637_e.func_175690_a(p_177436_1_, tileentity1); } else { tileentity1.func_145836_u(); -@@ -320,11 +321,13 @@ +@@ -321,11 +322,13 @@ k = this.field_76645_j.length - 1; } @@ -70,7 +53,7 @@ } public void func_201607_a(Heightmap.Type p_201607_1_, long[] p_201607_2_) { -@@ -345,6 +348,7 @@ +@@ -346,6 +349,7 @@ } this.field_76645_j[p_76608_2_].remove(p_76608_1_); @@ -78,16 +61,7 @@ } public int func_201576_a(Heightmap.Type p_201576_1_, int p_201576_2_, int p_201576_3_) { -@@ -355,7 +359,7 @@ - private TileEntity func_177422_i(BlockPos p_177422_1_) { - BlockState blockstate = this.func_180495_p(p_177422_1_); - Block block = blockstate.func_177230_c(); -- return !block.func_149716_u() ? null : ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e); -+ return !blockstate.hasTileEntity() ? null : blockstate.createTileEntity(this.field_76637_e); - } - - @Nullable -@@ -366,6 +370,10 @@ +@@ -367,6 +371,10 @@ @Nullable public TileEntity func_177424_a(BlockPos p_177424_1_, Chunk.CreateEntityType p_177424_2_) { TileEntity tileentity = this.field_150816_i.get(p_177424_1_); @@ -98,7 +72,7 @@ if (tileentity == null) { CompoundNBT compoundnbt = this.field_201618_i.remove(p_177424_1_); if (compoundnbt != null) { -@@ -381,9 +389,6 @@ +@@ -382,9 +390,6 @@ tileentity = this.func_177422_i(p_177424_1_); this.field_76637_e.func_175690_a(p_177424_1_, tileentity); } @@ -108,7 +82,7 @@ } return tileentity; -@@ -398,7 +403,7 @@ +@@ -399,7 +404,7 @@ } public void func_177426_a(BlockPos p_177426_1_, TileEntity p_177426_2_) { @@ -117,7 +91,7 @@ p_177426_2_.func_226984_a_(this.field_76637_e, p_177426_1_); p_177426_2_.func_145829_t(); TileEntity tileentity = this.field_150816_i.put(p_177426_1_.func_185334_h(), p_177426_2_); -@@ -417,9 +422,14 @@ +@@ -418,9 +423,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()) { @@ -132,7 +106,7 @@ } else { CompoundNBT compoundnbt = this.field_201618_i.get(p_223134_1_); if (compoundnbt != null) { -@@ -454,8 +464,8 @@ +@@ -455,8 +465,8 @@ } public void func_177414_a(@Nullable Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, @Nullable Predicate p_177414_4_) { @@ -143,7 +117,7 @@ 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); -@@ -482,8 +492,8 @@ +@@ -486,8 +496,8 @@ } public void func_217313_a(@Nullable EntityType p_217313_1_, AxisAlignedBB p_217313_2_, List p_217313_3_, Predicate p_217313_4_) { @@ -154,7 +128,7 @@ 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); -@@ -498,8 +508,8 @@ +@@ -502,8 +512,8 @@ } public void func_177430_a(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, @Nullable Predicate p_177430_4_) { @@ -165,7 +139,7 @@ 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); -@@ -531,6 +541,11 @@ +@@ -535,6 +545,11 @@ }; Sets.newHashSet(this.field_150816_i.keySet()).stream().filter(predicate).forEach(this.field_76637_e::func_175713_t); @@ -177,7 +151,7 @@ for(int i = 0; i < this.field_76652_q.length; ++i) { ChunkSection chunksection = this.field_76652_q[i]; if ((p_227073_4_ & 1 << i) == 0) { -@@ -594,7 +609,7 @@ +@@ -598,7 +613,7 @@ public Stream func_217304_m() { return StreamSupport.stream(BlockPos.func_191531_b(this.field_212816_F.func_180334_c(), 0, this.field_212816_F.func_180333_d(), this.field_212816_F.func_180332_e(), 255, this.field_212816_F.func_180330_f()).spliterator(), false).filter((p_217312_1_) -> { @@ -186,20 +160,7 @@ }); } -@@ -699,9 +714,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); -+ 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_)); -@@ -790,4 +805,30 @@ +@@ -795,4 +810,30 @@ QUEUED, CHECK; } diff --git a/patches/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch b/patches/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch index e7ecbf746..4fff42f8a 100644 --- a/patches/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/chunk/ChunkPrimer.java +++ b/net/minecraft/world/chunk/ChunkPrimer.java -@@ -136,13 +136,13 @@ - if (this.field_201661_i[j >> 4] == Chunk.field_186036_a && p_177436_2_.func_177230_c() == Blocks.field_150350_a) { +@@ -138,13 +138,13 @@ + if (this.field_201661_i[j >> 4] == Chunk.field_186036_a && p_177436_2_.func_203425_a(Blocks.field_150350_a)) { return p_177436_2_; } else { - if (p_177436_2_.func_185906_d() > 0) { diff --git a/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch index d430dfe3d..1a75bc4e6 100644 --- a/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/chunk/IChunk.java +++ b/net/minecraft/world/chunk/IChunk.java -@@ -151,4 +151,9 @@ +@@ -145,4 +145,9 @@ boolean func_217310_r(); void func_217305_b(boolean p_217305_1_); diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch index 269b4f4e2..ca5702bf9 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/chunk/storage/ChunkSerializer.java +++ b/net/minecraft/world/chunk/storage/ChunkSerializer.java -@@ -131,6 +131,7 @@ +@@ -132,6 +132,7 @@ ichunk = new Chunk(p_222656_0_.func_201672_e(), p_222656_3_, biomecontainer, upgradedata, iticklist, iticklist1, k1, achunksection, (p_222648_1_) -> { func_222650_a(compoundnbt, p_222648_1_); }); @@ -8,7 +8,7 @@ } else { ChunkPrimer chunkprimer = new ChunkPrimer(p_222656_3_, upgradedata, achunksection, chunkprimerticklist, chunkprimerticklist1); chunkprimer.func_225548_a_(biomecontainer); -@@ -143,7 +144,7 @@ +@@ -144,7 +145,7 @@ if (!flag && chunkprimer.func_201589_g().func_209003_a(ChunkStatus.field_222614_j)) { for(BlockPos blockpos : BlockPos.func_191531_b(p_222656_3_.func_180334_c(), 0, p_222656_3_.func_180333_d(), p_222656_3_.func_180332_e(), 255, p_222656_3_.func_180330_f())) { @@ -17,7 +17,7 @@ chunkprimer.func_201637_h(blockpos); } } -@@ -182,6 +183,7 @@ +@@ -183,6 +184,7 @@ } if (chunkstatus$type == ChunkStatus.Type.LEVELCHUNK) { @@ -25,7 +25,7 @@ return new ChunkPrimerWrapper((Chunk)ichunk); } else { ChunkPrimer chunkprimer1 = (ChunkPrimer)ichunk; -@@ -215,6 +217,8 @@ +@@ -216,6 +218,8 @@ chunkprimer1.func_205767_a(generationstage$carving, BitSet.valueOf(compoundnbt5.func_74770_j(s1))); } @@ -34,7 +34,7 @@ return chunkprimer1; } } -@@ -294,12 +298,22 @@ +@@ -295,12 +299,22 @@ for(int k = 0; k < chunk.func_177429_s().length; ++k) { for(Entity entity : chunk.func_177429_s()[k]) { CompoundNBT compoundnbt3 = new 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 aa33bb3bd..f809d4dd0 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -6,17 +6,17 @@ private final RegionBitmap field_227128_i_ = new RegionBitmap(); + private final Path filePath; - public RegionFile(File p_i225784_1_, File p_i225784_2_) throws IOException { - this(p_i225784_1_.toPath(), p_i225784_2_.toPath(), RegionFileVersion.field_227159_b_); + public RegionFile(File p_i231893_1_, File p_i231893_2_, boolean p_i231893_3_) throws IOException { + this(p_i231893_1_.toPath(), p_i231893_2_.toPath(), RegionFileVersion.field_227159_b_, p_i231893_3_); @@ -40,6 +41,7 @@ - public RegionFile(Path p_i225785_1_, Path p_i225785_2_, RegionFileVersion p_i225785_3_) throws IOException { - this.field_227125_e_ = p_i225785_3_; -+ this.filePath = p_i225785_1_; - if (!Files.isDirectory(p_i225785_2_)) { - throw new IllegalArgumentException("Expected directory, got " + p_i225785_2_.toAbsolutePath()); + public RegionFile(Path p_i231894_1_, Path p_i231894_2_, RegionFileVersion p_i231894_3_, boolean p_i231894_4_) throws IOException { + this.field_227125_e_ = p_i231894_3_; ++ this.filePath = p_i231894_2_; + if (!Files.isDirectory(p_i231894_2_)) { + throw new IllegalArgumentException("Expected directory, got " + p_i231894_2_.toAbsolutePath()); } else { -@@ -62,6 +64,8 @@ +@@ -67,6 +69,8 @@ if (k != 0) { int l = func_227142_b_(k); int i1 = func_227131_a_(k); @@ -25,7 +25,7 @@ this.field_227128_i_.func_227120_a_(l, i1); } } -@@ -70,6 +74,66 @@ +@@ -75,6 +79,66 @@ } } @@ -92,7 +92,7 @@ private Path func_227145_e_(ChunkPos p_227145_1_) { String s = "c." + p_227145_1_.field_77276_a + "." + p_227145_1_.field_77275_b + ".mcc"; return this.field_227124_d_.resolve(s); -@@ -225,6 +289,7 @@ +@@ -234,6 +298,7 @@ int j = this.field_76716_d.get(i); int k = func_227142_b_(j); int l = func_227131_a_(j); diff --git a/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch b/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch index e53ba433b..d099755cc 100644 --- a/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch +++ b/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch @@ -1,31 +1,13 @@ --- a/net/minecraft/world/end/DragonFightManager.java +++ b/net/minecraft/world/end/DragonFightManager.java -@@ -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"); -+ this.field_186120_n = !p_i46669_2_.func_74767_n("LegacyScanPerformed"); // Forge: fix MC-105080 - if (p_i46669_2_.func_74767_n("IsRespawning")) { + this.field_186117_k = p_i231901_4_.func_74767_n("DragonKilled"); + this.field_186118_l = p_i231901_4_.func_74767_n("PreviouslyKilled"); ++ this.field_186120_n = !p_i231901_4_.func_74767_n("LegacyScanPerformed"); // Forge: fix MC-105080 + if (p_i231901_4_.func_74767_n("IsRespawning")) { this.field_186122_p = DragonSpawnState.START; } -@@ -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())); - } - - 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 @@ compoundnbt.func_74757_a("DragonKilled", this.field_186117_k); @@ -34,7 +16,7 @@ if (this.field_186121_o != null) { compoundnbt.func_218657_a("ExitPortalLocation", NBTUtil.func_186859_a(this.field_186121_o)); } -@@ -492,6 +494,13 @@ +@@ -491,6 +493,13 @@ endercrystalentity.func_184516_a((BlockPos)null); } } diff --git a/patches/minecraft/net/minecraft/world/gen/IWorldGenerationBaseReader.java.patch b/patches/minecraft/net/minecraft/world/gen/IWorldGenerationBaseReader.java.patch index 36577a381..a67278fa6 100644 --- a/patches/minecraft/net/minecraft/world/gen/IWorldGenerationBaseReader.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/IWorldGenerationBaseReader.java.patch @@ -1,11 +1,12 @@ --- a/net/minecraft/world/gen/IWorldGenerationBaseReader.java +++ b/net/minecraft/world/gen/IWorldGenerationBaseReader.java -@@ -8,4 +8,8 @@ +@@ -8,4 +8,9 @@ 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; -+ } ++ //TODO, Dimensions.. ++// default int getMaxHeight() { ++// return this instanceof net.minecraft.world.IWorld ? ((net.minecraft.world.IWorld)this).getWorld().getDimension().getHeight() : 256; ++// } } diff --git a/patches/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch b/patches/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch index b9ce49b05..b49eb936f 100644 --- a/patches/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/gen/NoiseChunkGenerator.java +++ b/net/minecraft/world/gen/NoiseChunkGenerator.java -@@ -378,8 +378,8 @@ - } - +@@ -520,8 +520,8 @@ + objectlistiterator1.back(objectlist1.size()); + BlockState blockstate = this.func_236086_a_(d18, i2); if (blockstate != field_222562_i) { - if (blockstate.func_185906_d() != 0) { -- blockpos$mutable.func_181079_c(j3, j2, i4); -+ blockpos$mutable.func_181079_c(j3, j2, i4); +- blockpos$mutable.func_181079_c(i3, i2, l3); ++ blockpos$mutable.func_181079_c(i3, i2, l3); + if (blockstate.getLightValue(chunkprimer, blockpos$mutable) != 0) { chunkprimer.func_201637_h(blockpos$mutable); } diff --git a/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch b/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch index 024973d21..580453c44 100644 --- a/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch @@ -1,62 +1,60 @@ --- a/net/minecraft/world/gen/WorldGenRegion.java +++ b/net/minecraft/world/gen/WorldGenRegion.java -@@ -164,11 +164,11 @@ +@@ -165,11 +165,11 @@ - public boolean func_225521_a_(BlockPos p_225521_1_, boolean p_225521_2_, @Nullable Entity p_225521_3_) { - BlockState blockstate = this.func_180495_p(p_225521_1_); + public boolean func_241212_a_(BlockPos p_241212_1_, boolean p_241212_2_, @Nullable Entity p_241212_3_, int p_241212_4_) { + BlockState blockstate = this.func_180495_p(p_241212_1_); - if (blockstate.func_196958_f()) { -+ if (blockstate.isAir(this, p_225521_1_)) { ++ if (blockstate.isAir(this, p_241212_1_)) { return false; } else { - if (p_225521_2_) { -- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? this.func_175625_s(p_225521_1_) : null; -+ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_225521_1_) : null; - Block.func_220054_a(blockstate, this.field_201689_f, p_225521_1_, tileentity, p_225521_3_, ItemStack.field_190927_a); + if (p_241212_2_) { +- TileEntity tileentity = blockstate.func_177230_c().func_235695_q_() ? this.func_175625_s(p_241212_1_) : null; ++ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_241212_1_) : null; + Block.func_220054_a(blockstate, this.field_201689_f, p_241212_1_, tileentity, p_241212_3_, ItemStack.field_190927_a); } -@@ -186,12 +186,12 @@ - CompoundNBT compoundnbt = ichunk.func_201579_g(p_175625_1_); +@@ -189,11 +189,11 @@ if (compoundnbt != null) { if ("DUMMY".equals(compoundnbt.func_74779_i("id"))) { -- Block block = this.func_180495_p(p_175625_1_).func_177230_c(); + Block block = blockstate.func_177230_c(); - if (!(block instanceof ITileEntityProvider)) { -+ BlockState state = this.func_180495_p(p_175625_1_); -+ if (!state.hasTileEntity()) { ++ if (!blockstate.hasTileEntity()) { return null; } - tileentity = ((ITileEntityProvider)block).func_196283_a_(this.field_201689_f); -+ tileentity = state.createTileEntity(this.field_201689_f); ++ tileentity = blockstate.createTileEntity(this.field_201689_f); } else { - tileentity = TileEntity.func_203403_c(compoundnbt); + tileentity = TileEntity.func_235657_b_(blockstate, compoundnbt); } -@@ -202,7 +202,7 @@ +@@ -204,7 +204,7 @@ } } -- if (ichunk.func_180495_p(p_175625_1_).func_177230_c() instanceof ITileEntityProvider) { -+ if (ichunk.func_180495_p(p_175625_1_).hasTileEntity()) { +- if (blockstate.func_177230_c() instanceof ITileEntityProvider) { ++ if (blockstate.hasTileEntity()) { field_208303_a.warn("Tried to access a block entity before it was created. {}", (Object)p_175625_1_); } -@@ -218,9 +218,9 @@ +@@ -220,9 +220,9 @@ } - Block block = p_180501_2_.func_177230_c(); -- if (block.func_149716_u()) { -+ if (p_180501_2_.hasTileEntity()) { + Block block = p_241211_2_.func_177230_c(); +- if (block.func_235695_q_()) { ++ if (p_241211_2_.hasTileEntity()) { if (ichunk.func_201589_g().func_202129_d() == ChunkStatus.Type.LEVELCHUNK) { -- 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)); +- ichunk.func_177426_a(p_241211_1_, ((ITileEntityProvider)block).func_196283_a_(this)); ++ ichunk.func_177426_a(p_241211_1_, p_241211_2_.createTileEntity(this)); } else { CompoundNBT compoundnbt = new CompoundNBT(); - compoundnbt.func_74768_a("x", p_180501_1_.func_177958_n()); -@@ -229,7 +229,7 @@ + compoundnbt.func_74768_a("x", p_241211_1_.func_177958_n()); +@@ -231,7 +231,7 @@ compoundnbt.func_74778_a("id", "DUMMY"); ichunk.func_201591_a(compoundnbt); } -- } else if (blockstate != null && blockstate.func_177230_c().func_149716_u()) { +- } else if (blockstate != null && blockstate.func_177230_c().func_235695_q_()) { + } else if (blockstate != null && blockstate.hasTileEntity()) { - ichunk.func_177425_e(p_180501_1_); + ichunk.func_177425_e(p_241211_1_); } diff --git a/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch b/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch index 3b7663ee3..10745a949 100644 --- a/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/blockplacer/BlockPlacerType.java +++ b/net/minecraft/world/gen/blockplacer/BlockPlacerType.java -@@ -4,7 +4,7 @@ - import java.util.function.Function; +@@ -3,7 +3,7 @@ + import com.mojang.serialization.Codec; import net.minecraft.util.registry.Registry; -public class BlockPlacerType

{ +public class BlockPlacerType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final BlockPlacerType field_227259_a_ = func_227264_a_("simple_block_placer", SimpleBlockPlacer::new); - public static final BlockPlacerType field_227260_b_ = func_227264_a_("double_plant_placer", DoublePlantBlockPlacer::new); - public static final BlockPlacerType field_227261_c_ = func_227264_a_("column_placer", ColumnBlockPlacer::new); + public static final BlockPlacerType field_227259_a_ = func_236438_a_("simple_block_placer", SimpleBlockPlacer.field_236446_b_); + public static final BlockPlacerType field_227260_b_ = func_236438_a_("double_plant_placer", DoublePlantBlockPlacer.field_236443_b_); + public static final BlockPlacerType field_227261_c_ = func_236438_a_("column_placer", ColumnBlockPlacer.field_236439_b_); diff --git a/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch b/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch index 0a4da6d68..73aad86b0 100644 --- a/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java +++ b/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java -@@ -4,7 +4,7 @@ - import java.util.function.Function; +@@ -3,7 +3,7 @@ + import com.mojang.serialization.Codec; import net.minecraft.util.registry.Registry; -public class BlockStateProviderType

{ +public class BlockStateProviderType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final BlockStateProviderType field_227394_a_ = func_227400_a_("simple_state_provider", SimpleBlockStateProvider::new); - public static final BlockStateProviderType field_227395_b_ = func_227400_a_("weighted_state_provider", WeightedBlockStateProvider::new); - public static final BlockStateProviderType field_227396_c_ = func_227400_a_("plain_flower_provider", PlainFlowerBlockStateProvider::new); + public static final BlockStateProviderType field_227394_a_ = func_236800_a_("simple_state_provider", SimpleBlockStateProvider.field_236809_b_); + public static final BlockStateProviderType field_227395_b_ = func_236800_a_("weighted_state_provider", WeightedBlockStateProvider.field_236811_b_); + public static final BlockStateProviderType field_227396_c_ = func_236800_a_("plain_flower_provider", PlainFlowerBlockStateProvider.field_236804_b_); diff --git a/patches/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch b/patches/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch index bdaef4183..5685db32a 100644 --- a/patches/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/carver/WorldCarver.java +++ b/net/minecraft/world/gen/carver/WorldCarver.java @@ -22,7 +22,7 @@ - import net.minecraft.world.chunk.IChunk; import net.minecraft.world.gen.feature.ProbabilityConfig; + import org.apache.commons.lang3.mutable.MutableBoolean; -public abstract class WorldCarver { +public abstract class WorldCarver extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final WorldCarver field_222709_a = func_222699_a("cave", new CaveWorldCarver(ProbabilityConfig::func_214645_a, 256)); - public static final WorldCarver field_222710_b = func_222699_a("hell_cave", new NetherCaveWorldCarver(ProbabilityConfig::func_214645_a)); - public static final WorldCarver field_222711_c = func_222699_a("canyon", new CanyonWorldCarver(ProbabilityConfig::func_214645_a)); + public static final WorldCarver field_222709_a = func_222699_a("cave", new CaveWorldCarver(ProbabilityConfig.field_236576_b_, 256)); + public static final WorldCarver field_236240_b_ = func_222699_a("nether_cave", new NetherCaveCarver(ProbabilityConfig.field_236576_b_)); + public static final WorldCarver field_222711_c = func_222699_a("canyon", new CanyonWorldCarver(ProbabilityConfig.field_236576_b_)); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch index c2e5bd6b8..5995867f9 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch @@ -6,7 +6,7 @@ p_227210_6_.func_189533_g(p_227210_3_).func_189534_c(Direction.UP, i); - if (!p_227210_1_.func_180495_p(p_227210_6_).func_200015_d(p_227210_1_, p_227210_6_)) { + if (p_227210_1_.func_180495_p(p_227210_6_).canBeReplacedByLogs(p_227210_1_, p_227210_6_)) { - this.func_202278_a(p_227210_1_, p_227210_6_, p_227210_4_.field_227273_b_.func_225574_a_(p_227210_2_, p_227210_3_)); + this.func_230367_a_(p_227210_1_, p_227210_6_, p_227210_4_.field_227273_b_.func_225574_a_(p_227210_2_, p_227210_3_)); } } @@ -38,7 +38,7 @@ @@ -14,16 +14,7 @@ protected boolean func_227209_a_(IWorld p_227209_1_, BlockPos p_227209_2_, int p_227209_3_, BlockPos.Mutable p_227209_4_, BigMushroomFeatureConfig p_227209_5_) { int i = p_227209_2_.func_177956_o(); - if (i >= 1 && i + p_227209_3_ + 1 < 256) { -+ if (i >= 1 && i + p_227209_3_ + 1 < p_227209_1_.getMaxHeight()) { ++ if (i >= 1 && i + p_227209_3_ + 1 < 256/*TODO p_227209_1_.getMaxHeight()*/) { Block block = p_227209_1_.func_180495_p(p_227209_2_.func_177977_b()).func_177230_c(); if (!func_227250_b_(block)) { return false; -@@ -49,7 +49,7 @@ - for(int l = -k; l <= k; ++l) { - for(int i1 = -k; i1 <= k; ++i1) { - BlockState blockstate = p_227209_1_.func_180495_p(p_227209_4_.func_189533_g(p_227209_2_).func_196234_d(l, j, i1)); -- if (!blockstate.func_196958_f() && !blockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (!blockstate.isAir(p_227209_1_, p_227209_4_) && !blockstate.func_203425_a(BlockTags.field_206952_E)) { - return false; - } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch index 790cce939..e5165d5e4 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java +++ b/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java -@@ -17,6 +17,7 @@ - public final List field_227370_o_; - public final int field_227371_p_; - public transient boolean field_227372_q_; +@@ -42,6 +42,7 @@ + public final int field_236680_i_; + public final boolean field_236681_j_; + public final Heightmap.Type field_236682_l_; + protected net.minecraftforge.common.IPlantable sapling = (net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196674_t; - protected BaseTreeFeatureConfig(BlockStateProvider p_i225842_1_, BlockStateProvider p_i225842_2_, List p_i225842_3_, int p_i225842_4_) { - this.field_227368_m_ = p_i225842_1_; -@@ -37,6 +38,15 @@ - return new Dynamic<>(p_214634_1_, p_214634_1_.createMap(builder.build())); + protected BaseTreeFeatureConfig(BlockStateProvider p_i232020_1_, BlockStateProvider p_i232020_2_, FoliagePlacer p_i232020_3_, AbstractTrunkPlacer p_i232020_4_, AbstractFeatureSizeType p_i232020_5_, List p_i232020_6_, int p_i232020_7_, boolean p_i232020_8_, Heightmap.Type p_i232020_9_) { + this.field_227368_m_ = p_i232020_1_; +@@ -55,6 +56,15 @@ + this.field_236682_l_ = p_i232020_9_; } + protected BaseTreeFeatureConfig setSapling(net.minecraftforge.common.IPlantable value) { @@ -18,41 +18,9 @@ + } + + public net.minecraftforge.common.IPlantable getSapling() { -+ return this.sapling; ++ return this.sapling; + } + - public static BaseTreeFeatureConfig func_227376_b_(Dynamic p_227376_0_) { - BlockStateProviderType blockstateprovidertype = Registry.field_229387_t_.func_82594_a(new ResourceLocation(p_227376_0_.get("trunk_provider").get("type").asString().orElseThrow(RuntimeException::new))); - BlockStateProviderType blockstateprovidertype1 = Registry.field_229387_t_.func_82594_a(new ResourceLocation(p_227376_0_.get("leaves_provider").get("type").asString().orElseThrow(RuntimeException::new))); -@@ -45,11 +55,16 @@ - }), p_227376_0_.get("base_height").asInt(0)); + public void func_227373_a_() { + this.field_227372_q_ = true; } - -+ public static BaseTreeFeatureConfig deserializeJungle(Dynamic data) { -+ return func_227376_b_(data).setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196678_w); -+ } -+ - public static class Builder { - public final BlockStateProvider field_227377_a_; - public final BlockStateProvider field_227378_b_; - private List field_227379_c_ = Lists.newArrayList(); - private int field_227380_d_ = 0; -+ protected net.minecraftforge.common.IPlantable sapling = (net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196674_t; - - public Builder(BlockStateProvider p_i225843_1_, BlockStateProvider p_i225843_2_) { - this.field_227377_a_ = p_i225843_1_; -@@ -61,8 +76,13 @@ - return this; - } - -+ public BaseTreeFeatureConfig.Builder setSapling(net.minecraftforge.common.IPlantable value) { -+ this.sapling = value; -+ return this; -+ } -+ - public BaseTreeFeatureConfig func_225568_b_() { -- return new BaseTreeFeatureConfig(this.field_227377_a_, this.field_227378_b_, this.field_227379_c_, this.field_227380_d_); -+ return new BaseTreeFeatureConfig(this.field_227377_a_, this.field_227378_b_, this.field_227379_c_, this.field_227380_d_).setSapling(sapling); - } - } - } 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 3da0500fd..916ec07d1 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java +++ b/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java -@@ -25,7 +25,7 @@ +@@ -24,7 +24,7 @@ boolean flag5 = flag2 || flag3; if (!flag4 || !flag5) { - p_225564_5_.func_189533_g(p_225564_3_).func_196234_d(j, p_225564_4_, k); + p_225564_5_.func_239621_a_(p_225564_3_, j, p_225564_4_, k); - if (!p_225564_1_.func_180495_p(p_225564_5_).func_200015_d(p_225564_1_, p_225564_5_)) { + if (p_225564_1_.func_180495_p(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) { boolean flag6 = flag || flag5 && j == 1 - i; 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 24a938f0d..85a4a9d05 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/feature/BigRedMushroomFeature.java +++ b/net/minecraft/world/gen/feature/BigRedMushroomFeature.java -@@ -27,7 +27,7 @@ +@@ -26,7 +26,7 @@ boolean flag5 = flag2 || flag3; if (i >= p_225564_4_ || flag4 != flag5) { - p_225564_5_.func_189533_g(p_225564_3_).func_196234_d(l, i, i1); + p_225564_5_.func_239621_a_(p_225564_3_, l, i, i1); - if (!p_225564_1_.func_180495_p(p_225564_5_).func_200015_d(p_225564_1_, p_225564_5_)) { + if (p_225564_1_.func_180495_p(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) { - this.func_202278_a(p_225564_1_, p_225564_5_, p_225564_6_.field_227272_a_.func_225574_a_(p_225564_2_, p_225564_3_).func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(i >= p_225564_4_ - 1)).func_206870_a(HugeMushroomBlock.field_196464_y, Boolean.valueOf(l < -k)).func_206870_a(HugeMushroomBlock.field_196461_b, Boolean.valueOf(l > k)).func_206870_a(HugeMushroomBlock.field_196459_a, Boolean.valueOf(i1 < -k)).func_206870_a(HugeMushroomBlock.field_196463_c, Boolean.valueOf(i1 > k))); + this.func_230367_a_(p_225564_1_, p_225564_5_, p_225564_6_.field_227272_a_.func_225574_a_(p_225564_2_, p_225564_3_).func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(i >= p_225564_4_ - 1)).func_206870_a(HugeMushroomBlock.field_196464_y, Boolean.valueOf(l < -k)).func_206870_a(HugeMushroomBlock.field_196461_b, Boolean.valueOf(l > k)).func_206870_a(HugeMushroomBlock.field_196459_a, Boolean.valueOf(i1 < -k)).func_206870_a(HugeMushroomBlock.field_196463_c, Boolean.valueOf(i1 > k))); } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch index 10fb17c5c..76c9d2324 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch @@ -1,52 +1,25 @@ --- a/net/minecraft/world/gen/feature/Feature.java +++ b/net/minecraft/world/gen/feature/Feature.java -@@ -43,7 +43,7 @@ - import net.minecraft.world.gen.feature.structure.WoodlandMansionStructure; +@@ -17,7 +17,7 @@ + import net.minecraft.world.gen.feature.structure.StructureManager; import net.minecraft.world.gen.placement.CountConfig; -public abstract class Feature { +public abstract class Feature extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final Structure field_214536_b = func_214468_a("pillager_outpost", new PillagerOutpostStructure(NoFeatureConfig::func_214639_a)); - public static final Structure field_202329_g = func_214468_a("mineshaft", new MineshaftStructure(MineshaftConfig::func_214638_a)); - public static final Structure field_202330_h = func_214468_a("woodland_mansion", new WoodlandMansionStructure(NoFeatureConfig::func_214639_a)); -@@ -61,12 +61,12 @@ - public static final Structure field_214550_p = func_214468_a("village", new VillageStructure(VillageConfig::func_214679_a)); - public static final Feature field_227245_q_ = func_214468_a("no_op", new NoOpFeature(NoFeatureConfig::func_214639_a)); - public static final Feature field_202301_A = func_214468_a("normal_tree", new TreeFeature(TreeFeatureConfig::func_227338_a_)); -- public static final Feature field_227246_s_ = func_214468_a("acacia_tree", new AcaciaFeature(TreeFeatureConfig::func_227338_a_)); -+ public static final Feature field_227246_s_ = func_214468_a("acacia_tree", new AcaciaFeature(TreeFeatureConfig::deserializeAcacia)); - public static final Feature field_202339_q = func_214468_a("fancy_tree", new FancyTreeFeature(TreeFeatureConfig::func_227338_a_)); -- public static final Feature field_202342_t = func_214468_a("jungle_ground_bush", new ShrubFeature(BaseTreeFeatureConfig::func_227376_b_)); -- public static final Feature field_214551_w = func_214468_a("dark_oak_tree", new DarkOakTreeFeature(HugeTreeFeatureConfig::func_227277_a_)); -- public static final Feature field_202302_B = func_214468_a("mega_jungle_tree", new MegaJungleFeature(HugeTreeFeatureConfig::func_227277_a_)); -- public static final Feature field_202304_D = func_214468_a("mega_spruce_tree", new MegaPineTree(HugeTreeFeatureConfig::func_227277_a_)); -+ public static final Feature field_202342_t = func_214468_a("jungle_ground_bush", new ShrubFeature(BaseTreeFeatureConfig::deserializeJungle)); -+ public static final Feature field_214551_w = func_214468_a("dark_oak_tree", new DarkOakTreeFeature(HugeTreeFeatureConfig::deserializeDarkOak)); -+ public static final Feature field_202302_B = func_214468_a("mega_jungle_tree", new MegaJungleFeature(HugeTreeFeatureConfig::deserializeJungle)); -+ public static final Feature field_202304_D = func_214468_a("mega_spruce_tree", new MegaPineTree(HugeTreeFeatureConfig::deserializeSpruce)); - public static final FlowersFeature field_227247_y_ = func_214468_a("flower", new DefaultFlowersFeature(BlockClusterFeatureConfig::func_227300_a_)); - public static final Feature field_227248_z_ = func_214468_a("random_patch", new RandomPatchFeature(BlockClusterFeatureConfig::func_227300_a_)); - public static final Feature field_227244_A_ = func_214468_a("block_pile", new BlockPileFeature(BlockStateProvidingFeatureConfig::func_227269_a_)); -@@ -109,7 +109,8 @@ - public static final Feature field_202293_am = func_214468_a("random_boolean_selector", new TwoFeatureChoiceFeature(TwoFeatureChoiceConfig::func_227287_a_)); - public static final Feature field_214483_aK = func_214468_a("decorated", new DecoratedFeature(DecoratedFeatureConfig::func_214688_a)); - public static final Feature field_214484_aL = func_214468_a("decorated_flower", new DecoratedFlowerFeature(DecoratedFeatureConfig::func_214688_a)); -- public static final BiMap> field_202300_at = Util.func_200696_a(HashBiMap.create(), (p_205170_0_) -> { -+ public static final BiMap> field_202300_at = Util.func_200696_a(net.minecraftforge.registries.GameData.getStructureMap(), (p_205170_0_) -> { -+ if (true) return; // Forge: This is now a slave map to the feature registry, leave this code here to reduce patch size - p_205170_0_.put("Pillager_Outpost".toLowerCase(Locale.ROOT), field_214536_b); - p_205170_0_.put("Mineshaft".toLowerCase(Locale.ROOT), field_202329_g); - p_205170_0_.put("Mansion".toLowerCase(Locale.ROOT), field_202330_h); -@@ -160,10 +161,10 @@ - } + public static final Feature field_227245_q_ = func_214468_a("no_op", new NoOpFeature(NoFeatureConfig.field_236558_a_)); + public static final Feature field_236291_c_ = func_214468_a("tree", new TreeFeature(BaseTreeFeatureConfig.field_236676_a_)); + public static final FlowersFeature field_227247_y_ = func_214468_a("flower", new DefaultFlowersFeature(BlockClusterFeatureConfig.field_236587_a_)); +@@ -100,11 +100,11 @@ + public abstract boolean func_230362_a_(ISeedReader p_230362_1_, StructureManager p_230362_2_, ChunkGenerator p_230362_3_, Random p_230362_4_, BlockPos p_230362_5_, FC p_230362_6_); protected static boolean func_227249_a_(Block p_227249_0_) { - return p_227249_0_ == Blocks.field_150348_b || p_227249_0_ == Blocks.field_196650_c || p_227249_0_ == Blocks.field_196654_e || p_227249_0_ == Blocks.field_196656_g; -+ return net.minecraftforge.common.Tags.Blocks.STONE.func_199685_a_(p_227249_0_); ++ return net.minecraftforge.common.Tags.Blocks.STONE.func_230235_a_(p_227249_0_); } - protected static boolean func_227250_b_(Block p_227250_0_) { + public static boolean func_227250_b_(Block p_227250_0_) { - return p_227250_0_ == Blocks.field_150346_d || p_227250_0_ == Blocks.field_196658_i || p_227250_0_ == Blocks.field_196661_l || p_227250_0_ == Blocks.field_196660_k || p_227250_0_ == Blocks.field_150391_bh; -+ return net.minecraftforge.common.Tags.Blocks.DIRT.func_199685_a_(p_227250_0_); ++ return net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(p_227250_0_); } - } + + public static boolean func_236293_a_(IWorldGenerationBaseReader p_236293_0_, BlockPos p_236293_1_) { 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 d156b86a5..8120c481c 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,11 @@ --- a/net/minecraft/world/gen/feature/IceSpikeFeature.java +++ b/net/minecraft/world/gen/feature/IceSpikeFeature.java -@@ -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))) { - 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() || func_227250_b_(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)) || func_227250_b_(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) { - 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() || func_227250_b_(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)) || func_227250_b_(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()); - } - } -@@ -78,7 +78,7 @@ +@@ -77,7 +77,7 @@ while(blockpos.func_177956_o() > 50) { - BlockState blockstate1 = p_212245_1_.func_180495_p(blockpos); + BlockState blockstate1 = p_230362_1_.func_180495_p(blockpos); Block block1 = blockstate1.func_177230_c(); - if (!blockstate1.func_196958_f() && !func_227250_b_(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { -+ if (!blockstate1.isAir(p_212245_1_, blockpos) && !func_227250_b_(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { ++ if (!blockstate1.isAir(p_230362_1_, blockpos) && !func_227250_b_(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/OreFeatureConfig.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/OreFeatureConfig.java.patch index 633959e63..872104bbe 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/OreFeatureConfig.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/OreFeatureConfig.java.patch @@ -1,19 +1,18 @@ --- a/net/minecraft/world/gen/feature/OreFeatureConfig.java +++ b/net/minecraft/world/gen/feature/OreFeatureConfig.java -@@ -34,7 +34,7 @@ - return new OreFeatureConfig(orefeatureconfig$fillerblocktype, blockstate, i); +@@ -31,7 +31,7 @@ + this.field_202442_b = p_i51473_1_; } -- public static enum FillerBlockType { -+ public static enum FillerBlockType implements net.minecraftforge.common.IExtensibleEnum { +- public static enum FillerBlockType implements IStringSerializable { ++ public static enum FillerBlockType implements IStringSerializable, net.minecraftforge.common.IExtensibleEnum { NATURAL_STONE("natural_stone", (p_214739_0_) -> { if (p_214739_0_ == null) { return false; -@@ -67,5 +67,15 @@ - public Predicate func_214738_b() { - return this.field_214743_e; +@@ -68,6 +68,16 @@ + return field_214741_c.get(p_214736_0_); } -+ + + public static FillerBlockType create(String enumName, String p_i50618_3_, Predicate p_i50618_4_) { + throw new IllegalStateException("Enum not extended"); + } @@ -23,5 +22,7 @@ + public void init() { + field_214741_c.put(func_214737_a(), this); + } - } - } ++ + public Predicate func_214738_b() { + return this.field_214743_e; + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch index fb7478745..48d2b51f5 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java +++ b/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java -@@ -72,7 +72,7 @@ +@@ -86,7 +86,7 @@ return this.field_214953_e.size(); } -- public static enum PlacementBehaviour { -+ public static enum PlacementBehaviour implements net.minecraftforge.common.IExtensibleEnum { +- public static enum PlacementBehaviour implements IStringSerializable { ++ public static enum PlacementBehaviour implements IStringSerializable, net.minecraftforge.common.IExtensibleEnum { TERRAIN_MATCHING("terrain_matching", ImmutableList.of(new GravityStructureProcessor(Heightmap.Type.WORLD_SURFACE_WG, -1))), RIGID("rigid", ImmutableList.of()); -@@ -98,5 +98,15 @@ - public ImmutableList func_214937_b() { - return this.field_214941_e; +@@ -117,5 +117,15 @@ + public String func_176610_l() { + return this.field_214940_d; } -+ ++ + public static PlacementBehaviour create(String enumName, String p_i50487_3_, ImmutableList p_i50487_4_) { + throw new IllegalStateException("Enum not extended"); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch index 4dab4c2d6..b02248dda 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/gen/feature/structure/MineshaftPieces.java +++ b/net/minecraft/world/gen/feature/structure/MineshaftPieces.java -@@ -207,7 +207,7 @@ +@@ -208,7 +208,7 @@ protected boolean func_186167_a(IWorld p_186167_1_, MutableBoundingBox p_186167_2_, Random p_186167_3_, int p_186167_4_, int p_186167_5_, int p_186167_6_, ResourceLocation p_186167_7_) { BlockPos blockpos = new BlockPos(this.func_74865_a(p_186167_4_, p_186167_6_), this.func_74862_a(p_186167_5_), this.func_74873_b(p_186167_4_, p_186167_6_)); @@ -8,4 +8,4 @@ + if (p_186167_2_.func_175898_b(blockpos) && p_186167_1_.func_180495_p(blockpos).isAir(p_186167_1_, blockpos) && !p_186167_1_.func_180495_p(blockpos.func_177977_b()).isAir(p_186167_1_, blockpos.func_177977_b())) { BlockState blockstate = Blocks.field_150448_aq.func_176223_P().func_206870_a(RailBlock.field_176565_b, p_186167_3_.nextBoolean() ? RailShape.NORTH_SOUTH : RailShape.EAST_WEST); this.func_175811_a(p_186167_1_, blockstate, p_186167_4_, p_186167_5_, p_186167_6_, p_186167_2_); - ChestMinecartEntity chestminecartentity = new ChestMinecartEntity(p_186167_1_.func_201672_e(), (double)((float)blockpos.func_177958_n() + 0.5F), (double)((float)blockpos.func_177956_o() + 0.5F), (double)((float)blockpos.func_177952_p() + 0.5F)); + ChestMinecartEntity chestminecartentity = new ChestMinecartEntity(p_186167_1_.func_201672_e(), (double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D); 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 25ded3773..0890a316d 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,6 +1,6 @@ --- a/net/minecraft/world/gen/feature/structure/StructurePiece.java +++ b/net/minecraft/world/gen/feature/structure/StructurePiece.java -@@ -56,6 +56,9 @@ +@@ -57,6 +57,9 @@ } public final CompoundNBT func_143010_b() { 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 007d1d630..abc6a2d48 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,6 +1,6 @@ --- a/net/minecraft/world/gen/feature/structure/StructureStart.java +++ b/net/minecraft/world/gen/feature/structure/StructureStart.java -@@ -77,6 +77,9 @@ +@@ -83,6 +83,9 @@ public CompoundNBT func_143021_a(int p_143021_1_, int p_143021_2_) { CompoundNBT compoundnbt = new CompoundNBT(); if (this.func_75069_d()) { 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 index 8e8af4b8f..1f2c1e558 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch @@ -1,98 +1,14 @@ --- a/net/minecraft/world/gen/feature/template/Template.java +++ b/net/minecraft/world/gen/feature/template/Template.java -@@ -152,6 +152,11 @@ - return func_207669_a(p_186266_1_, p_186266_0_.func_186212_b(), p_186266_0_.func_186215_c(), p_186266_0_.func_207664_d()); +@@ -422,6 +422,11 @@ + } } -+ // FORGE: Add overload accepting Vec3d -+ public static Vec3d transformedVec3d(PlacementSettings p_186266_0_, Vec3d p_186266_1_) { -+ return func_207667_a(p_186266_1_, p_186266_0_.func_186212_b(), p_186266_0_.func_186215_c(), p_186266_0_.func_207664_d()); -+ } ++ // FORGE: Add overload accepting Vec3d ++ public static Vector3d transformedVec3d(PlacementSettings placementIn, Vector3d pos) { ++ return func_207667_a(pos, placementIn.func_186212_b(), placementIn.func_186215_c(), placementIn.func_207664_d()); ++ } + - public void func_186260_a(IWorld p_186260_1_, BlockPos p_186260_2_, PlacementSettings p_186260_3_) { - p_186260_3_.func_186224_i(); - this.func_186253_b(p_186260_1_, p_186260_2_, p_186260_3_); -@@ -177,7 +182,7 @@ - int i1 = Integer.MIN_VALUE; - int j1 = Integer.MIN_VALUE; - -- for(Template.BlockInfo template$blockinfo : func_215387_a(p_189962_1_, p_189962_2_, p_189962_3_, list)) { -+ for(Template.BlockInfo template$blockinfo : processBlockInfos(this, p_189962_1_, p_189962_2_, p_189962_3_, list)) { - BlockPos blockpos = template$blockinfo.field_186242_a; - if (mutableboundingbox == null || mutableboundingbox.func_175898_b(blockpos)) { - IFluidState ifluidstate = p_189962_3_.func_204763_l() ? p_189962_1_.func_204610_c(blockpos) : null; -@@ -288,7 +293,7 @@ - } - - if (!p_189962_3_.func_186221_e()) { -- this.func_207668_a(p_189962_1_, p_189962_2_, p_189962_3_.func_186212_b(), p_189962_3_.func_186215_c(), p_189962_3_.func_207664_d(), mutableboundingbox); -+ this.addEntitiesToWorld(p_189962_1_, p_189962_2_, p_189962_3_, p_189962_3_.func_186212_b(), p_189962_3_.func_186215_c(), p_189962_3_.func_207664_d(), p_189962_3_.func_186213_g()); - } - - return true; -@@ -317,14 +322,19 @@ - }); - } - -+ @Deprecated // FORGE: Add template parameter - public static List func_215387_a(IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List p_215387_3_) { -+ return processBlockInfos(null, p_215387_0_, p_215387_1_, p_215387_2_, p_215387_3_); -+ } -+ -+ public static List processBlockInfos(@Nullable Template template, IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List p_215387_3_) { - List list = Lists.newArrayList(); - - for(Template.BlockInfo template$blockinfo : p_215387_3_) { - BlockPos blockpos = func_186266_a(p_215387_2_, template$blockinfo.field_186242_a).func_177971_a(p_215387_1_); - Template.BlockInfo template$blockinfo1 = new Template.BlockInfo(blockpos, template$blockinfo.field_186243_b, template$blockinfo.field_186244_c); - -- for(Iterator iterator = p_215387_2_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().func_215194_a(p_215387_0_, p_215387_1_, template$blockinfo, template$blockinfo1, p_215387_2_)) { -+ for(Iterator iterator = p_215387_2_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().process(p_215387_0_, p_215387_1_, template$blockinfo, template$blockinfo1, p_215387_2_, template)) { - ; - } - -@@ -336,13 +346,42 @@ - return list; - } - -+ // FORGE: Add processing for entities -+ public static List processEntityInfos(@Nullable Template template, IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List p_215387_3_) { -+ List list = Lists.newArrayList(); -+ -+ for(Template.EntityInfo entityInfo : p_215387_3_) { -+ Vec3d pos = transformedVec3d(p_215387_2_, entityInfo.field_186247_a).func_178787_e(new Vec3d(p_215387_1_)); -+ BlockPos blockpos = func_186266_a(p_215387_2_, entityInfo.field_186248_b).func_177971_a(p_215387_1_); -+ Template.EntityInfo info = new Template.EntityInfo(pos, blockpos, entityInfo.field_186249_c); -+ -+ for (StructureProcessor proc : p_215387_2_.func_215221_j()) { -+ info = proc.processEntity(p_215387_0_, p_215387_1_, entityInfo, info, p_215387_2_, template); -+ if (info == null) -+ break; -+ } -+ -+ if (info != null) -+ list.add(info); -+ } -+ -+ return list; -+ } -+ -+ @Deprecated // FORGE: Add PlacementSettings parameter (below) to pass to entity processors - private void func_207668_a(IWorld p_207668_1_, BlockPos p_207668_2_, Mirror p_207668_3_, Rotation p_207668_4_, BlockPos p_207668_5_, @Nullable MutableBoundingBox p_207668_6_) { -- for(Template.EntityInfo template$entityinfo : this.field_186271_b) { -+ addEntitiesToWorld(p_207668_1_, p_207668_2_, new PlacementSettings().func_186214_a(p_207668_3_).func_186220_a(p_207668_4_).func_207665_a(p_207668_5_).func_186223_a(p_207668_6_), p_207668_3_, p_207668_4_, p_207668_2_, p_207668_6_); -+ } -+ -+ private void addEntitiesToWorld(IWorld p_207668_1_, BlockPos p_207668_2_, PlacementSettings placementIn, Mirror p_207668_3_, Rotation p_207668_4_, BlockPos p_207668_5_, @Nullable MutableBoundingBox p_207668_6_) { -+ for(Template.EntityInfo template$entityinfo : processEntityInfos(this, p_207668_1_, p_207668_2_, placementIn, this.field_186271_b)) { - BlockPos blockpos = func_207669_a(template$entityinfo.field_186248_b, p_207668_3_, p_207668_4_, p_207668_5_).func_177971_a(p_207668_2_); -+ blockpos = template$entityinfo.field_186248_b; // FORGE: Position will have already been transformed by processEntityInfos - if (p_207668_6_ == null || p_207668_6_.func_175898_b(blockpos)) { - CompoundNBT compoundnbt = template$entityinfo.field_186249_c; - Vec3d vec3d = func_207667_a(template$entityinfo.field_186247_a, p_207668_3_, p_207668_4_, p_207668_5_); -- Vec3d vec3d1 = vec3d.func_72441_c((double)p_207668_2_.func_177958_n(), (double)p_207668_2_.func_177956_o(), (double)p_207668_2_.func_177952_p()); -+ vec3d = vec3d.func_72441_c((double)p_207668_2_.func_177958_n(), (double)p_207668_2_.func_177956_o(), (double)p_207668_2_.func_177952_p()); -+ Vec3d vec3d1 = template$entityinfo.field_186247_a; // FORGE: Position will have already been transformed by processEntityInfos - ListNBT listnbt = new ListNBT(); - listnbt.add(DoubleNBT.func_229684_a_(vec3d1.field_72450_a)); - listnbt.add(DoubleNBT.func_229684_a_(vec3d1.field_72448_b)); + public static BlockPos func_207669_a(BlockPos p_207669_0_, Mirror p_207669_1_, Rotation p_207669_2_, BlockPos p_207669_3_) { + int i = p_207669_0_.func_177958_n(); + int j = p_207669_0_.func_177956_o(); diff --git a/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch b/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch index 9a9f7fec2..c7ab70c07 100644 --- a/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java +++ b/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java -@@ -4,7 +4,7 @@ - import java.util.function.Function; +@@ -3,7 +3,7 @@ + import com.mojang.serialization.Codec; import net.minecraft.util.registry.Registry; -public class FoliagePlacerType

{ +public class FoliagePlacerType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final FoliagePlacerType field_227386_a_ = func_227392_a_("blob_foliage_placer", BlobFoliagePlacer::new); - public static final FoliagePlacerType field_227387_b_ = func_227392_a_("spruce_foliage_placer", SpruceFoliagePlacer::new); - public static final FoliagePlacerType field_227388_c_ = func_227392_a_("pine_foliage_placer", PineFoliagePlacer::new); + public static final FoliagePlacerType field_227386_a_ = func_236773_a_("blob_foliage_placer", BlobFoliagePlacer.field_236738_a_); + public static final FoliagePlacerType field_227387_b_ = func_236773_a_("spruce_foliage_placer", SpruceFoliagePlacer.field_236790_a_); + public static final FoliagePlacerType field_227388_c_ = func_236773_a_("pine_foliage_placer", PineFoliagePlacer.field_236784_a_); diff --git a/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch index eb589b5eb..ae7e64259 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch @@ -1,79 +1,47 @@ --- a/net/minecraft/world/gen/layer/BiomeLayer.java +++ b/net/minecraft/world/gen/layer/BiomeLayer.java -@@ -23,17 +23,33 @@ - private static final int field_202740_n = Registry.field_212624_m.func_148757_b(Biomes.field_76780_h); - private static final int field_202741_o = Registry.field_212624_m.func_148757_b(Biomes.field_76768_g); - private static final int field_202742_p = Registry.field_212624_m.func_148757_b(Biomes.field_150584_S); -- private static final int[] field_202743_q = new int[]{field_202728_b, field_202730_d, field_202729_c, field_202740_n, field_202736_j, field_202741_o}; -- private static final int[] field_202744_r = new int[]{field_202728_b, field_202728_b, field_202728_b, field_202739_m, field_202739_m, field_202736_j}; -- private static final int[] field_202745_s = new int[]{field_202730_d, field_202738_l, field_202729_c, field_202736_j, field_202727_a, field_202740_n}; -- private static final int[] field_202746_t = new int[]{field_202730_d, field_202729_c, field_202741_o, field_202736_j}; -- private static final int[] field_202747_u = new int[]{field_202731_e, field_202731_e, field_202731_e, field_202742_p}; - private final int field_227472_v_; -- private int[] field_151623_c = field_202744_r; -+ @SuppressWarnings("unchecked") -+ private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; +@@ -5,6 +5,8 @@ + import net.minecraft.world.gen.INoiseRandom; + import net.minecraft.world.gen.layer.traits.IC0Transformer; - public BiomeLayer(WorldType p_i225882_1_, int p_i225882_2_) { -+ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) { -+ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); -+ int idx = type.ordinal(); ++import java.util.Collections; + -+ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); -+ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); -+ } -+ -+ int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal(); -+ -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76769_d, 30)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_150588_X, 20)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76772_c, 10)); -+ - if (p_i225882_1_ == WorldType.field_77136_e) { -- this.field_151623_c = field_202743_q; -+ biomes[desertIdx].clear(); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76769_d, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76767_f, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76770_e, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76780_h, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76772_c, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76768_g, 10)); - this.field_227472_v_ = -1; - } else { - this.field_227472_v_ = p_i225882_2_; -@@ -54,21 +70,21 @@ - return p_202726_1_.func_202696_a(3) == 0 ? field_202733_g : field_202734_h; - } - -- return this.field_151623_c[p_202726_1_.func_202696_a(this.field_151623_c.length)]; -+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT, p_202726_1_).biome); - case 2: - if (i > 0) { - return field_202732_f; - } - -- return field_202745_s[p_202726_1_.func_202696_a(field_202745_s.length)]; -+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM, p_202726_1_).biome); - case 3: - if (i > 0) { - return field_202737_k; - } - -- return field_202746_t[p_202726_1_.func_202696_a(field_202746_t.length)]; -+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL, p_202726_1_).biome); - case 4: -- return field_202747_u[p_202726_1_.func_202696_a(field_202747_u.length)]; -+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY, p_202726_1_).biome); - default: - return field_202735_i; + public class BiomeLayer implements IC0Transformer { + private static final int field_202727_a = Registry.field_212624_m.func_148757_b(Biomes.field_150583_P); + private static final int field_202728_b = Registry.field_212624_m.func_148757_b(Biomes.field_76769_d); +@@ -46,21 +48,21 @@ + return p_202726_1_.func_202696_a(3) == 0 ? field_202733_g : field_202734_h; } -@@ -77,4 +93,11 @@ + +- return this.field_151623_c[p_202726_1_.func_202696_a(this.field_151623_c.length)]; ++ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT, p_202726_1_).biome); + case 2: + if (i > 0) { + return field_202732_f; + } + +- return field_202745_s[p_202726_1_.func_202696_a(field_202745_s.length)]; ++ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM, p_202726_1_).biome); + case 3: + if (i > 0) { + return field_202737_k; + } + +- return field_202746_t[p_202726_1_.func_202696_a(field_202746_t.length)]; ++ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL, p_202726_1_).biome); + case 4: +- return field_202747_u[p_202726_1_.func_202696_a(field_202747_u.length)]; ++ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY, p_202726_1_).biome); + default: + return field_202735_i; } +@@ -68,4 +70,11 @@ + return p_202726_2_; } } + + protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) { -+ java.util.List biomeList = biomes[type.ordinal()]; ++ java.util.List biomeList = Collections.emptyList(); //biomes[type.ordinal()]; //TODO WorldType stuff, + int totalWeight = net.minecraft.util.WeightedRandom.func_76272_a(biomeList); + int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?context.func_202696_a(totalWeight):context.func_202696_a(totalWeight / 10) * 10; + return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.func_180166_a(biomeList, weight); diff --git a/patches/minecraft/net/minecraft/world/gen/placement/Placement.java.patch b/patches/minecraft/net/minecraft/world/gen/placement/Placement.java.patch index edab9e71e..a21057921 100644 --- a/patches/minecraft/net/minecraft/world/gen/placement/Placement.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/placement/Placement.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/placement/Placement.java +++ b/net/minecraft/world/gen/placement/Placement.java @@ -14,7 +14,7 @@ - import net.minecraft.world.gen.feature.Feature; - import net.minecraft.world.gen.feature.IFeatureConfig; + import net.minecraft.world.gen.feature.structure.StructureManager; + import org.apache.commons.lang3.mutable.MutableBoolean; -public abstract class Placement { +public abstract class Placement extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final Placement field_215022_h = func_214999_a("nope", new Passthrough(NoPlacementConfig::func_214735_a)); - public static final Placement field_215015_a = func_214999_a("count_heightmap", new AtSurface(FrequencyConfig::func_214721_a)); - public static final Placement field_215016_b = func_214999_a("count_top_solid", new TopSolid(FrequencyConfig::func_214721_a)); + public static final Placement field_215022_h = func_214999_a("nope", new Passthrough(NoPlacementConfig.field_236555_a_)); + public static final Placement field_215015_a = func_214999_a("count_heightmap", new AtSurface(FrequencyConfig.field_236971_a_)); + public static final Placement field_215016_b = func_214999_a("count_top_solid", new TopSolid(FrequencyConfig.field_236971_a_)); diff --git a/patches/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch b/patches/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch index ffdafae25..07e246ef8 100644 --- a/patches/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java +++ b/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java -@@ -9,7 +9,7 @@ +@@ -8,7 +8,7 @@ import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.IChunk; diff --git a/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch b/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch index c74c4f65f..a8d1990bd 100644 --- a/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java +++ b/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java -@@ -4,7 +4,7 @@ - import java.util.function.Function; +@@ -3,7 +3,7 @@ + import com.mojang.serialization.Codec; import net.minecraft.util.registry.Registry; -public class TreeDecoratorType

{ +public class TreeDecoratorType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final TreeDecoratorType field_227425_a_ = func_227432_a_("trunk_vine", TrunkVineTreeDecorator::new); - public static final TreeDecoratorType field_227426_b_ = func_227432_a_("leave_vine", LeaveVineTreeDecorator::new); - public static final TreeDecoratorType field_227427_c_ = func_227432_a_("cocoa", CocoaTreeDecorator::new); + public static final TreeDecoratorType field_227425_a_ = func_236877_a_("trunk_vine", TrunkVineTreeDecorator.field_236878_a_); + public static final TreeDecoratorType field_227426_b_ = func_236877_a_("leave_vine", LeaveVineTreeDecorator.field_236870_a_); + public static final TreeDecoratorType field_227427_c_ = func_236877_a_("cocoa", CocoaTreeDecorator.field_236866_a_); diff --git a/patches/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch b/patches/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch index 225b637dd..1d8f9d7ff 100644 --- a/patches/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch +++ b/patches/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/lighting/SkyLightEngine.java +++ b/net/minecraft/world/lighting/SkyLightEngine.java -@@ -229,4 +229,11 @@ +@@ -228,4 +228,11 @@ public String func_215614_b(long p_215614_1_) { return super.func_215614_b(p_215614_1_) + (this.field_215627_c.func_215549_m(p_215614_1_) ? "*" : ""); } diff --git a/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch b/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch index c0e084527..3d9ba7ef4 100644 --- a/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/server/ChunkHolder.java +++ b/net/minecraft/world/server/ChunkHolder.java -@@ -136,7 +136,7 @@ +@@ -135,7 +135,7 @@ Chunk chunk = this.func_219298_c(); if (chunk != null) { - this.field_219322_q |= 1 << (p_219279_2_ >> 4); + this.field_219322_q |= 1 << (p_241812_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_); + short short1 = (short)(p_241812_1_ << 12 | p_241812_3_ << 8 | p_241812_2_); for(int i = 0; i < this.field_219321_p; ++i) { -@@ -145,6 +145,8 @@ +@@ -144,6 +144,8 @@ } } @@ -18,36 +18,3 @@ this.field_219320_o[this.field_219321_p++] = short1; } -@@ -167,7 +169,7 @@ - public void func_219274_a(Chunk p_219274_1_) { - if (this.field_219321_p != 0 || this.field_219325_t != 0 || this.field_219324_s != 0) { - World world = p_219274_1_.func_177412_p(); -- if (this.field_219321_p == 64) { -+ if (this.field_219321_p >= net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get()) { - this.field_219323_r = -1; - } - -@@ -190,20 +192,19 @@ - int k = (this.field_219320_o[0] >> 8 & 15) + this.field_219319_n.field_77275_b * 16; - BlockPos blockpos = new BlockPos(l, j1, k); - this.func_219293_a(new SChangeBlockPacket(world, blockpos), false); -- if (world.func_180495_p(blockpos).func_177230_c().func_149716_u()) { -+ if (world.func_180495_p(blockpos).hasTileEntity()) { - this.func_219305_a(world, blockpos); - } -- } else if (this.field_219321_p == 64) { -+ } else if (this.field_219321_p >= net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get()) { - this.func_219293_a(new SChunkDataPacket(p_219274_1_, this.field_219322_q), false); - } else if (this.field_219321_p != 0) { - this.func_219293_a(new SMultiBlockChangePacket(this.field_219321_p, this.field_219320_o, p_219274_1_), false); -- - for(int i1 = 0; i1 < this.field_219321_p; ++i1) { - int k1 = (this.field_219320_o[i1] >> 12 & 15) + this.field_219319_n.field_77276_a * 16; - int l1 = this.field_219320_o[i1] & 255; - int i2 = (this.field_219320_o[i1] >> 8 & 15) + this.field_219319_n.field_77275_b * 16; - BlockPos blockpos1 = new BlockPos(k1, l1, i2); -- if (world.func_180495_p(blockpos1).func_177230_c().func_149716_u()) { -+ if (world.func_180495_p(blockpos1).hasTileEntity()) { - this.func_219305_a(world, blockpos1); - } - } diff --git a/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch b/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch index e733b34c5..ec6050d5b 100644 --- a/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch @@ -1,14 +1,6 @@ --- a/net/minecraft/world/server/ChunkManager.java +++ b/net/minecraft/world/server/ChunkManager.java -@@ -368,6 +368,7 @@ - iprofiler.func_219895_b("chunk_unload"); - if (!this.field_219255_i.func_217402_u()) { - this.func_223155_b(p_219204_1_); -+ if (this.field_219251_e.isEmpty()) net.minecraftforge.common.DimensionManager.unloadWorld(this.field_219255_i); - } - - iprofiler.func_76319_b(); -@@ -404,6 +405,7 @@ +@@ -406,6 +406,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); @@ -16,7 +8,7 @@ } this.func_219229_a(p_219185_5_); -@@ -594,6 +596,7 @@ +@@ -607,6 +608,7 @@ if (list != null) { list.forEach(chunk::func_76622_b); } @@ -24,15 +16,15 @@ } return chunk; -@@ -679,6 +682,7 @@ +@@ -684,6 +686,7 @@ this.field_219255_i.func_217381_Z().func_230035_c_("chunkSave"); - 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_, p_219229_1_.getWorldForge() != null ? p_219229_1_.getWorldForge() : this.field_219255_i, compoundnbt1)); - this.func_219100_a(chunkpos, compoundnbt1); + CompoundNBT compoundnbt = 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_, p_219229_1_.getWorldForge() != null ? p_219229_1_.getWorldForge() : this.field_219255_i, compoundnbt)); + this.func_219100_a(chunkpos, compoundnbt); + this.func_241088_a_(chunkpos, chunkstatus.func_202129_d()); return true; - } catch (Exception exception) { -@@ -711,6 +715,7 @@ +@@ -740,6 +743,7 @@ protected void func_219199_a(ServerPlayerEntity p_219199_1_, ChunkPos p_219199_2_, IPacket[] p_219199_3_, boolean p_219199_4_, boolean p_219199_5_) { if (p_219199_1_.field_70170_p == this.field_219255_i) { diff --git a/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch b/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch index b56797eb3..f010fd36b 100644 --- a/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch @@ -1,55 +1,33 @@ --- a/net/minecraft/world/server/ServerWorld.java +++ b/net/minecraft/world/server/ServerWorld.java -@@ -137,7 +137,7 @@ +@@ -136,7 +136,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 { +-public class ServerWorld extends World implements ISeedReader { ++public class ServerWorld extends World implements ISeedReader, net.minecraftforge.common.extensions.IForgeWorldServer { + public static final BlockPos field_241108_a_ = new BlockPos(100, 50, 0); 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<>(); -@@ -163,10 +163,13 @@ - private boolean field_211159_Q; - @Nullable - private final WanderingTraderSpawner field_217496_L; -+ /** Stores the recently processed (lighting) chunks */ -+ protected java.util.Set doneChunks = Sets.newHashSet(); +@@ -166,6 +166,7 @@ + private final DragonFightManager field_241105_O_; + private final StructureManager field_241106_P_; + private final boolean field_241107_Q_; + private net.minecraftforge.common.util.WorldCapabilityData capabilityData; - public ServerWorld(MinecraftServer p_i50703_1_, Executor p_i50703_2_, SaveHandler p_i50703_3_, WorldInfo p_i50703_4_, DimensionType p_i50703_5_, IProfiler p_i50703_6_, IChunkStatusListener p_i50703_7_) { - super(p_i50703_4_, p_i50703_5_, (p_217442_4_, p_217442_5_) -> { -- return new ServerChunkProvider((ServerWorld)p_217442_4_, p_i50703_3_.func_75765_b(), p_i50703_3_.func_197718_i(), p_i50703_3_.func_186340_h(), p_i50703_2_, p_217442_5_.func_186060_c(), p_i50703_1_.func_184103_al().func_72395_o(), p_i50703_7_, () -> { -+ return new ServerChunkProvider((ServerWorld)p_217442_4_, p_i50703_3_.func_75765_b(), p_i50703_3_.func_197718_i(), p_i50703_3_.func_186340_h(), p_i50703_2_, p_217442_4_.func_175624_G().createChunkGenerator(p_217442_4_), p_i50703_1_.func_184103_al().func_72395_o(), p_i50703_7_, () -> { - return p_i50703_1_.func_71218_a(DimensionType.field_223227_a_).func_217481_x(); - }); - }, p_i50703_6_, false); -@@ -184,6 +187,7 @@ + public ServerWorld(MinecraftServer p_i232604_1_, Executor p_i232604_2_, SaveFormat.LevelSave p_i232604_3_, IServerWorldInfo p_i232604_4_, RegistryKey p_i232604_5_, RegistryKey p_i232604_6_, DimensionType p_i232604_7_, IChunkStatusListener p_i232604_8_, ChunkGenerator p_i232604_9_, boolean p_i232604_10_, long p_i232604_11_, List p_i232604_13_, boolean p_i232604_14_) { + super(p_i232604_4_, p_i232604_5_, p_i232604_6_, p_i232604_7_, p_i232604_1_::func_213185_aS, false, p_i232604_10_, p_i232604_11_); +@@ -193,7 +194,7 @@ + } else { + this.field_241105_O_ = null; } - - this.field_217496_L = this.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ ? new WanderingTraderSpawner(this) : null; +- + this.initCapabilities(); } - public Biome func_225604_a_(int p_225604_1_, int p_225604_2_, int p_225604_3_) { -@@ -197,6 +201,7 @@ - this.func_175723_af().func_212673_r(); - iprofiler.func_219895_b("weather"); - boolean flag = this.func_72896_J(); -+ this.field_73011_w.updateWeather(() -> { - if (this.field_73011_w.func_191066_m()) { - if (this.func_82736_K().func_223586_b(GameRules.field_223617_t)) { - int i = this.field_72986_A.func_176133_A(); -@@ -258,6 +263,7 @@ - - this.field_73004_o = MathHelper.func_76131_a(this.field_73004_o, 0.0F, 1.0F); - } -+ }); //Forge: End weatherTick delegate - - if (this.field_73003_n != this.field_73004_o) { - this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(7, this.field_73004_o), this.field_73011_w.func_186058_p()); -@@ -267,15 +273,19 @@ - this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(8, this.field_73017_q), this.field_73011_w.func_186058_p()); + public void func_241113_a_(int p_241113_1_, int p_241113_2_, boolean p_241113_3_, boolean p_241113_4_) { +@@ -289,15 +290,19 @@ + this.field_73061_a.func_184103_al().func_232642_a_(new SChangeGameStatePacket(SChangeGameStatePacket.field_241772_i_, this.field_73017_q), this.func_234923_W_()); } + /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, @@ -58,63 +36,55 @@ + */ 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()); +- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(SChangeGameStatePacket.field_241766_c_, 0.0F)); ++ this.field_73061_a.func_184103_al().func_232642_a_(new SChangeGameStatePacket(SChangeGameStatePacket.field_241766_c_, 0.0F), this.func_234923_W_()); } 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(SChangeGameStatePacket.field_241765_b_, 0.0F)); ++ this.field_73061_a.func_184103_al().func_232642_a_(new SChangeGameStatePacket(SChangeGameStatePacket.field_241765_b_, 0.0F), this.func_234923_W_()); } -- 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()); +- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(SChangeGameStatePacket.field_241771_h_, this.field_73004_o)); +- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(SChangeGameStatePacket.field_241772_i_, this.field_73017_q)); ++ this.field_73061_a.func_184103_al().func_232642_a_(new SChangeGameStatePacket(SChangeGameStatePacket.field_241771_h_, this.field_73004_o), this.func_234923_W_()); ++ this.field_73061_a.func_184103_al().func_232642_a_(new SChangeGameStatePacket(SChangeGameStatePacket.field_241772_i_, this.field_73017_q), this.func_234923_W_()); } - if (this.func_72912_H().func_76093_s() && this.func_175659_aa() != Difficulty.HARD) { -@@ -287,8 +297,8 @@ + if (this.field_73068_P && this.field_217491_A.stream().noneMatch((p_241132_0_) -> { +@@ -305,8 +310,8 @@ })) { this.field_73068_P = false; if (this.func_82736_K().func_223586_b(GameRules.field_223607_j)) { - long l = this.field_72986_A.func_76073_f() + 24000L; -- this.func_72877_b(l - l % 24000L); +- this.func_241114_a_(l - l % 24000L); + long l = this.func_72820_D() + 24000L; -+ this.func_72877_b(net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, l - l % 24000L, this.func_72820_D())); ++ this.func_241114_a_(net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, l - l % 24000L, this.func_72820_D())); } this.func_229856_ab_(); -@@ -330,6 +340,7 @@ - Entity entity = this.field_217497_w.get(i1); - this.func_217390_a((p_229858_0_) -> { - ++p_229858_0_.field_70173_aa; -+ if (p_229858_0_.canUpdate()) - p_229858_0_.func_70071_h_(); - }, entity); - if (entity.field_70128_L) { -@@ -395,7 +406,7 @@ - if (entity2.field_70128_L) { - this.func_217454_n(entity2); +@@ -397,7 +402,7 @@ + if (entity1.field_70128_L) { + this.func_217454_n(entity1); objectiterator.remove(); -- this.func_217484_g(entity2); -+ this.removeEntityComplete(entity2, entity2 instanceof ServerPlayerEntity); //Forge: Keep cap data until revive. Every other entity removes directly. +- this.func_217484_g(entity1); ++ this.removeEntityComplete(entity1, entity1 instanceof ServerPlayerEntity); //Forge: Keep cap data until revive. Every other entity removes directly. } iprofiler.func_76319_b(); -@@ -418,7 +429,7 @@ +@@ -443,7 +448,7 @@ int j = chunkpos.func_180333_d(); IProfiler iprofiler = this.func_217381_Z(); iprofiler.func_76320_a("thunder"); - if (flag && this.func_72911_I() && this.field_73012_v.nextInt(100000) == 0) { -+ if (this.field_73011_w.canDoLightning(p_217441_1_) && flag && this.func_72911_I() && this.field_73012_v.nextInt(100000) == 0) { ++ if (/*TODO this.dimension.canDoLightning(chunkIn) &&*/ flag && this.func_72911_I() && this.field_73012_v.nextInt(100000) == 0) { BlockPos blockpos = this.func_175736_a(this.func_217383_a(i, 0, j, 15)); if (this.func_175727_C(blockpos)) { DifficultyInstance difficultyinstance = this.func_175649_E(blockpos); -@@ -436,10 +447,11 @@ +@@ -464,10 +469,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) { ++ if (/*TODO this.dimension.canDoRainSnowIce(chunkIn) &&*/ this.field_73012_v.nextInt(16) == 0) { BlockPos blockpos2 = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, this.func_217383_a(i, 0, j, 15)); BlockPos blockpos3 = blockpos2.func_177977_b(); Biome biome = this.func_226691_t_(blockpos2); @@ -122,28 +92,7 @@ if (biome.func_201848_a(this, blockpos3)) { this.func_175656_a(blockpos3, Blocks.field_150432_aD.func_176223_P()); } -@@ -526,10 +538,7 @@ - } - - private void func_73051_P() { -- this.field_72986_A.func_76080_g(0); -- this.field_72986_A.func_76084_b(false); -- this.field_72986_A.func_76090_f(0); -- this.field_72986_A.func_76069_a(false); -+ this.field_73011_w.resetRainAndThunder(); - } - - @OnlyIn(Dist.CLIENT) -@@ -542,7 +551,7 @@ - int j = this.field_72986_A.func_76074_e(); - int k = 0; - -- while(this.func_184141_c(new BlockPos(i, 0, j)).func_196958_f()) { -+ while(this.func_184141_c(new BlockPos(i, 0, j)).isAir(this, new BlockPos(i, 0, j))) { - i += this.field_73012_v.nextInt(8) - this.field_73012_v.nextInt(8); - j += this.field_73012_v.nextInt(8) - this.field_73012_v.nextInt(8); - ++k; -@@ -584,8 +593,9 @@ +@@ -591,8 +597,9 @@ ++p_217479_1_.field_70173_aa; IProfiler iprofiler = this.func_217381_Z(); iprofiler.func_194340_a(() -> { @@ -154,27 +103,7 @@ iprofiler.func_230035_c_("tickNonPassenger"); p_217479_1_.func_70071_h_(); iprofiler.func_76319_b(); -@@ -652,6 +662,11 @@ - } - - public boolean func_175660_a(PlayerEntity p_175660_1_, BlockPos p_175660_2_) { -+ return super.func_175660_a(p_175660_1_, p_175660_2_); -+ } -+ -+ @Override -+ public boolean canMineBlockBody(PlayerEntity p_175660_1_, BlockPos p_175660_2_) { - return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_); - } - -@@ -661,6 +676,7 @@ - } else if (this.field_72986_A.func_76067_t() == WorldType.field_180272_g) { - this.field_72986_A.func_176143_a(BlockPos.field_177992_a.func_177984_a()); - } else { -+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; - BiomeProvider biomeprovider = this.func_72863_F().func_201711_g().func_202090_b(); - List list = biomeprovider.func_76932_a(); - Random random = new Random(this.func_72905_C()); -@@ -734,6 +750,7 @@ +@@ -680,6 +687,7 @@ p_217445_1_.func_200209_c(new TranslationTextComponent("menu.savingChunks")); } @@ -182,16 +111,7 @@ serverchunkprovider.func_217210_a(p_217445_2_); } } -@@ -809,7 +826,7 @@ - } - } - -- EntityClassification entityclassification = entity.func_200600_R().func_220339_d(); -+ EntityClassification entityclassification = entity.getClassification(true); - if (entityclassification != EntityClassification.MISC && this.func_72863_F().func_223435_b(entity)) { - object2intmap.mergeInt(entityclassification, 1, Integer::sum); - } -@@ -851,6 +868,7 @@ +@@ -770,6 +778,7 @@ } private void func_217448_f(ServerPlayerEntity p_217448_1_) { @@ -199,7 +119,7 @@ Entity entity = this.field_175741_N.get(p_217448_1_.func_110124_au()); if (entity != null) { field_147491_a.warn("Force-added player with duplicate UUID {}", (Object)p_217448_1_.func_110124_au().toString()); -@@ -875,6 +893,7 @@ +@@ -794,6 +803,7 @@ } else if (this.func_217478_l(p_72838_1_)) { return false; } else { @@ -207,7 +127,7 @@ IChunk ichunk = this.func_217353_a(MathHelper.func_76128_c(p_72838_1_.func_226277_ct_() / 16.0D), MathHelper.func_76128_c(p_72838_1_.func_226281_cx_() / 16.0D), ChunkStatus.field_222617_m, p_72838_1_.field_98038_p); if (!(ichunk instanceof Chunk)) { return false; -@@ -890,6 +909,7 @@ +@@ -809,6 +819,7 @@ if (this.func_217478_l(p_217440_1_)) { return false; } else { @@ -215,7 +135,7 @@ this.func_217465_m(p_217440_1_); return true; } -@@ -925,12 +945,17 @@ +@@ -844,12 +855,17 @@ } @@ -234,7 +154,7 @@ this.field_175741_N.remove(p_217484_1_.func_110124_au()); this.func_72863_F().func_217226_b(p_217484_1_); -@@ -944,6 +969,7 @@ +@@ -863,6 +879,7 @@ this.field_217495_I.remove(((MobEntity)p_217484_1_).func_70661_as()); } @@ -242,7 +162,7 @@ } private void func_217465_m(Entity p_217465_1_) { -@@ -964,15 +990,19 @@ +@@ -883,15 +900,19 @@ } } @@ -263,7 +183,7 @@ } } -@@ -985,8 +1015,11 @@ +@@ -904,8 +925,11 @@ } public void func_217434_e(ServerPlayerEntity p_217434_1_) { @@ -277,7 +197,7 @@ this.func_72854_c(); } -@@ -1010,10 +1043,20 @@ +@@ -924,10 +948,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_) { @@ -286,7 +206,7 @@ + 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_)); + 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.func_234923_W_(), 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_) { @@ -295,27 +215,27 @@ + p_217384_3_ = event.getSound(); + p_217384_4_ = event.getCategory(); + p_217384_5_ = event.getVolume(); - this.field_73061_a.func_184103_al().func_148543_a(p_217384_1_, p_217384_2_.func_226277_ct_(), p_217384_2_.func_226278_cu_(), p_217384_2_.func_226281_cx_(), p_217384_5_ > 1.0F ? (double)(16.0F * p_217384_5_) : 16.0D, this.field_73011_w.func_186058_p(), new SSpawnMovingSoundEffectPacket(p_217384_3_, p_217384_4_, p_217384_2_, p_217384_5_, p_217384_6_)); + this.field_73061_a.func_184103_al().func_148543_a(p_217384_1_, p_217384_2_.func_226277_ct_(), p_217384_2_.func_226278_cu_(), p_217384_2_.func_226281_cx_(), p_217384_5_ > 1.0F ? (double)(16.0F * p_217384_5_) : 16.0D, this.func_234923_W_(), new SSpawnMovingSoundEffectPacket(p_217384_3_, p_217384_4_, p_217384_2_, p_217384_5_, p_217384_6_)); } -@@ -1049,6 +1092,7 @@ +@@ -963,6 +997,7 @@ - public Explosion func_217401_a(@Nullable Entity p_217401_1_, @Nullable DamageSource p_217401_2_, double p_217401_3_, double p_217401_5_, double p_217401_7_, float p_217401_9_, boolean p_217401_10_, Explosion.Mode p_217401_11_) { - Explosion explosion = new Explosion(this, p_217401_1_, p_217401_3_, p_217401_5_, p_217401_7_, p_217401_9_, p_217401_10_, p_217401_11_); + public Explosion func_230546_a_(@Nullable Entity p_230546_1_, @Nullable DamageSource p_230546_2_, @Nullable IExplosionContext p_230546_3_, double p_230546_4_, double p_230546_6_, double p_230546_8_, float p_230546_10_, boolean p_230546_11_, Explosion.Mode p_230546_12_) { + Explosion explosion = new Explosion(this, p_230546_1_, p_230546_2_, p_230546_3_, p_230546_4_, p_230546_6_, p_230546_8_, p_230546_10_, p_230546_11_, p_230546_12_); + if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - if (p_217401_2_ != null) { - explosion.func_199592_a(p_217401_2_); - } -@@ -1377,4 +1421,15 @@ - return p_229854_1_.func_175898_b(p_229855_1_.func_180328_a()); + explosion.func_77278_a(); + explosion.func_77279_a(false); + if (p_230546_12_ == Explosion.Mode.NONE) { +@@ -1331,4 +1366,15 @@ + p_241121_0_.func_175656_a(p_241122_1_, Blocks.field_150343_Z.func_176223_P()); }); } + + protected void initCapabilities() { -+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities(); ++ net.minecraftforge.common.capabilities.ICapabilityProvider parent = null;//TODO dimension.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()); ++ capabilityData.setCapabilities(getCapabilities()); + } + + public java.util.stream.Stream getEntities() { diff --git a/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch index b47f9db64..9377123cf 100644 --- a/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch @@ -11,7 +11,7 @@ if (this.field_98282_f.func_185277_b().func_186856_d() == 1 && this.field_98282_f.func_185277_b().func_150297_b("id", 8)) { + if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, world, (float)entity.func_226277_ct_(), (float)entity.func_226278_cu_(), (float)entity.func_226281_cx_(), this, SpawnReason.SPAWNER)) - ((MobEntity)entity).func_213386_a(world, world.func_175649_E(new BlockPos(entity)), SpawnReason.SPAWNER, (ILivingEntityData)null, (CompoundNBT)null); + ((MobEntity)entity).func_213386_a(world, world.func_175649_E(entity.func_233580_cy_()), SpawnReason.SPAWNER, (ILivingEntityData)null, (CompoundNBT)null); } } @@ -285,4 +286,9 @@ diff --git a/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch index 4cba4b399..d31e9d33b 100644 --- a/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch @@ -1,62 +1,15 @@ --- a/net/minecraft/world/spawner/WorldEntitySpawner.java +++ b/net/minecraft/world/spawner/WorldEntitySpawner.java -@@ -87,7 +87,7 @@ - } +@@ -83,7 +83,7 @@ + } - if (biome$spawnlistentry == null) { -- biome$spawnlistentry = func_222264_a(chunkgenerator, p_226701_0_, p_226701_1_.field_73012_v, blockpos$mutable); -+ biome$spawnlistentry = getSpawnList(chunkgenerator, p_226701_0_, p_226701_1_.field_73012_v, blockpos$mutable, p_226701_1_); - if (biome$spawnlistentry == null) { - break label123; - } -@@ -100,7 +100,7 @@ - } - - EntityType entitytype = biome$spawnlistentry.field_200702_b; -- if (!entitytype.func_200720_b() || !func_222261_a(chunkgenerator, p_226701_0_, biome$spawnlistentry, blockpos$mutable)) { -+ if (!entitytype.func_200720_b() || !getSpawnList(chunkgenerator, p_226701_0_, biome$spawnlistentry, blockpos$mutable, p_226701_1_)) { - break label115; - } - -@@ -123,15 +123,17 @@ - } - - mobentity.func_70012_b((double)f, (double)k, (double)f1, p_226701_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); -- if (d0 > 16384.0D && mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_226701_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_226701_1_)) { -+ int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_226701_1_, f, k, f1, null, SpawnReason.NATURAL); -+ if (canSpawn == -1 || (canSpawn == 0 && (d0 > 16384.0D && mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_226701_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_226701_1_)))) { - break label115; - } - -+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, p_226701_1_, f, k, f1, null, SpawnReason.NATURAL)) - ilivingentitydata = mobentity.func_213386_a(p_226701_1_, p_226701_1_.func_175649_E(new BlockPos(mobentity)), SpawnReason.NATURAL, ilivingentitydata, (CompoundNBT)null); - ++i; - ++j2; - p_226701_1_.func_217376_c(mobentity); -- if (i >= mobentity.func_70641_bl()) { -+ if (i >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(mobentity)) { - return; - } - -@@ -154,13 +156,15 @@ - } - - @Nullable -- private static Biome.SpawnListEntry func_222264_a(ChunkGenerator p_222264_0_, EntityClassification p_222264_1_, Random p_222264_2_, BlockPos p_222264_3_) { -+ private static Biome.SpawnListEntry getSpawnList(ChunkGenerator p_222264_0_, EntityClassification p_222264_1_, Random p_222264_2_, BlockPos p_222264_3_, World world) { - List 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_); - } - -@@ -189,6 +193,13 @@ + final Entity entity_f = entity; +- EntityClassification entityclassification = entity.func_200600_R().func_220339_d(); ++ EntityClassification entityclassification = entity.getClassification(true); + if (entityclassification != EntityClassification.MISC) { + BlockPos blockpos = entity.func_233580_cy_(); + long i = ChunkPos.func_77272_a(blockpos.func_177958_n() >> 4, blockpos.func_177952_p() >> 4); +@@ -294,6 +294,13 @@ if (p_209382_0_ == EntitySpawnPlacementRegistry.PlacementType.NO_RESTRICTIONS) { return true; } else if (p_209382_3_ != null && p_209382_1_.func_175723_af().func_177746_a(p_209382_2_)) { @@ -68,17 +21,10 @@ + 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_); + FluidState fluidstate = p_209382_1_.func_204610_c(p_209382_2_); BlockPos blockpos = p_209382_2_.func_177984_a(); -@@ -199,14 +210,12 @@ - case ON_GROUND: - default: - BlockState blockstate1 = p_209382_1_.func_180495_p(blockpos1); -- if (!blockstate1.func_215688_a(p_209382_1_, blockpos1, p_209382_3_)) { -+ if (!blockstate1.canCreatureSpawn(p_209382_1_, blockpos1, p_209382_0_, p_209382_3_)) { - return false; - } else { - return func_222266_a(p_209382_1_, p_209382_2_, blockstate, ifluidstate) && func_222266_a(p_209382_1_, blockpos, p_209382_1_.func_180495_p(blockpos), p_209382_1_.func_204610_c(blockpos)); +@@ -312,8 +319,6 @@ + return func_234968_a_(p_209382_1_, p_209382_2_, blockstate, fluidstate, p_209382_3_) && func_234968_a_(p_209382_1_, blockpos, p_209382_1_.func_180495_p(blockpos), p_209382_1_.func_204610_c(blockpos), p_209382_3_); } } - } else { @@ -86,11 +32,11 @@ } } -@@ -249,6 +258,7 @@ +@@ -356,6 +361,7 @@ entity.func_70012_b(d0, (double)blockpos.func_177956_o(), d1, p_77191_4_.nextFloat() * 360.0F, 0.0F); if (entity instanceof MobEntity) { MobEntity mobentity = (MobEntity)entity; + if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_77191_0_, d0, blockpos.func_177956_o(), d1, null, SpawnReason.CHUNK_GENERATION) == -1) continue; if (mobentity.func_213380_a(p_77191_0_, SpawnReason.CHUNK_GENERATION) && mobentity.func_205019_a(p_77191_0_)) { - ilivingentitydata = mobentity.func_213386_a(p_77191_0_, p_77191_0_.func_175649_E(new BlockPos(mobentity)), SpawnReason.CHUNK_GENERATION, ilivingentitydata, (CompoundNBT)null); + ilivingentitydata = mobentity.func_213386_a(p_77191_0_, p_77191_0_.func_175649_E(mobentity.func_233580_cy_()), SpawnReason.CHUNK_GENERATION, ilivingentitydata, (CompoundNBT)null); p_77191_0_.func_217376_c(mobentity); diff --git a/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch b/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch index 7c83ba1b8..a93211eb3 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/storage/MapDecoration.java +++ b/net/minecraft/world/storage/MapDecoration.java -@@ -83,6 +83,16 @@ - return i; +@@ -82,6 +82,16 @@ + return 31 * i + Objects.hashCode(this.field_204310_e); } + /** diff --git a/patches/minecraft/net/minecraft/world/storage/PlayerData.java.patch b/patches/minecraft/net/minecraft/world/storage/PlayerData.java.patch new file mode 100644 index 000000000..895b2dfe7 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/PlayerData.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/storage/PlayerData.java ++++ b/net/minecraft/world/storage/PlayerData.java +@@ -74,4 +74,8 @@ + + return astring; + } ++ ++ public File getPlayerDataFolder() { ++ return field_237333_c_; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch index b5aad3d86..b6ef7843c 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch @@ -1,27 +1,56 @@ --- a/net/minecraft/world/storage/SaveFormat.java +++ b/net/minecraft/world/storage/SaveFormat.java -@@ -138,13 +138,23 @@ +@@ -169,6 +169,10 @@ + } - @Nullable - public static WorldInfo func_215780_a(File p_215780_0_, DataFixer p_215780_1_) { -+ return getWorldData(p_215780_0_, p_215780_1_, null); + private static BiFunction func_237270_b_(DynamicOps p_237270_0_, DatapackCodec p_237270_1_) { ++ return func_237270_b_(p_237270_0_, p_237270_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; ++ private static BiFunction func_237270_b_(DynamicOps p_237270_0_, DatapackCodec p_237270_1_, @Nullable LevelSave levelSave) { + return (p_237261_2_, p_237261_3_) -> { + try { + CompoundNBT compoundnbt = CompressedStreamTools.func_74796_a(new FileInputStream(p_237261_2_)); +@@ -180,7 +184,12 @@ + Pair pair = func_237259_a_(dynamic, p_237261_3_, i); + VersionData versiondata = VersionData.func_237324_a_(dynamic); + WorldSettings worldsettings = WorldSettings.func_234951_a_(dynamic, p_237270_1_); +- return ServerWorldInfo.func_237369_a_(dynamic, p_237261_3_, i, compoundnbt2, worldsettings, versiondata, pair.getFirst(), pair.getSecond()); ++ ServerWorldInfo info = ServerWorldInfo.func_237369_a_(dynamic, p_237261_3_, i, compoundnbt2, worldsettings, versiondata, pair.getFirst(), pair.getSecond()); ++ if (levelSave != null) ++ net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataLoad(levelSave, info, compoundnbt); ++ return info; ++ } catch (net.minecraftforge.fml.StartupQuery.AbortedException e) { ++ throw e; + } catch (Exception exception) { + field_215785_a.error("Exception reading {}", p_237261_2_, exception); + return null; +@@ -301,7 +310,7 @@ + @Nullable + public IServerConfiguration func_237284_a_(DynamicOps p_237284_1_, DatapackCodec p_237284_2_) { + this.func_237301_i_(); +- return SaveFormat.this.func_237266_a_(this.field_237279_c_.toFile(), SaveFormat.func_237270_b_(p_237284_1_, p_237284_2_)); ++ return SaveFormat.this.func_237266_a_(this.field_237279_c_.toFile(), SaveFormat.func_237270_b_(p_237284_1_, p_237284_2_, this)); + } + + @Nullable +@@ -322,6 +331,8 @@ + CompoundNBT compoundnbt1 = new CompoundNBT(); + compoundnbt1.func_218657_a("Data", compoundnbt); + ++ net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataSave(this, p_237288_2_, compoundnbt1); ++ + try { + File file2 = File.createTempFile("level", ".dat", file1); + CompressedStreamTools.func_74799_a(compoundnbt1, new FileOutputStream(file2)); +@@ -339,6 +350,10 @@ + return this.field_237279_c_.resolve("icon.png").toFile(); + } + ++ public Path getWorldDir() { ++ return field_237279_c_; ++ } ++ + @OnlyIn(Dist.CLIENT) + public void func_237299_g_() throws IOException { + this.func_237301_i_(); diff --git a/patches_old/minecraft/net/minecraft/advancements/AdvancementList.java.patch b/patches_old/minecraft/net/minecraft/advancements/AdvancementList.java.patch new file mode 100644 index 000000000..28196dd64 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/advancements/AdvancementList.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/advancements/AdvancementList.java ++++ b/net/minecraft/advancements/AdvancementList.java +@@ -96,6 +96,7 @@ + } + } + ++ net.minecraftforge.common.AdvancementLoadFix.buildSortedTrees(this.field_192093_c); + field_192091_a.info("Loaded {} advancements", (int)this.field_192092_b.size()); + } + diff --git a/patches/minecraft/net/minecraft/advancements/AdvancementManager.java.patch b/patches_old/minecraft/net/minecraft/advancements/AdvancementManager.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/advancements/AdvancementManager.java.patch rename to patches_old/minecraft/net/minecraft/advancements/AdvancementManager.java.patch diff --git a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch b/patches_old/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch rename to patches_old/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch diff --git a/patches_old/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch b/patches_old/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch new file mode 100644 index 000000000..0f1ac1daf --- /dev/null +++ b/patches_old/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch @@ -0,0 +1,27 @@ +--- a/net/minecraft/advancements/PlayerAdvancements.java ++++ b/net/minecraft/advancements/PlayerAdvancements.java +@@ -154,6 +154,7 @@ + } + + this.func_192748_e(); ++ if (net.minecraftforge.common.ForgeConfig.SERVER.fixAdvancementLoading.get()) net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.field_192759_g, this.field_192760_h, this.field_192758_f, this.field_192761_i, this::func_192738_c); else + this.func_192752_d(); + this.func_192751_c(); + } +@@ -187,6 +188,8 @@ + } + + public boolean func_192750_a(Advancement p_192750_1_, String p_192750_2_) { ++ // Forge: don't grant advancements for fake players ++ if (this.field_192762_j instanceof net.minecraftforge.common.util.FakePlayer) return false; + boolean flag = false; + AdvancementProgress advancementprogress = this.func_192747_a(p_192750_1_); + boolean flag1 = advancementprogress.func_192105_a(); +@@ -199,6 +202,7 @@ + if (p_192750_1_.func_192068_c() != null && p_192750_1_.func_192068_c().func_193220_i() && this.field_192762_j.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223620_w)) { + this.field_192756_d.func_184103_al().func_148539_a(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j())); + } ++ net.minecraftforge.common.ForgeHooks.onAdvancement(this.field_192762_j, p_192750_1_); + } + } + diff --git a/patches_old/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch b/patches_old/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch new file mode 100644 index 000000000..f9b2a3da6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/advancements/criterion/ItemPredicate.java ++++ b/net/minecraft/advancements/criterion/ItemPredicate.java +@@ -26,6 +26,8 @@ + import net.minecraft.util.registry.Registry; + + public class ItemPredicate { ++ private static final Map> custom_predicates = new java.util.HashMap<>(); ++ private static final Map> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates); + public static final ItemPredicate field_192495_a = new ItemPredicate(); + @Nullable + private final Tag field_200018_b; +@@ -105,6 +107,11 @@ + public static ItemPredicate func_192492_a(@Nullable JsonElement p_192492_0_) { + if (p_192492_0_ != null && !p_192492_0_.isJsonNull()) { + JsonObject jsonobject = JSONUtils.func_151210_l(p_192492_0_, "item"); ++ if (jsonobject.has("type")) { ++ final ResourceLocation rl = new ResourceLocation(JSONUtils.func_151200_h(jsonobject, "type")); ++ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject); ++ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl); ++ } + MinMaxBounds.IntBound minmaxbounds$intbound = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("count")); + MinMaxBounds.IntBound minmaxbounds$intbound1 = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("durability")); + if (jsonobject.has("data")) { +@@ -204,6 +211,14 @@ + } + } + ++ public static void register(ResourceLocation name, java.util.function.Function deserializer) { ++ custom_predicates.put(name, deserializer); ++ } ++ ++ public static Map> getPredicates() { ++ return unmod_predicates; ++ } ++ + public static class Builder { + private final List field_200312_a = Lists.newArrayList(); + private final List field_226657_b_ = Lists.newArrayList(); diff --git a/patches/minecraft/net/minecraft/block/BedBlock.java.patch b/patches_old/minecraft/net/minecraft/block/BedBlock.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/block/BedBlock.java.patch rename to patches_old/minecraft/net/minecraft/block/BedBlock.java.patch diff --git a/patches_old/minecraft/net/minecraft/block/BlockState.java.patch b/patches_old/minecraft/net/minecraft/block/BlockState.java.patch new file mode 100644 index 000000000..a0d2dfd38 --- /dev/null +++ b/patches_old/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; +@@ -106,10 +106,14 @@ + return this.field_215708_d; + } + ++ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */ ++ @Deprecated + public boolean func_196958_f() { + return this.func_177230_c().func_196261_e(this); + } + ++ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation) */ ++ @Deprecated + public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) { + return this.func_177230_c().func_180659_g(this, p_185909_1_, p_185909_2_); + } diff --git a/patches_old/minecraft/net/minecraft/block/Blocks.java.patch b/patches_old/minecraft/net/minecraft/block/Blocks.java.patch new file mode 100644 index 000000000..0b40aa831 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/Blocks.java.patch @@ -0,0 +1,36 @@ +--- a/net/minecraft/block/Blocks.java ++++ b/net/minecraft/block/Blocks.java +@@ -14,6 +14,7 @@ + import net.minecraft.tileentity.TileEntityType; + import net.minecraft.util.registry.Registry; + ++@net.minecraftforge.registries.ObjectHolder("minecraft") + public class Blocks { + public static final Block field_150350_a = func_222382_a("air", new AirBlock(Block.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e())); + public static final Block field_150348_b = func_222382_a("stone", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_200948_a(1.5F, 6.0F))); +@@ -105,7 +106,7 @@ + public static final Block field_196601_az = func_222382_a("green_bed", new BedBlock(DyeColor.GREEN, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F).func_226896_b_())); + public static final Block field_196550_aA = func_222382_a("red_bed", new BedBlock(DyeColor.RED, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F).func_226896_b_())); + public static final Block field_196551_aB = func_222382_a("black_bed", new BedBlock(DyeColor.BLACK, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F).func_226896_b_())); +- public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e))); ++ public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true)); + public static final Block field_150319_E = func_222382_a("detector_rail", new DetectorRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e))); + public static final Block field_150320_F = func_222382_a("sticky_piston", new PistonBlock(true, Block.Properties.func_200945_a(Material.field_76233_E).func_200943_b(0.5F))); + public static final Block field_196553_aF = func_222382_a("cobweb", new WebBlock(Block.Properties.func_200945_a(Material.field_151569_G).func_200942_a().func_200943_b(4.0F))); +@@ -701,16 +702,4 @@ + private static Block func_222382_a(String p_222382_0_, Block p_222382_1_) { + return Registry.func_218325_a(Registry.field_212618_g, p_222382_0_, p_222382_1_); + } +- +- static { +- for(Block block : Registry.field_212618_g) { +- for(BlockState blockstate : block.func_176194_O().func_177619_a()) { +- blockstate.func_215692_c(); +- Block.field_176229_d.func_195867_b(blockstate); +- } +- +- block.func_220068_i(); +- } +- +- } + } diff --git a/patches_old/minecraft/net/minecraft/block/BushBlock.java.patch b/patches_old/minecraft/net/minecraft/block/BushBlock.java.patch new file mode 100644 index 000000000..81b00dcdd --- /dev/null +++ b/patches_old/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_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { + return p_196266_4_ == PathType.AIR && !this.field_196274_w ? true : super.func_196266_a(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_); + } ++ ++ @Override ++ public BlockState getPlant(IBlockReader world, BlockPos pos) { ++ BlockState state = world.func_180495_p(pos); ++ if (state.func_177230_c() != this) return func_176223_P(); ++ return state; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/block/CactusBlock.java.patch b/patches_old/minecraft/net/minecraft/block/CactusBlock.java.patch new file mode 100644 index 000000000..b38c7edc3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/CactusBlock.java.patch @@ -0,0 +1,63 @@ +--- a/net/minecraft/block/CactusBlock.java ++++ b/net/minecraft/block/CactusBlock.java +@@ -19,7 +19,7 @@ + import net.minecraft.world.World; + import net.minecraft.world.server.ServerWorld; + +-public class CactusBlock extends Block { ++public class CactusBlock extends Block implements net.minecraftforge.common.IPlantable { + public static final IntegerProperty field_176587_a = BlockStateProperties.field_208171_X; + protected static final VoxelShape field_196400_b = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D); + protected static final VoxelShape field_196401_c = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D); +@@ -30,6 +30,7 @@ + } + + public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { ++ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update + if (!p_225534_1_.func_196955_c(p_225534_2_, p_225534_3_)) { + p_225534_2_.func_175655_b(p_225534_3_, true); + } else { +@@ -42,6 +43,7 @@ + + if (i < 3) { + int j = p_225534_1_.func_177229_b(field_176587_a); ++ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, blockpos, p_225534_1_, true)) { + if (j == 15) { + p_225534_2_.func_175656_a(blockpos, this.func_176223_P()); + BlockState blockstate = p_225534_1_.func_206870_a(field_176587_a, Integer.valueOf(0)); +@@ -50,7 +52,8 @@ + } else { + p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4); + } +- ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); ++ } + } + } + } +@@ -81,8 +84,8 @@ + } + } + +- Block block = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_177230_c(); +- return (block == Blocks.field_150434_aF || block == Blocks.field_150354_m || block == Blocks.field_196611_F) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d(); ++ BlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); ++ return soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), Direction.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d(); + } + + public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { +@@ -96,4 +99,14 @@ + public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { + return false; + } ++ ++ @Override ++ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) { ++ return net.minecraftforge.common.PlantType.Desert; ++ } ++ ++ @Override ++ public BlockState getPlant(IBlockReader world, BlockPos pos) { ++ return func_176223_P(); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/CampfireBlock.java.patch b/patches_old/minecraft/net/minecraft/block/CampfireBlock.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/block/CampfireBlock.java.patch rename to patches_old/minecraft/net/minecraft/block/CampfireBlock.java.patch diff --git a/patches_old/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch b/patches_old/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch new file mode 100644 index 000000000..c63573642 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch @@ -0,0 +1,50 @@ +--- a/net/minecraft/block/ChorusFlowerBlock.java ++++ b/net/minecraft/block/ChorusFlowerBlock.java +@@ -29,9 +29,9 @@ + p_225534_2_.func_175655_b(p_225534_3_, true); + } else { + BlockPos blockpos = p_225534_3_.func_177984_a(); +- if (p_225534_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) { ++ if (p_225534_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < p_225534_2_.func_201675_m().getHeight()) { + int i = p_225534_1_.func_177229_b(field_185607_a); +- if (i < 5) { ++ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, blockpos, p_225534_1_, true)) { + boolean flag = false; + boolean flag1 = false; + BlockState blockstate = p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()); +@@ -56,7 +56,7 @@ + if (j < 2 || j <= p_225534_4_.nextInt(flag1 ? 5 : 4)) { + flag = true; + } +- } else if (blockstate.func_196958_f()) { ++ } else if (blockstate.isAir(p_225534_2_, p_225534_3_.func_177977_b())) { + flag = true; + } + +@@ -88,7 +88,7 @@ + } else { + this.func_185605_c(p_225534_2_, p_225534_3_); + } +- ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); + } + } + } +@@ -126,7 +126,7 @@ + BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); + Block block = blockstate.func_177230_c(); + if (block != this.field_196405_b && block != Blocks.field_150377_bs) { +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(p_196260_2_, p_196260_3_.func_177977_b())) { + return false; + } else { + boolean flag = false; +@@ -139,7 +139,7 @@ + } + + flag = true; +- } else if (!blockstate1.func_196958_f()) { ++ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.func_177972_a(direction))) { + return false; + } + } diff --git a/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch b/patches_old/minecraft/net/minecraft/block/CocoaBlock.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/block/CocoaBlock.java.patch rename to patches_old/minecraft/net/minecraft/block/CocoaBlock.java.patch diff --git a/patches_old/minecraft/net/minecraft/block/ComparatorBlock.java.patch b/patches_old/minecraft/net/minecraft/block/ComparatorBlock.java.patch new file mode 100644 index 000000000..d22d6ae69 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/ComparatorBlock.java.patch @@ -0,0 +1,28 @@ +--- a/net/minecraft/block/ComparatorBlock.java ++++ b/net/minecraft/block/ComparatorBlock.java +@@ -71,7 +71,7 @@ + blockstate = p_176397_1_.func_180495_p(blockpos); + if (blockstate.func_185912_n()) { + i = blockstate.func_185888_a(p_176397_1_, blockpos); +- } else if (blockstate.func_196958_f()) { ++ } else if (blockstate.isAir(p_176397_1_, blockpos)) { + ItemFrameEntity itemframeentity = this.func_176461_a(p_176397_1_, direction, blockpos); + if (itemframeentity != null) { + i = itemframeentity.func_174866_q(); +@@ -157,4 +157,16 @@ + protected void func_206840_a(StateContainer.Builder 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_old/minecraft/net/minecraft/block/CropsBlock.java.patch b/patches_old/minecraft/net/minecraft/block/CropsBlock.java.patch new file mode 100644 index 000000000..262ecdb0b --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/CropsBlock.java.patch @@ -0,0 +1,39 @@ +--- a/net/minecraft/block/CropsBlock.java ++++ b/net/minecraft/block/CropsBlock.java +@@ -58,12 +58,14 @@ + + public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { + super.func_225534_a_(p_225534_1_, p_225534_2_, p_225534_3_, p_225534_4_); ++ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + if (p_225534_2_.func_226659_b_(p_225534_3_, 0) >= 9) { + int i = this.func_185527_x(p_225534_1_); + if (i < this.func_185526_g()) { + float f = func_180672_a(this, p_225534_2_, p_225534_3_); +- if (p_225534_4_.nextInt((int)(25.0F / f) + 1) == 0) { ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_4_.nextInt((int)(25.0F / f) + 1) == 0)) { + p_225534_2_.func_180501_a(p_225534_3_, this.func_185528_e(i + 1), 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); + } + } + } +@@ -92,9 +94,9 @@ + for(int j = -1; j <= 1; ++j) { + float f1 = 0.0F; + BlockState blockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j)); +- if (blockstate.func_177230_c() == Blocks.field_150458_ak) { ++ if (blockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) { + f1 = 1.0F; +- if (blockstate.func_177229_b(FarmlandBlock.field_176531_a) > 0) { ++ if (blockstate.isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j))) { + f1 = 3.0F; + } + } +@@ -130,7 +132,7 @@ + } + + public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { +- if (p_196262_4_ instanceof RavagerEntity && p_196262_2_.func_82736_K().func_223586_b(GameRules.field_223599_b)) { ++ if (p_196262_4_ instanceof RavagerEntity && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_196262_2_, p_196262_4_)) { + p_196262_2_.func_225521_a_(p_196262_3_, true, p_196262_4_); + } + diff --git a/patches_old/minecraft/net/minecraft/block/DeadBushBlock.java.patch b/patches_old/minecraft/net/minecraft/block/DeadBushBlock.java.patch new file mode 100644 index 000000000..341a2ad7e --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/block/DetectorRailBlock.java.patch b/patches_old/minecraft/net/minecraft/block/DetectorRailBlock.java.patch new file mode 100644 index 000000000..2ba96d58b --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/DetectorRailBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/DetectorRailBlock.java ++++ b/net/minecraft/block/DetectorRailBlock.java +@@ -129,6 +129,8 @@ + + public int func_180641_l(BlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) { + if (p_180641_1_.func_177229_b(field_176574_M)) { ++ List 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_old/minecraft/net/minecraft/block/DoublePlantBlock.java.patch b/patches_old/minecraft/net/minecraft/block/DoublePlantBlock.java.patch new file mode 100644 index 000000000..ecf90a095 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/block/DropperBlock.java.patch b/patches_old/minecraft/net/minecraft/block/DropperBlock.java.patch new file mode 100644 index 000000000..7271e5e1c --- /dev/null +++ b/patches_old/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/EnchantingTableBlock.java.patch b/patches_old/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch rename to patches_old/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch diff --git a/patches_old/minecraft/net/minecraft/block/FallingBlock.java.patch b/patches_old/minecraft/net/minecraft/block/FallingBlock.java.patch new file mode 100644 index 000000000..ddd32d0d6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/FallingBlock.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/block/FallingBlock.java ++++ b/net/minecraft/block/FallingBlock.java +@@ -29,7 +29,7 @@ + } + + public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { +- if (func_185759_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b())) && p_225534_3_.func_177956_o() >= 0) { ++ if (p_225534_2_.func_175623_d(p_225534_3_.func_177977_b()) || func_185759_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b())) && p_225534_3_.func_177956_o() >= 0) { + FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_225534_2_, (double)p_225534_3_.func_177958_n() + 0.5D, (double)p_225534_3_.func_177956_o(), (double)p_225534_3_.func_177952_p() + 0.5D, p_225534_2_.func_180495_p(p_225534_3_)); + this.func_149829_a(fallingblockentity); + p_225534_2_.func_217376_c(fallingblockentity); +@@ -59,7 +59,7 @@ + public void func_180655_c(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) { + if (p_180655_4_.nextInt(16) == 0) { + BlockPos blockpos = p_180655_3_.func_177977_b(); +- if (func_185759_i(p_180655_2_.func_180495_p(blockpos))) { ++ if (p_180655_2_.func_175623_d(blockpos) || func_185759_i(p_180655_2_.func_180495_p(blockpos))) { + double d0 = (double)p_180655_3_.func_177958_n() + (double)p_180655_4_.nextFloat(); + double d1 = (double)p_180655_3_.func_177956_o() - 0.05D; + double d2 = (double)p_180655_3_.func_177952_p() + (double)p_180655_4_.nextFloat(); diff --git a/patches_old/minecraft/net/minecraft/block/FarmlandBlock.java.patch b/patches_old/minecraft/net/minecraft/block/FarmlandBlock.java.patch new file mode 100644 index 000000000..63e203b01 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/FarmlandBlock.java.patch @@ -0,0 +1,33 @@ +--- a/net/minecraft/block/FarmlandBlock.java ++++ b/net/minecraft/block/FarmlandBlock.java +@@ -76,7 +76,7 @@ + } + + public void func_180658_a(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) { +- if (!p_180658_1_.field_72995_K && p_180658_1_.field_73012_v.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof LivingEntity && (p_180658_3_ instanceof PlayerEntity || p_180658_1_.func_82736_K().func_223586_b(GameRules.field_223599_b)) && p_180658_3_.func_213311_cf() * p_180658_3_.func_213311_cf() * p_180658_3_.func_213302_cg() > 0.512F) { ++ if (!p_180658_1_.field_72995_K && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_180658_1_, p_180658_2_, Blocks.field_150346_d.func_176223_P(), p_180658_4_, p_180658_3_)) { // Forge: Move logic to Entity#canTrample + func_199610_d(p_180658_1_.func_180495_p(p_180658_2_), p_180658_1_, p_180658_2_); + } + +@@ -87,9 +87,9 @@ + p_199610_1_.func_175656_a(p_199610_2_, func_199601_a(p_199610_0_, Blocks.field_150346_d.func_176223_P(), p_199610_1_, p_199610_2_)); + } + +- private static boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) { +- Block block = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a()).func_177230_c(); +- return block instanceof CropsBlock || block instanceof StemBlock || block instanceof AttachedStemBlock; ++ private boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) { ++ BlockState state = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a()); ++ return state.func_177230_c() instanceof net.minecraftforge.common.IPlantable && canSustainPlant(state, p_176529_0_, p_176529_1_, Direction.UP, (net.minecraftforge.common.IPlantable)state.func_177230_c()); + } + + private static boolean func_176530_e(IWorldReader p_176530_0_, BlockPos p_176530_1_) { +@@ -99,7 +99,7 @@ + } + } + +- return false; ++ return net.minecraftforge.common.FarmlandWaterManager.hasBlockWaterTicket(p_176530_0_, p_176530_1_); + } + + protected void func_206840_a(StateContainer.Builder p_206840_1_) { diff --git a/patches_old/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch b/patches_old/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch new file mode 100644 index 000000000..4b42092df --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch @@ -0,0 +1,85 @@ +--- a/net/minecraft/block/FlowingFluidBlock.java ++++ b/net/minecraft/block/FlowingFluidBlock.java +@@ -31,9 +31,11 @@ + + public class FlowingFluidBlock extends Block implements IBucketPickupHandler { + public static final IntegerProperty field_176367_b = BlockStateProperties.field_208132_ag; +- protected final FlowingFluid field_204517_c; ++ private final FlowingFluid field_204517_c; + private final List field_212565_c; + ++ // Forge: Use the constructor that takes a supplier ++ @Deprecated + protected FlowingFluidBlock(FlowingFluid p_i49014_1_, Block.Properties p_i49014_2_) { + super(p_i49014_2_); + this.field_204517_c = p_i49014_1_; +@@ -46,8 +48,21 @@ + + this.field_212565_c.add(p_i49014_1_.func_207207_a(8, true)); + this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0))); ++ fluidStateCacheInitialized = true; ++ supplier = p_i49014_1_.delegate; + } + ++ /** ++ * @param supplier A fluid supplier such as {@link net.minecraftforge.fml.RegistryObject} ++ */ ++ public FlowingFluidBlock(java.util.function.Supplier supplier, Block.Properties p_i48368_1_) { ++ super(p_i48368_1_); ++ this.field_204517_c = null; ++ this.field_212565_c = Lists.newArrayList(); ++ this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0))); ++ this.supplier = supplier; ++ } ++ + public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + p_225542_2_.func_204610_c(p_225542_3_).func_206891_b(p_225542_2_, p_225542_3_, p_225542_4_); + } +@@ -62,6 +77,7 @@ + + public IFluidState func_204507_t(BlockState p_204507_1_) { + int i = p_204507_1_.func_177229_b(field_176367_b); ++ if (!fluidStateCacheInitialized) initFluidStateCache(); + return this.field_212565_c.get(Math.min(i, 8)); + } + +@@ -122,13 +138,13 @@ + if (flag) { + IFluidState ifluidstate = p_204515_1_.func_204610_c(p_204515_2_); + if (ifluidstate.func_206889_d()) { +- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_150343_Z.func_176223_P()); ++ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_150343_Z.func_176223_P())); + this.func_180688_d(p_204515_1_, p_204515_2_); + return false; + } + + if (ifluidstate.func_215679_a(p_204515_1_, p_204515_2_) >= 0.44444445F) { +- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_150347_e.func_176223_P()); ++ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_150347_e.func_176223_P())); + this.func_180688_d(p_204515_1_, p_204515_2_); + return false; + } +@@ -161,4 +177,23 @@ + } + + } ++ ++ // Forge start ++ private final java.util.function.Supplier supplier; ++ public FlowingFluid getFluid() { ++ return (FlowingFluid)supplier.get(); ++ } ++ ++ private boolean fluidStateCacheInitialized = false; ++ protected synchronized void initFluidStateCache() { ++ if (fluidStateCacheInitialized == false) { ++ this.field_212565_c.add(getFluid().func_207204_a(false)); ++ ++ for (int i = 1; i < 8; ++i) ++ this.field_212565_c.add(getFluid().func_207207_a(8 - i, false)); ++ ++ this.field_212565_c.add(getFluid().func_207207_a(8, true)); ++ fluidStateCacheInitialized = true; ++ } ++ } + } diff --git a/patches_old/minecraft/net/minecraft/block/ITileEntityProvider.java.patch b/patches_old/minecraft/net/minecraft/block/ITileEntityProvider.java.patch new file mode 100644 index 000000000..bd96db3c6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/ITileEntityProvider.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/block/ITileEntityProvider.java ++++ b/net/minecraft/block/ITileEntityProvider.java +@@ -4,6 +4,7 @@ + import net.minecraft.tileentity.TileEntity; + import net.minecraft.world.IBlockReader; + ++@Deprecated //Forge: Do not use, use BlockState.hasTileEntity/Block.createTileEntity + public interface ITileEntityProvider { + @Nullable + TileEntity func_196283_a_(IBlockReader p_196283_1_); diff --git a/patches/minecraft/net/minecraft/block/KelpTopBlock.java.patch b/patches_old/minecraft/net/minecraft/block/KelpTopBlock.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/block/KelpTopBlock.java.patch rename to patches_old/minecraft/net/minecraft/block/KelpTopBlock.java.patch diff --git a/patches_old/minecraft/net/minecraft/block/LadderBlock.java.patch b/patches_old/minecraft/net/minecraft/block/LadderBlock.java.patch new file mode 100644 index 000000000..452bc5551 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/LadderBlock.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/block/LadderBlock.java ++++ b/net/minecraft/block/LadderBlock.java +@@ -93,6 +93,11 @@ + return null; + } + ++ @Override ++ public boolean isLadder(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { ++ return true; ++ } ++ + public BlockState func_185499_a(BlockState p_185499_1_, Rotation p_185499_2_) { + return p_185499_1_.func_206870_a(field_176382_a, p_185499_2_.func_185831_a(p_185499_1_.func_177229_b(field_176382_a))); + } diff --git a/patches_old/minecraft/net/minecraft/block/LeavesBlock.java.patch b/patches_old/minecraft/net/minecraft/block/LeavesBlock.java.patch new file mode 100644 index 000000000..2c446e407 --- /dev/null +++ b/patches_old/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; + diff --git a/patches_old/minecraft/net/minecraft/block/MushroomBlock.java.patch b/patches_old/minecraft/net/minecraft/block/MushroomBlock.java.patch new file mode 100644 index 000000000..b85d7d040 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/MushroomBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/MushroomBlock.java ++++ b/net/minecraft/block/MushroomBlock.java +@@ -64,7 +64,7 @@ + BlockState blockstate = p_196260_2_.func_180495_p(blockpos); + Block block = blockstate.func_177230_c(); + if (block != Blocks.field_150391_bh && block != Blocks.field_196661_l) { +- return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && this.func_200014_a_(blockstate, p_196260_2_, blockpos); ++ return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this); + } else { + return true; + } diff --git a/patches_old/minecraft/net/minecraft/block/NetherPortalBlock.java.patch b/patches_old/minecraft/net/minecraft/block/NetherPortalBlock.java.patch new file mode 100644 index 000000000..7307175b9 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/NetherPortalBlock.java.patch @@ -0,0 +1,56 @@ +--- a/net/minecraft/block/NetherPortalBlock.java ++++ b/net/minecraft/block/NetherPortalBlock.java +@@ -69,7 +69,7 @@ + + public boolean func_176548_d(IWorld p_176548_1_, BlockPos p_176548_2_) { + NetherPortalBlock.Size netherportalblock$size = this.func_201816_b(p_176548_1_, p_176548_2_); +- if (netherportalblock$size != null) { ++ if (netherportalblock$size != null && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_1_, p_176548_2_, netherportalblock$size)) { + netherportalblock$size.func_150859_c(); + return true; + } else { +@@ -241,13 +241,13 @@ + int i; + for(i = 0; i < 22; ++i) { + BlockPos blockpos = p_180120_1_.func_177967_a(p_180120_2_, i); +- if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || this.field_150867_a.func_180495_p(blockpos.func_177977_b()).func_177230_c() != Blocks.field_150343_Z) { ++ if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || !this.field_150867_a.func_180495_p(blockpos.func_177977_b()).isPortalFrame(this.field_150867_a, blockpos.func_177977_b())) { + break; + } + } + +- Block block = this.field_150867_a.func_180495_p(p_180120_1_.func_177967_a(p_180120_2_, i)).func_177230_c(); +- return block == Blocks.field_150343_Z ? i : 0; ++ BlockPos framePos = p_180120_1_.func_177967_a(p_180120_2_, i); ++ return this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos) ? i : 0; + } + + public int func_181100_a() { +@@ -274,13 +274,13 @@ + } + + if (i == 0) { +- block = this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150863_d)).func_177230_c(); +- if (block != Blocks.field_150343_Z) { ++ BlockPos framePos = blockpos.func_177972_a(this.field_150863_d); ++ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) { + break label56; + } + } else if (i == this.field_150868_h - 1) { +- block = this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150866_c)).func_177230_c(); +- if (block != Blocks.field_150343_Z) { ++ BlockPos framePos = blockpos.func_177972_a(this.field_150866_c); ++ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) { + break label56; + } + } +@@ -288,7 +288,8 @@ + } + + for(int j = 0; j < this.field_150868_h; ++j) { +- if (this.field_150867_a.func_180495_p(this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g)).func_177230_c() != Blocks.field_150343_Z) { ++ BlockPos framePos = this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g); ++ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) { + this.field_150862_g = 0; + break; + } diff --git a/patches_old/minecraft/net/minecraft/block/NoteBlock.java.patch b/patches_old/minecraft/net/minecraft/block/NoteBlock.java.patch new file mode 100644 index 000000000..1050235fc --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/NoteBlock.java.patch @@ -0,0 +1,32 @@ +--- a/net/minecraft/block/NoteBlock.java ++++ b/net/minecraft/block/NoteBlock.java +@@ -50,7 +50,7 @@ + } + + private void func_196482_a(World p_196482_1_, BlockPos p_196482_2_) { +- if (p_196482_1_.func_180495_p(p_196482_2_.func_177984_a()).func_196958_f()) { ++ if (p_196482_1_.func_175623_d(p_196482_2_.func_177984_a())) { + p_196482_1_.func_175641_c(p_196482_2_, this, 0, 0); + } + +@@ -60,7 +60,9 @@ + if (p_225533_2_.field_72995_K) { + return ActionResultType.SUCCESS; + } else { +- p_225533_1_ = p_225533_1_.func_177231_a(field_196485_c); ++ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.func_177229_b(field_196485_c), p_225533_1_.func_177231_a(field_196485_c).func_177229_b(field_196485_c)); ++ if (_new == -1) return ActionResultType.FAIL; ++ p_225533_1_ = (BlockState)p_225533_1_.func_206870_a(field_196485_c, _new); + p_225533_2_.func_180501_a(p_225533_3_, p_225533_1_, 3); + this.func_196482_a(p_225533_2_, p_225533_3_); + p_225533_4_.func_195066_a(Stats.field_188087_U); +@@ -76,6 +78,9 @@ + } + + public boolean func_189539_a(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) { ++ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_189539_2_, p_189539_3_, p_189539_1_, p_189539_1_.func_177229_b(field_196485_c), p_189539_1_.func_177229_b(field_196483_a)); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; ++ p_189539_1_ = p_189539_1_.func_206870_a(field_196485_c, e.getVanillaNoteId()).func_206870_a(field_196483_a, e.getInstrument()); + int i = p_189539_1_.func_177229_b(field_196485_c); + float f = (float)Math.pow(2.0D, (double)(i - 12) / 12.0D); + p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, p_189539_1_.func_177229_b(field_196483_a).func_208088_a(), SoundCategory.RECORDS, 3.0F, f); diff --git a/patches_old/minecraft/net/minecraft/block/OreBlock.java.patch b/patches_old/minecraft/net/minecraft/block/OreBlock.java.patch new file mode 100644 index 000000000..fee79b59a --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/block/PistonBlockStructureHelper.java.patch b/patches_old/minecraft/net/minecraft/block/PistonBlockStructureHelper.java.patch new file mode 100644 index 000000000..97e05a576 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/PistonBlockStructureHelper.java.patch @@ -0,0 +1,81 @@ +--- a/net/minecraft/block/PistonBlockStructureHelper.java ++++ b/net/minecraft/block/PistonBlockStructureHelper.java +@@ -48,7 +48,7 @@ + } else { + for(int i = 0; i < this.field_177258_e.size(); ++i) { + BlockPos blockpos = this.field_177258_e.get(i); +- if (func_227029_a_(this.field_177261_a.func_180495_p(blockpos).func_177230_c()) && !this.func_177250_b(blockpos)) { ++ if (this.field_177261_a.func_180495_p(blockpos).isStickyBlock() && !this.func_177250_b(blockpos)) { + return false; + } + } +@@ -57,24 +57,9 @@ + } + } + +- private static boolean func_227029_a_(Block p_227029_0_) { +- return p_227029_0_ == Blocks.field_180399_cE || p_227029_0_ == Blocks.field_226907_mc_; +- } +- +- private static boolean func_227030_a_(Block p_227030_0_, Block p_227030_1_) { +- if (p_227030_0_ == Blocks.field_226907_mc_ && p_227030_1_ == Blocks.field_180399_cE) { +- return false; +- } else if (p_227030_0_ == Blocks.field_180399_cE && p_227030_1_ == Blocks.field_226907_mc_) { +- return false; +- } else { +- return func_227029_a_(p_227030_0_) || func_227029_a_(p_227030_1_); +- } +- } +- + private boolean func_177251_a(BlockPos p_177251_1_, Direction p_177251_2_) { + BlockState blockstate = this.field_177261_a.func_180495_p(p_177251_1_); +- Block block = blockstate.func_177230_c(); +- if (blockstate.func_196958_f()) { ++ if (field_177261_a.func_175623_d(p_177251_1_)) { + return true; + } else if (!PistonBlock.func_185646_a(blockstate, this.field_177261_a, p_177251_1_, this.field_177257_d, false, p_177251_2_)) { + return true; +@@ -87,12 +72,12 @@ + if (i + this.field_177258_e.size() > 12) { + return false; + } else { +- while(func_227029_a_(block)) { ++ BlockState oldState; ++ while(blockstate.isStickyBlock()) { + BlockPos blockpos = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i); +- Block block1 = block; ++ oldState = blockstate; + blockstate = this.field_177261_a.func_180495_p(blockpos); +- block = blockstate.func_177230_c(); +- if (blockstate.func_196958_f() || !func_227030_a_(block1, block) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) { ++ if (blockstate.isAir(this.field_177261_a, blockpos) || !oldState.canStickTo(blockstate) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) { + break; + } + +@@ -119,7 +104,7 @@ + + for(int k = 0; k <= j + l; ++k) { + BlockPos blockpos2 = this.field_177258_e.get(k); +- if (func_227029_a_(this.field_177261_a.func_180495_p(blockpos2).func_177230_c()) && !this.func_177250_b(blockpos2)) { ++ if (this.field_177261_a.func_180495_p(blockpos2).isStickyBlock() && !this.func_177250_b(blockpos2)) { + return false; + } + } +@@ -128,7 +113,7 @@ + } + + blockstate = this.field_177261_a.func_180495_p(blockpos1); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(field_177261_a, blockpos1)) { + return true; + } + +@@ -173,7 +158,7 @@ + if (direction.func_176740_k() != this.field_177257_d.func_176740_k()) { + BlockPos blockpos = p_177250_1_.func_177972_a(direction); + BlockState blockstate1 = this.field_177261_a.func_180495_p(blockpos); +- if (func_227030_a_(blockstate1.func_177230_c(), blockstate.func_177230_c()) && !this.func_177251_a(blockpos, direction)) { ++ if (blockstate1.canStickTo(blockstate) && !this.func_177251_a(blockpos, direction)) { + return false; + } + } diff --git a/patches_old/minecraft/net/minecraft/block/RailState.java.patch b/patches_old/minecraft/net/minecraft/block/RailState.java.patch new file mode 100644 index 000000000..59bee3cd9 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/RailState.java.patch @@ -0,0 +1,57 @@ +--- 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 RailState(World p_i47755_1_, BlockPos p_i47755_2_, BlockState p_i47755_3_) { + this.field_196920_a = p_i47755_1_; + this.field_196921_b = p_i47755_2_; + this.field_196923_d = p_i47755_3_; + this.field_196922_c = (AbstractRailBlock)p_i47755_3_.func_177230_c(); +- RailShape railshape = p_i47755_3_.func_177229_b(this.field_196922_c.func_176560_l()); +- this.field_208513_e = this.field_196922_c.func_208490_b(); ++ RailShape railshape = this.field_196922_c.getRailDirection(field_196923_d, p_i47755_1_, p_i47755_2_, null); ++ this.field_208513_e = !this.field_196922_c.isFlexibleRail(field_196923_d, p_i47755_1_, p_i47755_2_); ++ this.canMakeSlopes = this.field_196922_c.canMakeSlopes(field_196923_d, p_i47755_1_, p_i47755_2_); + this.func_208509_a(railshape); + } + +@@ -178,7 +180,7 @@ + } + } + +- if (railshape == RailShape.NORTH_SOUTH) { ++ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) { + if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) { + railshape = RailShape.ASCENDING_NORTH; + } +@@ -188,7 +190,7 @@ + } + } + +- if (railshape == RailShape.EAST_WEST) { ++ if (railshape == RailShape.EAST_WEST && canMakeSlopes) { + if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) { + railshape = RailShape.ASCENDING_EAST; + } +@@ -304,7 +306,7 @@ + } + } + +- if (railshape == RailShape.NORTH_SOUTH) { ++ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) { + if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) { + railshape = RailShape.ASCENDING_NORTH; + } +@@ -314,7 +316,7 @@ + } + } + +- if (railshape == RailShape.EAST_WEST) { ++ if (railshape == RailShape.EAST_WEST && canMakeSlopes) { + if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) { + railshape = RailShape.ASCENDING_EAST; + } diff --git a/patches_old/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch b/patches_old/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch new file mode 100644 index 000000000..71c810df0 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/block/RedstoneOreBlock.java ++++ b/net/minecraft/block/RedstoneOreBlock.java +@@ -68,11 +68,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_old/minecraft/net/minecraft/block/SaplingBlock.java.patch b/patches_old/minecraft/net/minecraft/block/SaplingBlock.java.patch new file mode 100644 index 000000000..cc072f5e5 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/SaplingBlock.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/block/SaplingBlock.java ++++ b/net/minecraft/block/SaplingBlock.java +@@ -29,6 +29,7 @@ + + public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { + super.func_225534_a_(p_225534_1_, p_225534_2_, p_225534_3_, p_225534_4_); ++ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + if (p_225534_2_.func_201696_r(p_225534_3_.func_177984_a()) >= 9 && p_225534_4_.nextInt(7) == 0) { + this.func_226942_a_(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_4_); + } +@@ -39,6 +40,7 @@ + if (p_226942_3_.func_177229_b(field_176479_b) == 0) { + p_226942_1_.func_180501_a(p_226942_2_, p_226942_3_.func_177231_a(field_176479_b), 4); + } else { ++ if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_226942_1_, p_226942_4_, p_226942_2_)) return; + this.field_196387_c.func_225545_a_(p_226942_1_, p_226942_1_.func_72863_F().func_201711_g(), p_226942_2_, p_226942_3_, p_226942_4_); + } + diff --git a/patches_old/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch b/patches_old/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch new file mode 100644 index 000000000..a13c597eb --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/ScaffoldingBlock.java ++++ b/net/minecraft/block/ScaffoldingBlock.java +@@ -138,6 +138,8 @@ + return i; + } + ++ @Override public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { return true; } ++ + static { + VoxelShape voxelshape = Block.func_208617_a(0.0D, 14.0D, 0.0D, 16.0D, 16.0D, 16.0D); + VoxelShape voxelshape1 = Block.func_208617_a(0.0D, 0.0D, 0.0D, 2.0D, 16.0D, 2.0D); diff --git a/patches_old/minecraft/net/minecraft/block/SeaGrassBlock.java.patch b/patches_old/minecraft/net/minecraft/block/SeaGrassBlock.java.patch new file mode 100644 index 000000000..9e15b84f7 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/SeaGrassBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/SeaGrassBlock.java ++++ b/net/minecraft/block/SeaGrassBlock.java +@@ -17,7 +17,7 @@ + import net.minecraft.world.World; + import net.minecraft.world.server.ServerWorld; + +-public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer { ++public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer, net.minecraftforge.common.IShearable { + 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_old/minecraft/net/minecraft/block/ShearableDoublePlantBlock.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/block/ShearableDoublePlantBlock.java.patch rename to patches_old/minecraft/net/minecraft/block/ShearableDoublePlantBlock.java.patch diff --git a/patches_old/minecraft/net/minecraft/block/SpawnerBlock.java.patch b/patches_old/minecraft/net/minecraft/block/SpawnerBlock.java.patch new file mode 100644 index 000000000..646638993 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/SpawnerBlock.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/block/SpawnerBlock.java ++++ b/net/minecraft/block/SpawnerBlock.java +@@ -18,10 +18,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_old/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch b/patches_old/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch new file mode 100644 index 000000000..d46dc4046 --- /dev/null +++ b/patches_old/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_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { + if (!func_220257_b(p_225534_1_, p_225534_2_, p_225534_3_)) { ++ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading + p_225534_2_.func_175656_a(p_225534_3_, Blocks.field_150346_d.func_176223_P()); + } else { + if (p_225534_2_.func_201696_r(p_225534_3_.func_177984_a()) >= 9) { diff --git a/patches_old/minecraft/net/minecraft/block/SugarCaneBlock.java.patch b/patches_old/minecraft/net/minecraft/block/SugarCaneBlock.java.patch new file mode 100644 index 000000000..cd26ff88d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/SugarCaneBlock.java.patch @@ -0,0 +1,51 @@ +--- a/net/minecraft/block/SugarCaneBlock.java ++++ b/net/minecraft/block/SugarCaneBlock.java +@@ -15,7 +15,7 @@ + import net.minecraft.world.IWorldReader; + import net.minecraft.world.server.ServerWorld; + +-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); + +@@ -39,12 +39,15 @@ + + if (i < 3) { + int j = p_225534_1_.func_177229_b(field_176355_a); ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, true)) { + if (j == 15) { + p_225534_2_.func_175656_a(p_225534_3_.func_177984_a(), this.func_176223_P()); + p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_176355_a, Integer.valueOf(0)), 4); + } else { + p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_176355_a, Integer.valueOf(j + 1)), 4); + } ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); ++ } + } + } + +@@ -59,6 +62,8 @@ + } + + 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; +@@ -82,4 +87,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.PlantType getPlantType(IBlockReader world, BlockPos pos) { ++ return net.minecraftforge.common.PlantType.Beach; ++ } ++ ++ @Override ++ public BlockState getPlant(IBlockReader world, BlockPos pos) { ++ return func_176223_P(); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch b/patches_old/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch rename to patches_old/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch diff --git a/patches_old/minecraft/net/minecraft/block/TNTBlock.java.patch b/patches_old/minecraft/net/minecraft/block/TNTBlock.java.patch new file mode 100644 index 000000000..96361ce46 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/TNTBlock.java.patch @@ -0,0 +1,67 @@ +--- a/net/minecraft/block/TNTBlock.java ++++ b/net/minecraft/block/TNTBlock.java +@@ -29,10 +29,14 @@ + this.func_180632_j(this.func_176223_P().func_206870_a(field_212569_a, Boolean.valueOf(false))); + } + ++ public void catchFire(BlockState state, World world, BlockPos pos, @Nullable net.minecraft.util.Direction face, @Nullable LivingEntity igniter) { ++ func_196535_a(world, pos, igniter); ++ } ++ + public void func_220082_b(BlockState p_220082_1_, World p_220082_2_, BlockPos p_220082_3_, BlockState p_220082_4_, boolean p_220082_5_) { + if (p_220082_4_.func_177230_c() != p_220082_1_.func_177230_c()) { + if (p_220082_2_.func_175640_z(p_220082_3_)) { +- func_196534_a(p_220082_2_, p_220082_3_); ++ catchFire(p_220082_1_, p_220082_2_, p_220082_3_, null, null); + p_220082_2_.func_217377_a(p_220082_3_, false); + } + +@@ -41,7 +45,7 @@ + + public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) { + if (p_220069_2_.func_175640_z(p_220069_3_)) { +- func_196534_a(p_220069_2_, p_220069_3_); ++ catchFire(p_220069_1_, p_220069_2_, p_220069_3_, null, null); + p_220069_2_.func_217377_a(p_220069_3_, false); + } + +@@ -49,7 +53,7 @@ + + public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_) { + if (!p_176208_1_.func_201670_d() && !p_176208_4_.func_184812_l_() && p_176208_3_.func_177229_b(field_212569_a)) { +- func_196534_a(p_176208_1_, p_176208_2_); ++ catchFire(p_176208_3_, p_176208_1_, p_176208_2_, null, null); + } + + super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_); +@@ -63,10 +67,12 @@ + } + } + ++ @Deprecated //Forge: Prefer using IForgeBlock#catchFire + public static void func_196534_a(World p_196534_0_, BlockPos p_196534_1_) { + func_196535_a(p_196534_0_, p_196534_1_, (LivingEntity)null); + } + ++ @Deprecated //Forge: Prefer using IForgeBlock#catchFire + private static void func_196535_a(World p_196535_0_, BlockPos p_196535_1_, @Nullable LivingEntity p_196535_2_) { + if (!p_196535_0_.field_72995_K) { + TNTEntity tntentity = new TNTEntity(p_196535_0_, (double)p_196535_1_.func_177958_n() + 0.5D, (double)p_196535_1_.func_177956_o(), (double)p_196535_1_.func_177952_p() + 0.5D, p_196535_2_); +@@ -81,7 +87,7 @@ + if (item != Items.field_151033_d && item != Items.field_151059_bz) { + return super.func_225533_a_(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_4_, p_225533_5_, p_225533_6_); + } else { +- func_196535_a(p_225533_2_, p_225533_3_, p_225533_4_); ++ catchFire(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_6_.func_216354_b(), p_225533_4_); + p_225533_2_.func_180501_a(p_225533_3_, Blocks.field_150350_a.func_176223_P(), 11); + if (!p_225533_4_.func_184812_l_()) { + if (item == Items.field_151033_d) { +@@ -103,7 +109,7 @@ + Entity entity = abstractarrowentity.func_212360_k(); + if (abstractarrowentity.func_70027_ad()) { + BlockPos blockpos = p_220066_3_.func_216350_a(); +- func_196535_a(p_220066_1_, blockpos, entity instanceof LivingEntity ? (LivingEntity)entity : null); ++ catchFire(p_220066_2_, p_220066_1_, blockpos, null, entity instanceof LivingEntity ? (LivingEntity)entity : null); + p_220066_1_.func_217377_a(blockpos, false); + } + } diff --git a/patches_old/minecraft/net/minecraft/block/TallGrassBlock.java.patch b/patches_old/minecraft/net/minecraft/block/TallGrassBlock.java.patch new file mode 100644 index 000000000..9349ebe64 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/TallGrassBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/TallGrassBlock.java ++++ b/net/minecraft/block/TallGrassBlock.java +@@ -8,7 +8,7 @@ + import net.minecraft.world.World; + import net.minecraft.world.server.ServerWorld; + +-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_old/minecraft/net/minecraft/block/WebBlock.java.patch b/patches_old/minecraft/net/minecraft/block/WebBlock.java.patch new file mode 100644 index 000000000..49f30cc9e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/WebBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/WebBlock.java ++++ b/net/minecraft/block/WebBlock.java +@@ -5,7 +5,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/trees/JungleTree.java.patch b/patches_old/minecraft/net/minecraft/block/trees/JungleTree.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/block/trees/JungleTree.java.patch rename to patches_old/minecraft/net/minecraft/block/trees/JungleTree.java.patch diff --git a/patches_old/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches_old/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch new file mode 100644 index 000000000..66abfb624 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/client/ClientBrandRetriever.java ++++ b/net/minecraft/client/ClientBrandRetriever.java +@@ -6,6 +6,6 @@ + @OnlyIn(Dist.CLIENT) + public class ClientBrandRetriever { + public static String getClientModName() { +- return "vanilla"; ++ return net.minecraftforge.fml.BrandingControl.getClientBranding(); + } + } diff --git a/patches_old/minecraft/net/minecraft/client/GameSettings.java.patch b/patches_old/minecraft/net/minecraft/client/GameSettings.java.patch new file mode 100644 index 000000000..20f28711e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/GameSettings.java.patch @@ -0,0 +1,63 @@ +--- a/net/minecraft/client/GameSettings.java ++++ b/net/minecraft/client/GameSettings.java +@@ -171,6 +171,7 @@ + public String field_74363_ab = "en_us"; + + public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) { ++ setForgeKeybindProperties(); + this.field_74317_L = p_i46326_1_; + this.field_74354_ai = new File(p_i46326_2_, "options.txt"); + if (p_i46326_1_.func_147111_S() && Runtime.getRuntime().maxMemory() >= 1000000000L) { +@@ -490,7 +491,11 @@ + + for(KeyBinding keybinding : this.field_74324_K) { + if (s.equals("key_" + keybinding.func_151464_g())) { +- keybinding.func_197979_b(InputMappings.func_197955_a(s1)); ++ if (s1.indexOf(':') != -1) { ++ String[] pts = s1.split(":"); ++ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputMappings.func_197955_a(pts[0])); ++ } else ++ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputMappings.func_197955_a(s1)); + } + } + +@@ -538,6 +543,7 @@ + } + + public void func_74303_b() { ++ if (net.minecraftforge.fml.client.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted. + try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.field_74354_ai), StandardCharsets.UTF_8))) { + printwriter.println("version:" + SharedConstants.func_215069_a().getWorldVersion()); + printwriter.println("autoJump:" + AbstractOption.field_216719_z.func_216741_b(this)); +@@ -615,7 +621,7 @@ + printwriter.println("skipMultiplayerWarning:" + this.field_230152_Z_); + + for(KeyBinding keybinding : this.field_74324_K) { +- printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m()); ++ printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m() + (keybinding.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keybinding.getKeyModifier() : "")); + } + + for(SoundCategory soundcategory : SoundCategory.values()) { +@@ -714,4 +720,22 @@ + + p_198017_1_.func_198985_a(set); + } ++ ++ private void setForgeKeybindProperties() { ++ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME; ++ field_74351_w.setKeyConflictContext(inGame); ++ field_74370_x.setKeyConflictContext(inGame); ++ field_74368_y.setKeyConflictContext(inGame); ++ field_74366_z.setKeyConflictContext(inGame); ++ field_74314_A.setKeyConflictContext(inGame); ++ field_228046_af_.setKeyConflictContext(inGame); ++ field_151444_V.setKeyConflictContext(inGame); ++ field_74312_F.setKeyConflictContext(inGame); ++ field_74310_D.setKeyConflictContext(inGame); ++ field_74321_H.setKeyConflictContext(inGame); ++ field_74323_J.setKeyConflictContext(inGame); ++ field_151457_aa.setKeyConflictContext(inGame); ++ field_151458_ab.setKeyConflictContext(inGame); ++ field_186718_X.setKeyConflictContext(inGame); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/client/KeyboardListener.java.patch b/patches_old/minecraft/net/minecraft/client/KeyboardListener.java.patch new file mode 100644 index 000000000..9b277462d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/KeyboardListener.java.patch @@ -0,0 +1,67 @@ +--- a/net/minecraft/client/KeyboardListener.java ++++ b/net/minecraft/client/KeyboardListener.java +@@ -251,7 +251,9 @@ + } + + INestedGuiEventHandler inestedguieventhandler = this.field_197972_a.field_71462_r; +- if (p_197961_5_ == 1 && (!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) { ++ ++ if ((!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) { ++ if (p_197961_5_ == 1) { + if (this.field_197972_a.field_71474_y.field_152395_am.func_197976_a(p_197961_3_, p_197961_4_)) { + this.field_197972_a.func_228018_at_().func_198077_g(); + this.field_197972_a.field_71474_y.field_74353_u = this.field_197972_a.func_228018_at_().func_198113_j(); +@@ -270,6 +272,8 @@ + }); + return; + } ++ } else if (p_197961_5_ == 0 /*GLFW_RELEASE*/ && this.field_197972_a.field_71462_r instanceof ControlsScreen) ++ ((ControlsScreen)this.field_197972_a.field_71462_r).field_146491_f = null; //Forge: Unset pure modifiers. + } + + boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.getFocused() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.getFocused()).func_212955_f(); +@@ -289,10 +293,14 @@ + Screen.wrapScreenError(() -> { + if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.field_197973_b)) { + if (p_197961_5_ == 0) { +- aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_); ++ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); ++ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_); ++ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); + } + } else { +- aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_); ++ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); ++ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_); ++ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); + } + + }, "keyPressed event handler", inestedguieventhandler.getClass().getCanonicalName()); +@@ -353,7 +361,7 @@ + } + } + } +- ++ net.minecraftforge.client.ForgeHooksClient.fireKeyInput(p_197961_3_, p_197961_4_, p_197961_5_, p_197961_6_); + } + } + +@@ -363,12 +371,16 @@ + if (iguieventlistener != null && this.field_197972_a.func_213250_au() == null) { + if (Character.charCount(p_197963_3_) == 1) { + Screen.wrapScreenError(() -> { +- iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_); ++ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_)) return; ++ if (iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_)) return; ++ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_); + }, "charTyped event handler", iguieventlistener.getClass().getCanonicalName()); + } else { + for(char c0 : Character.toChars(p_197963_3_)) { + Screen.wrapScreenError(() -> { +- iguieventlistener.charTyped(c0, p_197963_4_); ++ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, c0, p_197963_4_)) return; ++ if (iguieventlistener.charTyped(c0, p_197963_4_)) return; ++ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, c0, p_197963_4_); + }, "charTyped event handler", iguieventlistener.getClass().getCanonicalName()); + } + } diff --git a/patches_old/minecraft/net/minecraft/client/MainWindow.java.patch b/patches_old/minecraft/net/minecraft/client/MainWindow.java.patch new file mode 100644 index 000000000..bb6677bab --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/MainWindow.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/MainWindow.java ++++ b/net/minecraft/client/MainWindow.java +@@ -86,7 +86,7 @@ + GLFW.glfwWindowHint(139266, 2); + GLFW.glfwWindowHint(139267, 0); + GLFW.glfwWindowHint(139272, 0); +- this.field_198119_f = GLFW.glfwCreateWindow(this.field_198129_p, this.field_198130_q, p_i51170_5_, this.field_198125_l && monitor != null ? monitor.func_197995_f() : 0L, 0L); ++ this.field_198119_f = net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.handOffWindow(()->this.field_198129_p, ()->this.field_198130_q, ()->p_i51170_5_, ()->this.field_198125_l && monitor != null ? monitor.func_197995_f() : 0L); + if (monitor != null) { + VideoMode videomode = monitor.func_197992_a(this.field_198125_l ? this.field_198124_k : Optional.empty()); + this.field_198120_g = this.field_198127_n = monitor.func_197989_c() + videomode.func_198064_a() / 2 - this.field_198129_p / 2; diff --git a/patches_old/minecraft/net/minecraft/client/Minecraft.java.patch b/patches_old/minecraft/net/minecraft/client/Minecraft.java.patch new file mode 100644 index 000000000..52729db89 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/Minecraft.java.patch @@ -0,0 +1,507 @@ +--- a/net/minecraft/client/Minecraft.java ++++ b/net/minecraft/client/Minecraft.java +@@ -322,6 +322,7 @@ + public Minecraft(GameConfiguration p_i45547_1_) { + super("Client"); + field_71432_P = this; ++ net.minecraftforge.client.ForgeHooksClient.invalidateLog4jThreadCache(); + this.field_71412_D = p_i45547_1_.field_178744_c.field_178760_a; + File file1 = p_i45547_1_.field_178744_c.field_178759_c; + this.field_130070_K = p_i45547_1_.field_178744_c.field_178758_b; +@@ -336,7 +337,6 @@ + this.field_152355_az = (new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString())).createMinecraftSessionService(); + this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a; + field_147123_G.info("Setting user: {}", (Object)this.field_71449_j.func_111285_a()); +- field_147123_G.debug("(Session ID is {})", (Object)this.field_71449_j.func_111286_b()); + this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a; + this.field_147129_ai = func_147122_X(); + this.field_71437_Z = null; +@@ -350,7 +350,7 @@ + i = 0; + } + +- Bootstrap.func_151354_b(); ++ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.func_151354_b(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick); + Bootstrap.func_218821_c(); + KeybindTextComponent.field_193637_b = KeyBinding::func_193626_b; + this.field_184131_U = DataFixesManager.func_210901_a(); +@@ -383,13 +383,13 @@ + + this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i); + this.field_71417_B = new MouseHelper(this); +- this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i()); + this.field_195559_v = new KeyboardListener(this); + this.field_195559_v.func_197968_a(this.field_195558_d.func_198092_i()); + RenderSystem.initRenderer(this.field_71474_y.field_209231_W, false); + this.field_147124_at = new Framebuffer(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), true, field_142025_a); + this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F); + this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, this.field_152352_aC); ++ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax); + this.field_71474_y.func_198017_a(this.field_110448_aq); + this.field_110448_aq.func_198983_a(); + this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab); +@@ -434,12 +434,14 @@ + this.func_193986_ar(); + this.field_110451_am.func_219534_a(this.field_193995_ae); + this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o); ++ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.ParticleFactoryRegisterEvent()); + this.field_110451_am.func_219534_a(this.field_71452_i); + this.field_213272_aL = new PaintingSpriteUploader(this.field_71446_o); + this.field_110451_am.func_219534_a(this.field_213272_aL); + this.field_213273_aM = new PotionSpriteUploader(this.field_71446_o); + this.field_110451_am.func_219534_a(this.field_213273_aM); +- this.field_71456_v = new IngameGui(this); ++ this.field_71456_v = new net.minecraftforge.client.gui.ForgeIngameGui(this); ++ this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler. + this.field_184132_p = new DebugRenderer(this); + RenderSystem.setErrorCallback(this::func_195545_a); + if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) { +@@ -451,12 +453,11 @@ + this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E); + this.field_195558_d.func_227801_c_(); + this.func_213226_a(); +- if (s != null) { +- this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, s, i)); +- } else { +- this.func_147108_a(new MainMenuScreen(true)); +- } + ++ //Final needed so we can move into lambda below. ++ final String autoServerName = s; ++ final int autoServerPort = i; ++ + ResourceLoadProgressGui.func_212970_a(this); + List list = this.field_110448_aq.func_198980_d().stream().map(ResourcePackInfo::func_195796_e).collect(Collectors.toList()); + this.func_213268_a(new ResourceLoadProgressGui(this, this.field_110451_am.func_219537_a(Util.func_215072_e(), this, field_223714_G, list), (p_229990_2_) -> { +@@ -466,6 +467,14 @@ + this.func_213256_aB(); + } + ++ if (net.minecraftforge.fml.client.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen ++ // FORGE: Move opening initial screen to after startup and events are enabled. ++ // Also Fixes MC-145102 ++ if (autoServerName != null) { ++ this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, autoServerName, autoServerPort)); ++ } else { ++ this.func_147108_a(new MainMenuScreen(true)); ++ } + }); + }, false)); + } +@@ -505,7 +514,7 @@ + } + + private void func_229988_a_(Throwable p_229988_1_) { +- if (this.field_110448_aq.func_198980_d().size() > 1) { ++ if (this.field_110448_aq.func_198980_d().stream().anyMatch(e -> !e.func_195797_g())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any. + ITextComponent itextcomponent; + if (p_229988_1_ instanceof SimpleReloadableResourceManager.FailedPackException) { + itextcomponent = new StringTextComponent(((SimpleReloadableResourceManager.FailedPackException)p_229988_1_).func_230028_a().func_195762_a()); +@@ -579,7 +588,7 @@ + return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b())); + }); + SearchTreeReloadable searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> { +- return ItemTags.func_199903_a().func_199913_a(p_213235_0_.func_77973_b()).stream(); ++ return p_213235_0_.func_77973_b().getTags().stream(); + }); + NonNullList nonnulllist = NonNullList.func_191196_a(); + +@@ -667,13 +676,13 @@ + Bootstrap.func_179870_a(p_71377_0_.func_71502_e()); + if (p_71377_0_.func_71497_f() != null) { + Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.func_71497_f()); +- System.exit(-1); ++ net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-1); + } else if (p_71377_0_.func_147149_a(file2)) { + Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); +- System.exit(-1); ++ net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-1); + } else { + Bootstrap.func_179870_a("#@?@# Game crashed! Crash report could not be saved. #@?@#"); +- System.exit(-2); ++ net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-2); + } + + } +@@ -682,6 +691,7 @@ + return this.field_71474_y.field_211842_aO; + } + ++ @Deprecated // Forge: Use selective refreshResources method in FMLClientHandler + public CompletableFuture func_213237_g() { + if (this.field_213276_aV != null) { + return this.field_213276_aV; +@@ -760,10 +770,6 @@ + } + + public void func_147108_a(@Nullable Screen p_147108_1_) { +- if (this.field_71462_r != null) { +- this.field_71462_r.removed(); +- } +- + if (p_147108_1_ == null && this.field_71441_e == null) { + p_147108_1_ = new MainMenuScreen(); + } else if (p_147108_1_ == null && this.field_71439_g.func_110143_aJ() <= 0.0F) { +@@ -774,6 +780,14 @@ + } + } + ++ Screen old = this.field_71462_r; ++ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(p_147108_1_); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ ++ p_147108_1_ = event.getGui(); ++ if (old != null && p_147108_1_ != old) ++ old.removed(); ++ + if (p_147108_1_ instanceof MainMenuScreen || p_147108_1_ instanceof MultiplayerScreen) { + this.field_71474_y.field_74330_P = false; + this.field_71456_v.func_146158_b().func_146231_a(true); +@@ -905,11 +919,13 @@ + RenderSystem.enableTexture(); + this.field_71424_I.func_76319_b(); + if (!this.field_71454_w) { ++ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickStart(this.field_71428_T.field_194147_b); + this.field_71424_I.func_219895_b("gameRenderer"); + this.field_71460_t.func_195458_a(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b, i, p_195542_1_); + this.field_71424_I.func_219895_b("toasts"); + this.field_193034_aS.func_195625_a(); + this.field_71424_I.func_76319_b(); ++ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickEnd(this.field_71428_T.field_194147_b); + } + + this.field_71424_I.func_219897_b(); +@@ -976,7 +992,7 @@ + + Framebuffer framebuffer = this.func_147110_a(); + framebuffer.func_216491_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), field_142025_a); +- this.field_71460_t.func_147704_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l()); ++ if (this.field_71460_t!=null) this.field_71460_t.func_147704_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l()); + this.field_71417_B.func_198021_g(); + } + +@@ -1164,11 +1180,21 @@ + if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) { + BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x; + BlockPos blockpos = blockraytraceresult.func_216350_a(); +- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) { ++ if (!this.field_71441_e.func_175623_d(blockpos)) { ++ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.field_71474_y.field_74312_F, Hand.MAIN_HAND); ++ if (inputEvent.isCanceled()) { ++ if (inputEvent.shouldSwingHand()) { ++ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult); ++ this.field_71439_g.func_184609_a(Hand.MAIN_HAND); ++ } ++ return; ++ } + Direction direction = blockraytraceresult.func_216354_b(); + if (this.field_71442_b.func_180512_c(blockpos, direction)) { +- this.field_71452_i.func_180532_a(blockpos, direction); ++ if (inputEvent.shouldSwingHand()) { ++ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult); + this.field_71439_g.func_184609_a(Hand.MAIN_HAND); ++ } + } + } + +@@ -1187,6 +1213,8 @@ + } + + } else if (!this.field_71439_g.func_184838_M()) { ++ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.field_71474_y.field_74312_F, Hand.MAIN_HAND); ++ if (!inputEvent.isCanceled()) + switch(this.field_71476_x.func_216346_c()) { + case ENTITY: + this.field_71442_b.func_78764_a(this.field_71439_g, ((EntityRayTraceResult)this.field_71476_x).func_216348_a()); +@@ -1194,7 +1222,7 @@ + case BLOCK: + BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x; + BlockPos blockpos = blockraytraceresult.func_216350_a(); +- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) { ++ if (!this.field_71441_e.func_175623_d(blockpos)) { + this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b()); + break; + } +@@ -1204,8 +1232,10 @@ + } + + this.field_71439_g.func_184821_cY(); ++ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.field_71439_g); + } + ++ if (inputEvent.shouldSwingHand()) + this.field_71439_g.func_184609_a(Hand.MAIN_HAND); + } + } +@@ -1220,6 +1250,11 @@ + } + + for(Hand hand : Hand.values()) { ++ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.field_71474_y.field_74313_G, hand); ++ if (inputEvent.isCanceled()) { ++ if (inputEvent.shouldSwingHand()) this.field_71439_g.func_184609_a(hand); ++ return; ++ } + ItemStack itemstack = this.field_71439_g.func_184586_b(hand); + if (this.field_71476_x != null) { + switch(this.field_71476_x.func_216346_c()) { +@@ -1233,6 +1268,7 @@ + + if (actionresulttype.func_226246_a_()) { + if (actionresulttype.func_226247_b_()) { ++ if (inputEvent.shouldSwingHand()) + this.field_71439_g.func_184609_a(hand); + } + +@@ -1245,6 +1281,7 @@ + ActionResultType actionresulttype1 = this.field_71442_b.func_217292_a(this.field_71439_g, this.field_71441_e, hand, blockraytraceresult); + if (actionresulttype1.func_226246_a_()) { + if (actionresulttype1.func_226247_b_()) { ++ if (inputEvent.shouldSwingHand()) + this.field_71439_g.func_184609_a(hand); + if (!itemstack.func_190926_b() && (itemstack.func_190916_E() != i || this.field_71442_b.func_78758_h())) { + this.field_71460_t.field_78516_c.func_187460_a(hand); +@@ -1260,6 +1297,9 @@ + } + } + ++ if (itemstack.func_190926_b() && (this.field_71476_x == null || this.field_71476_x.func_216346_c() == RayTraceResult.Type.MISS)) ++ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, hand); ++ + if (!itemstack.func_190926_b()) { + ActionResultType actionresulttype2 = this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand); + if (actionresulttype2.func_226246_a_()) { +@@ -1286,6 +1326,8 @@ + --this.field_71467_ac; + } + ++ net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick(); ++ + this.field_71424_I.func_76320_a("gui"); + if (!this.field_71445_n) { + this.field_71456_v.func_73831_a(); +@@ -1403,6 +1445,8 @@ + this.field_71424_I.func_219895_b("keyboard"); + this.field_195559_v.func_204870_b(); + this.field_71424_I.func_76319_b(); ++ ++ net.minecraftforge.fml.hooks.BasicEventHooks.onPostClientTick(); + } + + private void func_184117_aA() { +@@ -1557,6 +1601,12 @@ + this.func_147108_a(worldloadprogressscreen); + + while(!this.field_71437_Z.func_71200_ad()) { ++ if (!net.minecraftforge.fml.StartupQuery.check() || this.field_71437_Z.func_71241_aa()) { ++ this.func_147108_a(null); ++ return; ++ } else if (this.field_71462_r == null) // if we're showing nothing, put the working screen back again ++ this.func_147108_a(worldloadprogressscreen); ++ + worldloadprogressscreen.tick(); + this.func_195542_b(false); + +@@ -1577,11 +1627,17 @@ + networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> { + })); + networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN)); +- networkmanager.func_179290_a(new CLoginStartPacket(this.func_110432_I().func_148256_e())); ++ com.mojang.authlib.GameProfile gameProfile = this.func_110432_I().func_148256_e(); ++ if (!this.func_110432_I().hasCachedProperties()) { ++ gameProfile = field_152355_az.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. ++ this.func_110432_I().setProperties(gameProfile.getProperties()); ++ } ++ networkmanager.func_179290_a(new CLoginStartPacket(gameProfile)); + this.field_71453_ak = networkmanager; + } + + public void func_71403_a(ClientWorld p_71403_1_) { ++ if (field_71441_e != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e)); + WorkingScreen workingscreen = new WorkingScreen(); + workingscreen.func_200210_a(new TranslationTextComponent("connect.joining")); + this.func_213241_c(workingscreen); +@@ -1613,10 +1669,12 @@ + IntegratedServer integratedserver = this.field_71437_Z; + this.field_71437_Z = null; + this.field_71460_t.func_190564_k(); ++ net.minecraftforge.fml.client.ClientHooks.firePlayerLogout(this.field_71442_b, this.field_71439_g); + this.field_71442_b = null; + NarratorChatListener.field_193643_a.func_193642_b(); + this.func_213241_c(p_213231_1_); + if (this.field_71441_e != null) { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e)); + if (integratedserver != null) { + while(!integratedserver.func_213201_w()) { + this.func_195542_b(false); +@@ -1627,6 +1685,7 @@ + this.field_71456_v.func_181029_i(); + this.field_71422_O = null; + this.field_71455_al = false; ++ net.minecraftforge.fml.client.ClientHooks.handleClientWorldClosing(field_71441_e); + this.field_213274_aO.func_216815_b(); + } + +@@ -1649,6 +1708,7 @@ + this.field_71452_i.func_78870_a(p_213257_1_); + TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_); + this.func_230150_b_(); ++ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache(); + } + + public final boolean func_71355_q() { +@@ -1674,112 +1734,9 @@ + + private void func_147112_ai() { + if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) { +- boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d; +- TileEntity tileentity = null; +- RayTraceResult.Type raytraceresult$type = this.field_71476_x.func_216346_c(); +- ItemStack itemstack; +- if (raytraceresult$type == RayTraceResult.Type.BLOCK) { +- BlockPos blockpos = ((BlockRayTraceResult)this.field_71476_x).func_216350_a(); +- BlockState blockstate = this.field_71441_e.func_180495_p(blockpos); +- Block block = blockstate.func_177230_c(); +- if (blockstate.func_196958_f()) { +- return; +- } +- +- itemstack = block.func_185473_a(this.field_71441_e, blockpos, blockstate); +- if (itemstack.func_190926_b()) { +- return; +- } +- +- if (flag && Screen.hasControlDown() && block.func_149716_u()) { +- tileentity = this.field_71441_e.func_175625_s(blockpos); +- } +- } else { +- if (raytraceresult$type != RayTraceResult.Type.ENTITY || !flag) { +- return; +- } +- +- Entity entity = ((EntityRayTraceResult)this.field_71476_x).func_216348_a(); +- if (entity instanceof PaintingEntity) { +- itemstack = new ItemStack(Items.field_151159_an); +- } else if (entity instanceof LeashKnotEntity) { +- itemstack = new ItemStack(Items.field_151058_ca); +- } else if (entity instanceof ItemFrameEntity) { +- ItemFrameEntity itemframeentity = (ItemFrameEntity)entity; +- ItemStack itemstack1 = itemframeentity.func_82335_i(); +- if (itemstack1.func_190926_b()) { +- itemstack = new ItemStack(Items.field_151160_bD); +- } else { +- itemstack = itemstack1.func_77946_l(); +- } +- } else if (entity instanceof AbstractMinecartEntity) { +- AbstractMinecartEntity abstractminecartentity = (AbstractMinecartEntity)entity; +- Item item; +- switch(abstractminecartentity.func_184264_v()) { +- case FURNACE: +- item = Items.field_151109_aJ; +- break; +- case CHEST: +- item = Items.field_151108_aI; +- break; +- case TNT: +- item = Items.field_151142_bV; +- break; +- case HOPPER: +- item = Items.field_151140_bW; +- break; +- case COMMAND_BLOCK: +- item = Items.field_151095_cc; +- break; +- default: +- item = Items.field_151143_au; +- } +- +- itemstack = new ItemStack(item); +- } else if (entity instanceof BoatEntity) { +- itemstack = new ItemStack(((BoatEntity)entity).func_184455_j()); +- } else if (entity instanceof ArmorStandEntity) { +- itemstack = new ItemStack(Items.field_179565_cj); +- } else if (entity instanceof EnderCrystalEntity) { +- itemstack = new ItemStack(Items.field_185158_cP); +- } else { +- SpawnEggItem spawneggitem = SpawnEggItem.func_200889_b(entity.func_200600_R()); +- if (spawneggitem == null) { +- return; +- } +- +- itemstack = new ItemStack(spawneggitem); +- } +- } +- +- if (itemstack.func_190926_b()) { +- String s = ""; +- if (raytraceresult$type == RayTraceResult.Type.BLOCK) { +- s = Registry.field_212618_g.func_177774_c(this.field_71441_e.func_180495_p(((BlockRayTraceResult)this.field_71476_x).func_216350_a()).func_177230_c()).toString(); +- } else if (raytraceresult$type == RayTraceResult.Type.ENTITY) { +- s = Registry.field_212629_r.func_177774_c(((EntityRayTraceResult)this.field_71476_x).func_216348_a().func_200600_R()).toString(); +- } +- +- field_147123_G.warn("Picking on: [{}] {} gave null item", raytraceresult$type, s); +- } else { +- PlayerInventory playerinventory = this.field_71439_g.field_71071_by; +- if (tileentity != null) { +- this.func_184119_a(itemstack, tileentity); +- } +- +- int i = playerinventory.func_184429_b(itemstack); +- if (flag) { +- playerinventory.func_184434_a(itemstack); +- this.field_71442_b.func_78761_a(this.field_71439_g.func_184586_b(Hand.MAIN_HAND), 36 + playerinventory.field_70461_c); +- } else if (i != -1) { +- if (PlayerInventory.func_184435_e(i)) { +- playerinventory.field_70461_c = i; +- } else { +- this.field_71442_b.func_187100_a(i); +- } +- } +- +- } ++ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.field_71474_y.field_74322_I, Hand.MAIN_HAND).isCanceled()) ++ net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e); ++ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions + } + } + +@@ -1861,6 +1818,7 @@ + return field_71432_P; + } + ++ @Deprecated // Forge: Use selective scheduleResourceRefresh method in FMLClientHandler + public CompletableFuture func_213245_w() { + return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> { + return p_229993_0_; +@@ -1988,6 +1946,8 @@ + } + + public MusicTicker.MusicType func_147109_W() { ++ MusicTicker.MusicType type = this.field_71441_e == null || this.field_71441_e.field_73011_w == null ? null : this.field_71441_e.field_73011_w.getMusicType(); ++ if (type != null) return type; + if (this.field_71462_r instanceof WinGameScreen) { + return MusicTicker.MusicType.CREDITS; + } else if (this.field_71439_g == null) { +@@ -2164,7 +2124,7 @@ + supplier = func_228022_c_(supplier); + } + +- return new ClientResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_); ++ return new ClientResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_, p_228011_3_.isHidden()); + } + + private static Supplier func_228021_b_(Supplier p_228021_0_) { +@@ -2182,4 +2142,12 @@ + public void func_228020_b_(int p_228020_1_) { + this.field_175617_aL.func_229355_a_(p_228020_1_); + } ++ ++ public ItemColors getItemColors() { ++ return this.field_184128_aI; ++ } ++ ++ public SearchTreeManager getSearchTreeManager() { ++ return this.field_193995_ae; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/client/MouseHelper.java.patch b/patches_old/minecraft/net/minecraft/client/MouseHelper.java.patch new file mode 100644 index 000000000..7919bd9f9 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/MouseHelper.java.patch @@ -0,0 +1,93 @@ +--- a/net/minecraft/client/MouseHelper.java ++++ b/net/minecraft/client/MouseHelper.java +@@ -66,6 +66,7 @@ + this.field_198042_g = -1; + } + ++ if (net.minecraftforge.client.ForgeHooksClient.onRawMouseClicked(p_198023_3_, p_198023_4_, p_198023_5_)) return; + boolean[] aboolean = new boolean[]{false}; + if (this.field_198036_a.field_213279_p == null) { + if (this.field_198036_a.field_71462_r == null) { +@@ -77,11 +78,15 @@ + double d1 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n(); + if (flag) { + Screen.wrapScreenError(() -> { +- aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, i); ++ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.field_198036_a.field_71462_r, d0, d1, i); ++ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, i); ++ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.field_198036_a.field_71462_r, d0, d1, i); + }, "mouseClicked event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName()); + } else { + Screen.wrapScreenError(() -> { +- aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, i); ++ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.field_198036_a.field_71462_r, d0, d1, i); ++ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, i); ++ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.field_198036_a.field_71462_r, d0, d1, i); + }, "mouseReleased event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName()); + } + } +@@ -105,7 +110,7 @@ + } + } + } +- ++ net.minecraftforge.client.ForgeHooksClient.fireMouseInput(p_198023_3_, p_198023_4_, p_198023_5_); + } + } + +@@ -116,7 +121,9 @@ + if (this.field_198036_a.field_71462_r != null) { + double d1 = this.field_198040_e * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m(); + double d2 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n(); +- this.field_198036_a.field_71462_r.mouseScrolled(d1, d2, d0); ++ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.field_198036_a.field_71462_r, d0)) return; ++ if (this.field_198036_a.field_71462_r.mouseScrolled(d1, d2, d0)) return; ++ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.field_198036_a.field_71462_r, d0); + } else if (this.field_198036_a.field_71439_g != null) { + if (this.field_200542_o != 0.0D && Math.signum(d0) != Math.signum(this.field_200542_o)) { + this.field_200542_o = 0.0D; +@@ -129,6 +136,7 @@ + } + + this.field_200542_o -= (double)f1; ++ if (net.minecraftforge.client.ForgeHooksClient.onMouseScroll(this, d0)) return; + if (this.field_198036_a.field_71439_g.func_175149_v()) { + if (this.field_198036_a.field_71456_v.func_175187_g().func_175262_a()) { + this.field_198036_a.field_71456_v.func_175187_g().func_195621_a((double)(-f1)); +@@ -180,7 +188,9 @@ + double d2 = (p_198022_3_ - this.field_198040_e) * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m(); + double d3 = (p_198022_5_ - this.field_198041_f) * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n(); + Screen.wrapScreenError(() -> { +- iguieventlistener.mouseDragged(d0, d1, this.field_198042_g, d2, d3); ++ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3)) return; ++ if (iguieventlistener.mouseDragged(d0, d1, this.field_198042_g, d2, d3)) return; ++ net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3); + }, "mouseDragged event handler", iguieventlistener.getClass().getCanonicalName()); + } + } +@@ -245,6 +255,10 @@ + return this.field_198039_d; + } + ++ public boolean isMiddleDown() { ++ return this.field_198038_c; ++ } ++ + public double func_198024_e() { + return this.field_198040_e; + } +@@ -253,6 +267,14 @@ + return this.field_198041_f; + } + ++ public double getXVelocity() { ++ return this.field_198048_m; ++ } ++ ++ public double getYVelocity() { ++ return this.field_198049_n; ++ } ++ + public void func_198021_g() { + this.field_198043_h = true; + } diff --git a/patches/minecraft/net/minecraft/client/gui/RenderComponentsUtil.java.patch b/patches_old/minecraft/net/minecraft/client/gui/RenderComponentsUtil.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/client/gui/RenderComponentsUtil.java.patch rename to patches_old/minecraft/net/minecraft/client/gui/RenderComponentsUtil.java.patch diff --git a/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch b/patches_old/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch rename to patches_old/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch diff --git a/patches/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch b/patches_old/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch rename to patches_old/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch diff --git a/patches_old/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch b/patches_old/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch new file mode 100644 index 000000000..74522efd6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/client/multiplayer/ClientChunkProvider.java ++++ b/net/minecraft/client/multiplayer/ClientChunkProvider.java +@@ -59,6 +59,7 @@ + int i = this.field_217256_d.func_217191_a(p_73234_1_, p_73234_2_); + Chunk chunk = this.field_217256_d.func_217192_a(i); + if (func_217249_a(chunk, p_73234_1_, p_73234_2_)) { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(chunk)); + this.field_217256_d.func_217190_a(i, chunk, (Chunk)null); + } + +@@ -112,6 +113,7 @@ + } + + this.field_73235_d.func_228323_e_(p_228313_1_, p_228313_2_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); + return chunk; + } + } diff --git a/patches_old/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch b/patches_old/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch new file mode 100644 index 000000000..334cd67c3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/client/multiplayer/ServerData.java ++++ b/net/minecraft/client/multiplayer/ServerData.java +@@ -22,6 +22,7 @@ + private ServerData.ServerResourceMode field_152587_j = ServerData.ServerResourceMode.PROMPT; + private String field_147411_m; + private boolean field_181042_l; ++ public net.minecraftforge.fml.client.ExtendedServerListData forgeData = null; + + public ServerData(String p_i46420_1_, String p_i46420_2_, boolean p_i46420_3_) { + this.field_78847_a = p_i46420_1_; diff --git a/patches_old/minecraft/net/minecraft/client/network/ServerPinger.java.patch b/patches_old/minecraft/net/minecraft/client/network/ServerPinger.java.patch new file mode 100644 index 000000000..112890700 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/network/ServerPinger.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/network/ServerPinger.java ++++ b/net/minecraft/client/network/ServerPinger.java +@@ -120,6 +120,8 @@ + p_147224_1_.func_147407_a((String)null); + } + ++ net.minecraftforge.fml.client.ClientHooks.processForgeListPingData(serverstatusresponse, p_147224_1_); ++ + this.field_175092_e = Util.func_211177_b(); + networkmanager.func_179290_a(new CPingPacket(this.field_175092_e)); + this.field_147403_d = true; diff --git a/patches_old/minecraft/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java.patch b/patches_old/minecraft/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java.patch new file mode 100644 index 000000000..0316cf024 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/client/network/login/ClientLoginNetHandler.java.patch b/patches_old/minecraft/net/minecraft/client/network/login/ClientLoginNetHandler.java.patch new file mode 100644 index 000000000..ce3024d69 --- /dev/null +++ b/patches_old/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)); + } + +@@ -126,6 +127,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_old/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch b/patches_old/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch new file mode 100644 index 000000000..1d23d4117 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch @@ -0,0 +1,110 @@ +--- a/net/minecraft/client/network/play/ClientPlayNetHandler.java ++++ b/net/minecraft/client/network/play/ClientPlayNetHandler.java +@@ -361,6 +361,7 @@ + + this.field_147299_f.field_184132_p.func_217737_a(); + this.field_147299_f.field_71439_g.func_70065_x(); ++ net.minecraftforge.fml.client.ClientHooks.firePlayerLogin(this.field_147299_f.field_71442_b, this.field_147299_f.field_71439_g, this.field_147299_f.func_147114_u().func_147298_b()); + int i = p_147282_1_.func_149197_c(); + this.field_147300_g.func_217408_a(i, this.field_147299_f.field_71439_g); + this.field_147299_f.field_71439_g.field_71158_b = new MovementInputFromOptions(this.field_147299_f.field_71474_y); +@@ -372,6 +373,7 @@ + this.field_147299_f.field_71439_g.func_175150_k(p_147282_1_.func_179744_h()); + this.field_147299_f.field_71439_g.func_228355_a_(p_147282_1_.func_229743_k_()); + this.field_147299_f.field_71442_b.func_78746_a(p_147282_1_.func_149198_e()); ++ net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(field_147302_e, "PLAY_TO_SERVER"); + this.field_147299_f.field_71474_y.func_82879_c(); + this.field_147302_e.func_179290_a(new CCustomPayloadPacket(CCustomPayloadPacket.field_210344_a, (new PacketBuffer(Unpooled.buffer())).func_180714_a(ClientBrandRetriever.getClientModName()))); + this.field_147299_f.func_213229_ar().func_216814_a(); +@@ -727,7 +729,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); + } + } + +@@ -803,7 +805,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_) { +@@ -983,8 +987,10 @@ + this.field_147299_f.field_175622_Z = clientplayerentity1; + clientplayerentity1.func_184212_Q().func_187218_a(clientplayerentity.func_184212_Q().func_187231_c()); + clientplayerentity1.func_110140_aT().func_226303_a_(clientplayerentity.func_110140_aT()); ++ clientplayerentity1.updateSyncFields(clientplayerentity); // Forge: fix MC-10657 + clientplayerentity1.func_70065_x(); + clientplayerentity1.func_175158_f(s); ++ net.minecraftforge.fml.client.ClientHooks.firePlayerRespawn(this.field_147299_f.field_71442_b, clientplayerentity, clientplayerentity1, clientplayerentity1.field_71174_a.func_147298_b()); + this.field_147300_g.func_217408_a(i, clientplayerentity1); + clientplayerentity1.field_70177_z = -180.0F; + clientplayerentity1.field_71158_b = new MovementInputFromOptions(this.field_147299_f.field_71474_y); +@@ -1105,6 +1111,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 || i == 14 && tileentity instanceof BeehiveTileEntity) { + 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) { +@@ -1276,6 +1288,7 @@ + clientrecipebook.func_199644_c(); + clientrecipebook.func_199642_d().forEach(imutablesearchtree::func_217872_a); + imutablesearchtree.func_194040_a(); ++ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.field_199528_o); + } + + public void func_200232_a(SPlayerLookPacket p_200232_1_) { +@@ -1356,7 +1369,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()); +@@ -1376,6 +1389,7 @@ + } + + this.field_147299_f.func_213253_a(SearchTreeManager.field_215360_b).func_194040_a(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.field_199725_m)); + } + + public void func_175098_a(SCombatPacket p_175098_1_) { +@@ -1851,10 +1865,12 @@ + int l5 = packetbuffer.readInt(); + this.field_147299_f.field_184132_p.field_229018_q_.func_229022_a_(blockpos7, l3, s10, l5); + } else { +- field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation); ++ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147240_1_, this.field_147302_e)) ++ field_147301_d.warn("Unknown custom packet identifier: {}", (Object)resourcelocation); + } + } finally { + if (packetbuffer != null) { ++ if (false) // Forge: let packet handle releasing buffer + packetbuffer.release(); + } + +@@ -1994,7 +2010,7 @@ + for(SEntityPropertiesPacket.Snapshot sentitypropertiespacket$snapshot : p_147290_1_.func_149441_d()) { + IAttributeInstance iattributeinstance = abstractattributemap.func_111152_a(sentitypropertiespacket$snapshot.func_151409_a()); + if (iattributeinstance == null) { +- iattributeinstance = abstractattributemap.func_111150_b(new RangedAttribute((IAttribute)null, sentitypropertiespacket$snapshot.func_151409_a(), 0.0D, Double.MIN_NORMAL, Double.MAX_VALUE)); ++ iattributeinstance = abstractattributemap.func_111150_b(new RangedAttribute((IAttribute)null, sentitypropertiespacket$snapshot.func_151409_a(), 0.0D, -Double.MAX_VALUE, Double.MAX_VALUE)); // FORGE: fix invalid value range (MC-150405) + } + + iattributeinstance.func_111128_a(sentitypropertiespacket$snapshot.func_151410_b()); diff --git a/patches_old/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch b/patches_old/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch new file mode 100644 index 000000000..98b2abe75 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/client/renderer/RenderTypeLookup.java ++++ b/net/minecraft/client/renderer/RenderTypeLookup.java +@@ -256,8 +259,7 @@ + } + + public static RenderType func_228394_b_(BlockState p_228394_0_) { +- RenderType rendertype = func_228390_a_(p_228394_0_); +- return rendertype == RenderType.func_228645_f_() ? Atlases.func_228784_i_() : Atlases.func_228783_h_(); ++ return canRenderInLayer(p_228394_0_, RenderType.func_228645_f_()) ? Atlases.func_228784_i_() : Atlases.func_228783_h_(); + } + + public static RenderType func_228389_a_(ItemStack p_228389_0_) { diff --git a/patches_old/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch b/patches_old/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch new file mode 100644 index 000000000..05653b3b1 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/client/resources/FoliageColorReloadListener.java ++++ b/net/minecraft/client/resources/FoliageColorReloadListener.java +@@ -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 //Forge: TODO: Filtered resource reloading ++ public net.minecraftforge.resource.IResourceType getResourceType() { ++ return net.minecraftforge.resource.VanillaResourceType.TEXTURES; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch b/patches_old/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch new file mode 100644 index 000000000..c6ec74d07 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/client/resources/GrassColorReloadListener.java ++++ b/net/minecraft/client/resources/GrassColorReloadListener.java +@@ -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 //Forge: TODO: Filtered resource reloading ++ public net.minecraftforge.resource.IResourceType getResourceType() { ++ return net.minecraftforge.resource.VanillaResourceType.TEXTURES; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/client/resources/I18n.java.patch b/patches_old/minecraft/net/minecraft/client/resources/I18n.java.patch new file mode 100644 index 000000000..093574f21 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/resources/I18n.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/client/resources/I18n.java ++++ b/net/minecraft/client/resources/I18n.java +@@ -9,6 +9,7 @@ + + static void func_135051_a(Locale p_135051_0_) { + field_135054_a = p_135051_0_; ++ net.minecraftforge.fml.ForgeI18n.loadLanguageData(field_135054_a.field_135032_a); + } + + public static String func_135052_a(String p_135052_0_, Object... p_135052_1_) { diff --git a/patches_old/minecraft/net/minecraft/client/resources/JsonReloadListener.java.patch b/patches_old/minecraft/net/minecraft/client/resources/JsonReloadListener.java.patch new file mode 100644 index 000000000..769f14d8c --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/resources/JsonReloadListener.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/resources/JsonReloadListener.java ++++ b/net/minecraft/client/resources/JsonReloadListener.java +@@ -61,4 +61,8 @@ + + return map; + } ++ ++ protected ResourceLocation getPreparedPath(ResourceLocation rl) { ++ return new ResourceLocation(rl.func_110624_b(), this.field_223383_d + "/" + rl.func_110623_a() + ".json"); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/client/resources/Language.java.patch b/patches_old/minecraft/net/minecraft/client/resources/Language.java.patch new file mode 100644 index 000000000..fd7f9dc96 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/resources/Language.java.patch @@ -0,0 +1,24 @@ +--- a/net/minecraft/client/resources/Language.java ++++ b/net/minecraft/client/resources/Language.java +@@ -15,6 +15,12 @@ + this.field_135037_b = p_i1303_2_; + this.field_135038_c = p_i1303_3_; + this.field_135036_d = p_i1303_4_; ++ String[] splitLangCode = field_135038_c.split("_", 2); ++ if (splitLangCode.length == 1) { // Vanilla has some languages without underscores ++ this.javaLocale = new java.util.Locale(field_135039_a); ++ } else { ++ this.javaLocale = new java.util.Locale(splitLangCode[0], splitLangCode[1]); ++ } + } + + 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); + } ++ ++ // Forge: add access to Locale so modders can create correct string and number formatters ++ private final java.util.Locale javaLocale; ++ public java.util.Locale getJavaLocale() { return javaLocale; } + } diff --git a/patches_old/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches_old/minecraft/net/minecraft/client/resources/LanguageManager.java.patch new file mode 100644 index 000000000..f0f65dfcb --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/resources/LanguageManager.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/client/resources/LanguageManager.java ++++ b/net/minecraft/client/resources/LanguageManager.java +@@ -79,4 +79,9 @@ + public Language func_191960_a(String p_191960_1_) { + return this.field_135046_d.get(p_191960_1_); + } ++ ++ @Override ++ public net.minecraftforge.resource.IResourceType getResourceType() { ++ return net.minecraftforge.resource.VanillaResourceType.LANGUAGES; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/client/settings/KeyBinding.java.patch b/patches_old/minecraft/net/minecraft/client/settings/KeyBinding.java.patch new file mode 100644 index 000000000..e22e4809e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/settings/KeyBinding.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/client/settings/KeyBinding.java ++++ b/net/minecraft/client/settings/KeyBinding.java +@@ -155,6 +175,7 @@ + } + + public String func_197978_k() { ++ return getKeyModifier().getLocalizedComboName(this.field_74512_d, () -> { + String s = this.field_74512_d.func_197935_d(); + int i = this.field_74512_d.func_197937_c(); + String s1 = null; +@@ -171,16 +192,97 @@ + } + + return s1 == null ? I18n.func_135052_a(s) : s1; ++ }); + } + + public boolean func_197985_l() { diff --git a/patches_old/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches_old/minecraft/net/minecraft/client/shader/Framebuffer.java.patch new file mode 100644 index 000000000..c94cb23d0 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -0,0 +1,47 @@ +--- a/net/minecraft/client/shader/Framebuffer.java ++++ b/net/minecraft/client/shader/Framebuffer.java +@@ -100,8 +100,14 @@ + GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227594_c_, 3553, this.field_147617_g, 0); + if (this.field_147619_e) { + GlStateManager.func_227730_i_(FramebufferConstants.field_227593_b_, this.field_147624_h); ++ if (!stencilEnabled) { + GlStateManager.func_227678_b_(FramebufferConstants.field_227593_b_, 33190, this.field_147622_a, this.field_147620_b); + GlStateManager.func_227693_c_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227595_d_, FramebufferConstants.field_227593_b_, this.field_147624_h); ++ } else { ++ GlStateManager.func_227678_b_(FramebufferConstants.field_227593_b_, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.field_147622_a, this.field_147620_b); ++ GlStateManager.func_227693_c_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, FramebufferConstants.field_227593_b_, this.field_147624_h); ++ GlStateManager.func_227693_c_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, FramebufferConstants.field_227593_b_, this.field_147624_h); ++ } + } + + this.func_147611_b(); +@@ -254,4 +260,29 @@ + GlStateManager.func_227658_a_(i, p_216493_1_); + this.func_147609_e(); + } ++ ++ /*================================ FORGE START ================================================*/ ++ private boolean stencilEnabled = false; ++ /** ++ * Attempts to enable 8 bits of stencil buffer on this FrameBuffer. ++ * Modders must call this directly to set things up. ++ * This is to prevent the default cause where graphics cards do not support stencil bits. ++ * Make sure to call this on the main render thread! ++ */ ++ public void enableStencil() ++ { ++ if(stencilEnabled) return; ++ stencilEnabled = true; ++ this.func_216491_a(field_147621_c, field_147618_d, net.minecraft.client.Minecraft.field_142025_a); ++ } ++ ++ /** ++ * Returns wither or not this FBO has been successfully initialized with stencil bits. ++ * If not, and a modder wishes it to be, they must call enableStencil. ++ */ ++ public boolean isStencilEnabled() ++ { ++ return this.stencilEnabled; ++ } ++ /*================================ FORGE END ================================================*/ + } diff --git a/patches/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch b/patches_old/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch rename to patches_old/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch diff --git a/patches_old/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch b/patches_old/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch new file mode 100644 index 000000000..464d7dd5e --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch b/patches_old/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch new file mode 100644 index 000000000..e821230c2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/client/util/SearchTreeManager.java ++++ b/net/minecraft/client/util/SearchTreeManager.java +@@ -31,6 +31,11 @@ + return (IMutableSearchTree) this.field_194013_c.get(p_215358_1_); + } + ++ @Override ++ public net.minecraftforge.resource.IResourceType getResourceType() { ++ return net.minecraftforge.resource.VanillaResourceType.LANGUAGES; ++ } ++ + @OnlyIn(Dist.CLIENT) + public static class Key { + } diff --git a/patches_old/minecraft/net/minecraft/client/world/ClientWorld.java.patch b/patches_old/minecraft/net/minecraft/client/world/ClientWorld.java.patch new file mode 100644 index 000000000..a07b850b4 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/world/ClientWorld.java.patch @@ -0,0 +1,71 @@ +--- a/net/minecraft/client/world/ClientWorld.java ++++ b/net/minecraft/client/world/ClientWorld.java +@@ -103,6 +103,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_) { +@@ -127,6 +129,7 @@ + Entity entity = this.field_217428_a.get(i); + this.func_217390_a((p_228325_0_) -> { + ++p_228325_0_.field_70173_aa; ++ if (p_228325_0_.canUpdate()) + p_228325_0_.func_70071_h_(); + }, entity); + if (entity.field_70128_L) { +@@ -172,6 +175,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(); + } +@@ -289,9 +293,11 @@ + } + + private void func_217424_b(int p_217424_1_, Entity p_217424_2_) { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_217424_2_, this))) return; + 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_.func_226277_ct_() / 16.0D), MathHelper.func_76128_c(p_217424_2_.func_226281_cx_() / 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_) { +@@ -310,6 +316,7 @@ + } + + this.field_217431_w.remove(p_217414_1_); ++ p_217414_1_.onRemovedFromWorld(); + } + + public void func_217417_b(Chunk p_217417_1_) { +@@ -443,6 +450,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); + } +@@ -450,6 +462,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_old/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch b/patches_old/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch new file mode 100644 index 000000000..431af2cc0 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/command/arguments/EntitySelectorParser.java ++++ b/net/minecraft/command/arguments/EntitySelectorParser.java +@@ -448,6 +448,9 @@ + } + + this.field_197417_j.skip(); ++ EntitySelector forgeSelector = net.minecraftforge.common.command.EntitySelectorManager.parseSelector(this); ++ if (forgeSelector != null) ++ return forgeSelector; + this.func_197403_b(); + } else { + this.func_197382_c(); +@@ -463,6 +466,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_); + } + + private CompletableFuture func_201981_b(SuggestionsBuilder p_201981_1_, Consumer p_201981_2_) { diff --git a/patches/minecraft/net/minecraft/command/impl/LocateCommand.java.patch b/patches_old/minecraft/net/minecraft/command/impl/LocateCommand.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/command/impl/LocateCommand.java.patch rename to patches_old/minecraft/net/minecraft/command/impl/LocateCommand.java.patch diff --git a/patches_old/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch b/patches_old/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch new file mode 100644 index 000000000..2b447db97 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/command/impl/TeleportCommand.java ++++ b/net/minecraft/command/impl/TeleportCommand.java +@@ -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; + } + } + diff --git a/patches_old/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches_old/minecraft/net/minecraft/crash/CrashReport.java.patch new file mode 100644 index 000000000..ddb7179f2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -0,0 +1,36 @@ +--- a/net/minecraft/crash/CrashReport.java ++++ b/net/minecraft/crash/CrashReport.java +@@ -69,6 +69,7 @@ + List list = Util.func_211565_f().collect(Collectors.toList()); + return String.format("%d total; %s", list.size(), list.stream().collect(Collectors.joining(" "))); + }); ++ net.minecraftforge.fml.CrashReportExtender.enhanceCrashReport(this, this.field_85061_c); + } + + public String func_71501_a() { +@@ -121,23 +122,13 @@ + throwable.setStackTrace(this.field_71511_b.getStackTrace()); + } + +- String s; +- try { +- stringwriter = new StringWriter(); +- printwriter = new PrintWriter(stringwriter); +- throwable.printStackTrace(printwriter); +- s = stringwriter.toString(); +- } finally { +- IOUtils.closeQuietly((Writer)stringwriter); +- IOUtils.closeQuietly((Writer)printwriter); +- } +- +- return s; ++ return net.minecraftforge.fml.CrashReportExtender.generateEnhancedStackTrace(throwable); + } + + public String func_71502_e() { + StringBuilder stringbuilder = new StringBuilder(); + stringbuilder.append("---- Minecraft Crash Report ----\n"); ++ net.minecraftforge.fml.CrashReportExtender.addCrashReportHeader(stringbuilder, this); + stringbuilder.append("// "); + stringbuilder.append(func_71503_h()); + stringbuilder.append("\n\n"); diff --git a/patches_old/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches_old/minecraft/net/minecraft/crash/CrashReportCategory.java.patch new file mode 100644 index 000000000..51237b55f --- /dev/null +++ b/patches_old/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/crash/CrashReportCategory.java ++++ b/net/minecraft/crash/CrashReportCategory.java +@@ -100,8 +100,10 @@ + if (astacktraceelement.length <= 0) { + return 0; + } else { +- this.field_85075_d = new StackTraceElement[astacktraceelement.length - 3 - p_85073_1_]; +- System.arraycopy(astacktraceelement, 3 + p_85073_1_, this.field_85075_d, 0, this.field_85075_d.length); ++ int len = astacktraceelement.length - 3 - p_85073_1_; ++ if (len <= 0) len = astacktraceelement.length; ++ this.field_85075_d = new StackTraceElement[len]; ++ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.field_85075_d, 0, this.field_85075_d.length); + return this.field_85075_d.length; + } + } diff --git a/patches_old/minecraft/net/minecraft/data/DataGenerator.java.patch b/patches_old/minecraft/net/minecraft/data/DataGenerator.java.patch new file mode 100644 index 000000000..142ef9d05 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/data/DataGenerator.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/data/DataGenerator.java ++++ b/net/minecraft/data/DataGenerator.java +@@ -16,10 +16,11 @@ + private final Collection field_200394_b; + private final Path field_200395_c; + private final List field_200396_d = Lists.newArrayList(); ++ private final List providerView = java.util.Collections.unmodifiableList(field_200396_d); + + public DataGenerator(Path p_i48266_1_, Collection p_i48266_2_) { + this.field_200395_c = p_i48266_1_; +- this.field_200394_b = p_i48266_2_; ++ this.field_200394_b = Lists.newArrayList(p_i48266_2_); + } + + public Collection func_200389_a() { +@@ -38,6 +39,7 @@ + + for(IDataProvider idataprovider : this.field_200396_d) { + field_200393_a.info("Starting provider: {}", (Object)idataprovider.func_200397_b()); ++ net.minecraftforge.fml.StartupMessageManager.addModMessage("Generating: " + idataprovider.func_200397_b()); + stopwatch1.start(); + idataprovider.func_200398_a(directorycache); + stopwatch1.stop(); +@@ -53,6 +55,14 @@ + this.field_200396_d.add(p_200390_1_); + } + ++ public List getProviders() { ++ return this.providerView; ++ } ++ ++ public void addInput(Path value) { ++ this.field_200394_b.add(value); ++ } ++ + static { + Bootstrap.func_151354_b(); + } diff --git a/patches_old/minecraft/net/minecraft/data/DirectoryCache.java.patch b/patches_old/minecraft/net/minecraft/data/DirectoryCache.java.patch new file mode 100644 index 000000000..db262a25d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/data/DirectoryCache.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/data/DirectoryCache.java ++++ b/net/minecraft/data/DirectoryCache.java +@@ -23,7 +23,7 @@ + private final Path field_208326_c; + private int field_208327_d; + private final Map field_208328_e = Maps.newHashMap(); +- private final Map field_208329_f = Maps.newHashMap(); ++ private final Map field_208329_f = Maps.newTreeMap(); //Forge: TreeMap, makes the file output predictable/sorted. + private final Set field_218457_g = Sets.newHashSet(); + + public DirectoryCache(Path p_i49352_1_, String p_i49352_2_) throws IOException { +@@ -55,7 +55,7 @@ + } + + IOUtils.writeLines(this.field_208329_f.entrySet().stream().map((p_208319_1_) -> { +- return (String)p_208319_1_.getValue() + ' ' + this.field_208325_b.relativize(p_208319_1_.getKey()); ++ return (String)p_208319_1_.getValue() + ' ' + this.field_208325_b.relativize(p_208319_1_.getKey()).toString().replace('\\', '/'); //Forge: Standardize file paths. + }).collect(Collectors.toList()), System.lineSeparator(), writer); + writer.close(); + field_208324_a.debug("Caching: cache hits: {}, created: {} removed: {}", this.field_208327_d, this.field_208329_f.size() - this.field_208327_d, this.field_208328_e.size()); diff --git a/patches_old/minecraft/net/minecraft/data/LootTableProvider.java.patch b/patches_old/minecraft/net/minecraft/data/LootTableProvider.java.patch new file mode 100644 index 000000000..fa26229b8 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/data/LootTableProvider.java.patch @@ -0,0 +1,47 @@ +--- a/net/minecraft/data/LootTableProvider.java ++++ b/net/minecraft/data/LootTableProvider.java +@@ -42,7 +42,7 @@ + public void func_200398_a(DirectoryCache p_200398_1_) { + Path path = this.field_218443_d.func_200391_b(); + Map map = Maps.newHashMap(); +- this.field_218444_e.forEach((p_218438_1_) -> { ++ this.getTables().forEach((p_218438_1_) -> { + p_218438_1_.getFirst().get().accept((p_218437_2_, p_218437_3_) -> { + if (map.put(p_218437_2_, p_218437_3_.func_216039_a(p_218438_1_.getSecond()).func_216038_b()) != null) { + throw new IllegalStateException("Duplicate loot table " + p_218437_2_); +@@ -53,13 +53,8 @@ + return null; + }, map::get); + +- for(ResourceLocation resourcelocation : Sets.difference(LootTables.func_215796_a(), map.keySet())) { +- validationtracker.func_227530_a_("Missing built-in table: " + resourcelocation); +- } ++ validate(map, validationtracker); + +- map.forEach((p_229439_1_, p_229439_2_) -> { +- LootTableManager.func_227508_a_(validationtracker, p_229439_1_, p_229439_2_); +- }); + Multimap multimap = validationtracker.func_227527_a_(); + if (!multimap.isEmpty()) { + multimap.forEach((p_229440_0_, p_229440_1_) -> { +@@ -80,6 +75,20 @@ + } + } + ++ protected List>>, LootParameterSet>> getTables() { ++ return field_218444_e; ++ } ++ ++ protected void validate(Map map, ValidationTracker validationtracker) { ++ for(ResourceLocation resourcelocation : Sets.difference(LootTables.func_215796_a(), map.keySet())) { ++ validationtracker.func_227530_a_("Missing built-in table: " + resourcelocation); ++ } ++ ++ map.forEach((p_218436_2_, p_218436_3_) -> { ++ LootTableManager.func_227508_a_(validationtracker, p_218436_2_, p_218436_3_); ++ }); ++ } ++ + private static Path func_218439_a(Path p_218439_0_, ResourceLocation p_218439_1_) { + return p_218439_0_.resolve("data/" + p_218439_1_.func_110624_b() + "/loot_tables/" + p_218439_1_.func_110623_a() + ".json"); + } diff --git a/patches_old/minecraft/net/minecraft/data/Main.java.patch b/patches_old/minecraft/net/minecraft/data/Main.java.patch new file mode 100644 index 000000000..24c6b3f1d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/data/Main.java.patch @@ -0,0 +1,34 @@ +--- a/net/minecraft/data/Main.java ++++ b/net/minecraft/data/Main.java +@@ -21,8 +21,12 @@ + OptionSpec optionspec6 = optionparser.accepts("all", "Include all generators"); + OptionSpec optionspec7 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated"); + OptionSpec optionspec8 = optionparser.accepts("input", "Input folder").withRequiredArg(); ++ OptionSpec existing = optionparser.accepts("existing", "Existing resource packs that generated resources can reference").withRequiredArg(); ++ OptionSpec gameDir = optionparser.accepts("gameDir").withRequiredArg().ofType(java.io.File.class).defaultsTo(new java.io.File(".")).required(); //Need by modlauncher, so lets just eat it ++ OptionSpec mod = optionparser.accepts("mod", "A modid to dump").withRequiredArg().withValuesSeparatedBy(","); ++ OptionSpec flat = optionparser.accepts("flat", "Do not append modid prefix to output directory when generating for multiple mods"); + OptionSet optionset = optionparser.parse(p_main_0_); +- if (!optionset.has(optionspec) && optionset.hasOptions()) { ++ if (!optionset.has(optionspec) && optionset.hasOptions() && !(optionset.specs().size() == 1 && optionset.has(gameDir))) { + Path path = Paths.get(optionspec7.value(optionset)); + boolean flag = optionset.has(optionspec6); + boolean flag1 = flag || optionset.has(optionspec2); +@@ -30,10 +34,13 @@ + boolean flag3 = flag || optionset.has(optionspec3); + boolean flag4 = flag || optionset.has(optionspec4); + boolean flag5 = flag || optionset.has(optionspec5); +- DataGenerator datagenerator = func_200264_a(path, optionset.valuesOf(optionspec8).stream().map((p_200263_0_) -> { +- return Paths.get(p_200263_0_); +- }).collect(Collectors.toList()), flag1, flag2, flag3, flag4, flag5); +- datagenerator.func_200392_c(); ++ Collection inputs = optionset.valuesOf(optionspec8).stream().map(Paths::get).collect(Collectors.toList()); ++ Collection existingPacks = optionset.valuesOf(existing).stream().map(Paths::get).collect(Collectors.toList()); ++ java.util.Set mods = new java.util.HashSet<>(optionset.valuesOf(mod)); ++ boolean isFlat = mods.isEmpty() || optionset.has(flat); ++ net.minecraftforge.fml.ModLoader.get().runDataGenerator(mods, path, inputs, existingPacks, flag2, flag1, flag3, flag4, flag5, isFlat); ++ if (mods.contains("minecraft") || mods.isEmpty()) ++ func_200264_a(isFlat ? path : path.resolve("minecraft"), inputs, flag1, flag2, flag3, flag4, flag5).func_200392_c(); + } else { + optionparser.printHelpOn(System.out); + } diff --git a/patches_old/minecraft/net/minecraft/data/RecipeProvider.java.patch b/patches_old/minecraft/net/minecraft/data/RecipeProvider.java.patch new file mode 100644 index 000000000..7bf7bb49c --- /dev/null +++ b/patches_old/minecraft/net/minecraft/data/RecipeProvider.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/data/RecipeProvider.java ++++ b/net/minecraft/data/RecipeProvider.java +@@ -57,6 +57,7 @@ + + } + }); ++ if (this.getClass() == RecipeProvider.class) //Forge: Subclasses don't need this. + this.func_208310_b(p_200398_1_, Advancement.Builder.func_200278_a().func_200275_a("impossible", new ImpossibleTrigger.Instance()).func_200273_b(), path.resolve("data/minecraft/advancements/recipes/root.json")); + } + diff --git a/patches_old/minecraft/net/minecraft/data/TagsProvider.java.patch b/patches_old/minecraft/net/minecraft/data/TagsProvider.java.patch new file mode 100644 index 000000000..c62e9d5bd --- /dev/null +++ b/patches_old/minecraft/net/minecraft/data/TagsProvider.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/data/TagsProvider.java ++++ b/net/minecraft/data/TagsProvider.java +@@ -48,6 +48,7 @@ + tagcollection.func_200039_c().forEach((p_223474_2_, p_223474_3_) -> { + JsonObject jsonobject = p_223474_3_.func_200571_a(this.field_200435_c::func_177774_c); + Path path = this.func_200431_a(p_223474_2_); ++ if (path == null) return; //Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. + + try { + String s = field_200437_e.toJson((JsonElement)jsonobject); diff --git a/patches_old/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch b/patches_old/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch new file mode 100644 index 000000000..3301eee73 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch @@ -0,0 +1,37 @@ +--- a/net/minecraft/data/loot/BlockLootTables.java ++++ b/net/minecraft/data/loot/BlockLootTables.java +@@ -204,7 +204,7 @@ + return LootTable.func_216119_b(); + } + +- public void accept(BiConsumer p_accept_1_) { ++ protected void addTables() { + this.func_218492_c(Blocks.field_196650_c); + this.func_218492_c(Blocks.field_196652_d); + this.func_218492_c(Blocks.field_196654_e); +@@ -976,9 +976,13 @@ + this.func_218507_a(Blocks.field_150414_aQ, func_218482_a()); + this.func_218507_a(Blocks.field_185778_de, func_218482_a()); + this.func_218507_a(Blocks.field_150474_ac, func_218482_a()); ++ } ++ ++ public void accept(BiConsumer p_accept_1_) { ++ this.addTables(); + Set set = Sets.newHashSet(); + +- for(Block block : Registry.field_212618_g) { ++ for(Block block : getKnownBlocks()) { + ResourceLocation resourcelocation = block.func_220068_i(); + if (resourcelocation != LootTables.field_186419_a && set.add(resourcelocation)) { + LootTable.Builder loottable$builder = this.field_218581_i.remove(resourcelocation); +@@ -995,6 +999,10 @@ + } + } + ++ protected Iterable getKnownBlocks() { ++ return Registry.field_212618_g; ++ } ++ + public void func_218547_a(Block p_218547_1_) { + this.func_218522_a(p_218547_1_, (p_229438_0_) -> { + return func_218523_c(((FlowerPotBlock)p_229438_0_).func_220276_d()); diff --git a/patches_old/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch b/patches_old/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch new file mode 100644 index 000000000..793278692 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch @@ -0,0 +1,49 @@ +--- a/net/minecraft/data/loot/EntityLootTables.java ++++ b/net/minecraft/data/loot/EntityLootTables.java +@@ -51,7 +51,7 @@ + return LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(p_218583_0_))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(TableLootEntry.func_216171_a(EntityType.field_200737_ac.func_220348_g()))); + } + +- public void accept(BiConsumer p_accept_1_) { ++ protected void addTables() { + this.func_218582_a(EntityType.field_200789_c, LootTable.func_216119_b()); + this.func_218582_a(EntityType.field_200791_e, LootTable.func_216119_b()); + this.func_218582_a(EntityType.field_226289_e_, LootTable.func_216119_b()); +@@ -137,8 +137,12 @@ + this.func_218582_a(EntityType.field_200726_aE, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151078_bh).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 2.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F)))))); + this.func_218582_a(EntityType.field_200785_Y, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151078_bh).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 1.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151074_bl).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 1.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151043_k)).func_212840_b_(KilledByPlayer.func_215994_b()).func_212840_b_(RandomChanceWithLooting.func_216003_a(0.025F, 0.01F)))); + this.func_218582_a(EntityType.field_200727_aF, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151078_bh).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 2.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151042_j)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151172_bF)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151174_bG)).func_212840_b_(KilledByPlayer.func_215994_b()).func_212840_b_(RandomChanceWithLooting.func_216003_a(0.025F, 0.01F)))); ++ } ++ ++ public void accept(BiConsumer p_accept_1_) { ++ this.addTables(); + Set set = Sets.newHashSet(); +- Iterator iterator = Registry.field_212629_r.iterator(); ++ Iterator iterator = getKnownEntities().iterator(); + + EntityType entitytype; + ResourceLocation resourcelocation; +@@ -150,7 +154,7 @@ + + entitytype = (EntityType)iterator.next(); + resourcelocation = entitytype.func_220348_g(); +- if (!field_222944_b.contains(entitytype) && entitytype.func_220339_d() == EntityClassification.MISC) { ++ if (isNonLiving(entitytype)) { + if (resourcelocation != LootTables.field_186419_a && this.field_218587_b.remove(resourcelocation) != null) { + break; + } +@@ -167,6 +171,14 @@ + throw new IllegalStateException(String.format("Weird loottable '%s' for '%s', not a LivingEntity so should not have loot", resourcelocation, Registry.field_212629_r.func_177774_c(entitytype))); + } + ++ protected Iterable> getKnownEntities() { ++ return Registry.field_212629_r; ++ } ++ ++ protected boolean isNonLiving(EntityType entitytype) { ++ return !field_222944_b.contains(entitytype) && entitytype.func_220339_d() == EntityClassification.MISC; ++ } ++ + protected void func_218582_a(EntityType p_218582_1_, LootTable.Builder p_218582_2_) { + this.func_218585_a(p_218582_1_.func_220348_g(), p_218582_2_); + } diff --git a/patches_old/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch b/patches_old/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch new file mode 100644 index 000000000..ca367b12c --- /dev/null +++ b/patches_old/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch @@ -0,0 +1,41 @@ +--- a/net/minecraft/dispenser/IDispenseItemBehavior.java ++++ b/net/minecraft/dispenser/IDispenseItemBehavior.java +@@ -295,8 +295,9 @@ + world.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P()); + } else if (FlintAndSteelItem.func_219997_a(blockstate)) { + world.func_175656_a(blockpos, blockstate.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true))); +- } else if (blockstate.func_177230_c() instanceof TNTBlock) { +- TNTBlock.func_196534_a(world, blockpos); ++ } else if (blockstate.isFlammable(world, blockpos, p_82487_1_.func_189992_e().func_177229_b(DispenserBlock.field_176441_a).func_176734_d())) { ++ blockstate.catchFire(world, blockpos, p_82487_1_.func_189992_e().func_177229_b(DispenserBlock.field_176441_a).func_176734_d(), null); ++ if (blockstate.func_177230_c() instanceof TNTBlock) + world.func_217377_a(blockpos, false); + } else { + this.field_218407_b = false; +@@ -426,15 +427,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((net.minecraft.entity.Entity)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(d, 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_old/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches_old/minecraft/net/minecraft/enchantment/Enchantment.java.patch new file mode 100644 index 000000000..9fb0bac15 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -0,0 +1,45 @@ +--- a/net/minecraft/enchantment/Enchantment.java ++++ b/net/minecraft/enchantment/Enchantment.java +@@ -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 EquipmentSlotType[] field_185263_a; + private final Enchantment.Rarity field_77333_a; + @Nullable +@@ -114,7 +114,7 @@ + } + + public boolean func_92089_a(ItemStack p_92089_1_) { +- return this.field_77351_y.func_77557_a(p_92089_1_.func_77973_b()); ++ return canApplyAtEnchantingTable(p_92089_1_); + } + + public void func_151368_a(LivingEntity p_151368_1_, Entity p_151368_2_, int p_151368_3_) { +@@ -131,6 +131,24 @@ + return false; + } + ++ /** ++ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} ++ * applies for all possible enchantments. ++ * @param stack ++ * @return ++ */ ++ public boolean canApplyAtEnchantingTable(ItemStack stack) { ++ return stack.canApplyAtEnchantingTable(this); ++ } ++ ++ /** ++ * Is this enchantment allowed to be enchanted on books via Enchantment Table ++ * @return false to disable the vanilla feature ++ */ ++ public boolean isAllowedOnBooks() { ++ return true; ++ } ++ + public static enum Rarity { + COMMON(10), + UNCOMMON(5), diff --git a/patches_old/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch b/patches_old/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch new file mode 100644 index 000000000..050831318 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/enchantment/Enchantments.java.patch b/patches_old/minecraft/net/minecraft/enchantment/Enchantments.java.patch new file mode 100644 index 000000000..eb13c7017 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch b/patches_old/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch new file mode 100644 index 000000000..89dbd7257 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/enchantment/FrostWalkerEnchantment.java ++++ b/net/minecraft/enchantment/FrostWalkerEnchantment.java +@@ -42,9 +42,10 @@ + if (blockpos.func_218137_a(p_185266_0_.func_213303_ch(), (double)f)) { + blockpos$mutable.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$mutable); +- if (blockstate1.func_196958_f()) { ++ if (blockstate1.isAir(p_185266_1_, blockpos$mutable)) { + 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_226663_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_226663_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_old/minecraft/net/minecraft/entity/Entity.java.patch b/patches_old/minecraft/net/minecraft/entity/Entity.java.patch new file mode 100644 index 000000000..719851b75 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/Entity.java.patch @@ -0,0 +1,398 @@ +--- a/net/minecraft/entity/Entity.java ++++ b/net/minecraft/entity/Entity.java +@@ -105,12 +105,13 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-public abstract class Entity implements INameable, ICommandSource { ++public abstract class Entity extends net.minecraftforge.common.capabilities.CapabilityProvider 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; ++ @Deprecated // Forge: Use the getter to allow overriding in mods + private final EntityType field_200606_g; + private int field_145783_c = field_213331_b.incrementAndGet(); + public boolean field_70156_m; +@@ -138,6 +139,7 @@ + public boolean field_70132_H; + public boolean field_70133_I; + protected Vec3d field_213328_B = Vec3d.field_186680_a; ++ @Deprecated //Forge: Use isAlive, remove(boolean) and revive() instead of directly accessing this field. To allow the entity to react to and better control this information. + public boolean field_70128_L; + public float field_70141_P; + public float field_70140_Q; +@@ -196,6 +198,7 @@ + private float field_213326_aJ; + + public Entity(EntityType p_i48580_1_, World p_i48580_2_) { ++ super(Entity.class); + this.field_200606_g = p_i48580_1_; + this.field_70170_p = p_i48580_2_; + this.field_213325_aI = p_i48580_1_.func_220334_j(); +@@ -213,7 +216,9 @@ + this.field_70180_af.func_187214_a(field_189655_aD, false); + this.field_70180_af.func_187214_a(field_213330_X, Pose.STANDING); + this.func_70088_a(); +- this.field_213326_aJ = this.func_213316_a(Pose.STANDING, this.field_213325_aI); ++ this.field_213326_aJ = getEyeHeightForge(Pose.STANDING, this.field_213325_aI); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); ++ this.gatherCapabilities(); + } + + @OnlyIn(Dist.CLIENT) +@@ -292,7 +297,7 @@ + @OnlyIn(Dist.CLIENT) + protected void func_70065_x() { + if (this.field_70170_p != null) { +- for(double d0 = this.func_226278_cu_(); d0 > 0.0D && d0 < 256.0D; ++d0) { ++ for(double d0 = this.func_226278_cu_(); d0 > 0.0D && d0 < this.field_70170_p.func_201675_m().getHeight(); ++d0) { + this.func_70107_b(this.func_226277_ct_(), d0, this.func_226281_cx_()); + if (this.field_70170_p.func_226669_j_(this)) { + break; +@@ -305,7 +310,13 @@ + } + + public void func_70106_y() { ++ this.remove(false); ++ } ++ ++ public void remove(boolean keepData) { + this.field_70128_L = true; ++ if (!keepData) ++ this.invalidateCaps(); + } + + protected void func_213301_b(Pose p_213301_1_) { +@@ -323,6 +334,7 @@ + + public void func_70107_b(double p_70107_1_, double p_70107_3_, double p_70107_5_) { + this.func_226288_n_(p_70107_1_, p_70107_3_, p_70107_5_); ++ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && field_70170_p instanceof ServerWorld) ((ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. + float f = this.field_213325_aI.field_220315_a / 2.0F; + float f1 = this.field_213325_aI.field_220316_b; + this.func_174826_a(new AxisAlignedBB(p_70107_1_ - (double)f, p_70107_3_, p_70107_5_ - (double)f, p_70107_1_ + (double)f, p_70107_3_ + (double)f1, p_70107_5_ + (double)f)); +@@ -523,7 +535,7 @@ + + this.field_70140_Q = (float)((double)this.field_70140_Q + (double)MathHelper.func_76133_a(func_213296_b(vec3d)) * 0.6D); + this.field_82151_R = (float)((double)this.field_82151_R + (double)MathHelper.func_76133_a(d0 * d0 + d1 * d1 + d2 * d2) * 0.6D); +- if (this.field_82151_R > this.field_70150_b && !blockstate.func_196958_f()) { ++ if (this.field_82151_R > this.field_70150_b && !blockstate.isAir(this.field_70170_p, blockpos)) { + this.field_70150_b = this.func_203009_ad(); + if (this.func_70090_H()) { + Entity entity = this.func_184207_aI() && this.func_184179_bs() != null ? this.func_184179_bs() : this; +@@ -538,7 +550,7 @@ + } else { + this.func_180429_a(blockpos, blockstate); + } +- } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && blockstate.func_196958_f()) { ++ } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && blockstate.isAir(this.field_70170_p, blockpos)) { + this.field_191959_ay = this.func_191954_d(this.field_82151_R); + } + } +@@ -582,11 +594,10 @@ + int j = MathHelper.func_76128_c(this.field_70163_u - (double)0.2F); + int k = MathHelper.func_76128_c(this.field_70161_v); + BlockPos blockpos = new BlockPos(i, j, k); +- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f()) { ++ if (this.field_70170_p.func_175623_d(blockpos)) { + BlockPos blockpos1 = blockpos.func_177977_b(); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos1); +- Block block = blockstate.func_177230_c(); +- if (block.func_203417_a(BlockTags.field_219748_G) || block.func_203417_a(BlockTags.field_219757_z) || block instanceof FenceGateBlock) { ++ if (blockstate.collisionExtendsVertically(this.field_70170_p, blockpos1, this)) { + return blockpos1; + } + } +@@ -770,6 +781,7 @@ + public void func_174829_m() { + AxisAlignedBB axisalignedbb = this.func_174813_aQ(); + this.func_226288_n_((axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D, axisalignedbb.field_72338_b, (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D); ++ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && field_70170_p instanceof ServerWorld) ((ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. + } + + protected SoundEvent func_184184_Z() { +@@ -822,7 +834,7 @@ + protected void func_180429_a(BlockPos p_180429_1_, BlockState p_180429_2_) { + if (!p_180429_2_.func_185904_a().func_76224_d()) { + BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()); +- SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.func_215695_r() : p_180429_2_.func_215695_r(); ++ SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.getSoundType(field_70170_p, p_180429_1_, this) : p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this); + this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b()); + } + } +@@ -1019,9 +1031,10 @@ + int k = MathHelper.func_76128_c(this.func_226281_cx_()); + BlockPos blockpos = new BlockPos(i, j, k); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); ++ if (!blockstate.addRunningEffects(field_70170_p, blockpos, this)) + if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) { + Vec3d vec3d = this.func_213322_ci(); +- this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate), this.func_226277_ct_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vec3d.field_72450_a * -4.0D, 1.5D, vec3d.field_72449_c * -4.0D); ++ this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate).setPos(blockpos), this.func_226277_ct_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vec3d.field_72450_a * -4.0D, 1.5D, vec3d.field_72449_c * -4.0D); + } + + } +@@ -1040,7 +1053,7 @@ + return false; + } else { + IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos); +- return ifluidstate.func_206884_a(p_213290_1_) && d0 < (double)((float)blockpos.func_177956_o() + ifluidstate.func_215679_a(this.field_70170_p, blockpos) + 0.11111111F); ++ return ifluidstate.isEntityInside(field_70170_p, blockpos, this, d0, p_213290_1_, true); + } + } + } +@@ -1330,6 +1343,7 @@ + if (this.field_184238_ar) { + p_189511_1_.func_74757_a("Glowing", this.field_184238_ar); + } ++ p_189511_1_.func_74757_a("CanUpdate", canUpdate); + + if (!this.field_184236_aF.isEmpty()) { + ListNBT listnbt = new ListNBT(); +@@ -1341,6 +1355,10 @@ + p_189511_1_.func_218657_a("Tags", listnbt); + } + ++ CompoundNBT caps = serializeCaps(); ++ if (caps != null) p_189511_1_.func_218657_a("ForgeCaps", caps); ++ if (persistentData != null) p_189511_1_.func_218657_a("ForgeData", persistentData); ++ + this.func_213281_b(p_189511_1_); + if (this.func_184207_aI()) { + ListNBT listnbt1 = new ListNBT(); +@@ -1409,6 +1427,9 @@ + this.func_174810_b(p_70020_1_.func_74767_n("Silent")); + this.func_189654_d(p_70020_1_.func_74767_n("NoGravity")); + this.func_184195_f(p_70020_1_.func_74767_n("Glowing")); ++ if (p_70020_1_.func_150297_b("ForgeData", 10)) persistentData = p_70020_1_.func_74775_l("ForgeData"); ++ if (p_70020_1_.func_150297_b("CanUpdate", 99)) this.canUpdate(p_70020_1_.func_74767_n("CanUpdate")); ++ if (p_70020_1_.func_150297_b("ForgeCaps", 10)) deserializeCaps(p_70020_1_.func_74775_l("ForgeCaps")); + if (p_70020_1_.func_150297_b("Tags", 9)) { + this.field_184236_aF.clear(); + ListNBT listnbt1 = p_70020_1_.func_150295_c("Tags", 8); +@@ -1497,6 +1518,8 @@ + } else { + ItemEntity itementity = new ItemEntity(this.field_70170_p, this.func_226277_ct_(), this.func_226278_cu_() + (double)p_70099_2_, this.func_226281_cx_(), p_70099_1_); + itementity.func_174869_p(); ++ if (captureDrops() != null) captureDrops().add(itementity); ++ else + this.field_70170_p.func_217376_c(itementity); + return itementity; + } +@@ -1540,6 +1563,7 @@ + + public void func_70098_U() { + this.func_213317_d(Vec3d.field_186680_a); ++ if (canUpdate()) + this.func_70071_h_(); + if (this.func_184218_aH()) { + this.func_184187_bx().func_184232_k(this); +@@ -1584,6 +1608,7 @@ + } + } + ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false; + if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) { + if (this.func_184218_aH()) { + this.func_184210_p(); +@@ -1615,6 +1640,7 @@ + public void func_184210_p() { + if (this.field_184239_as != null) { + Entity entity = this.field_184239_as; ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entity, false)) return; + this.field_184239_as = null; + entity.func_184225_p(this); + } +@@ -1771,6 +1797,7 @@ + return !this.func_184188_bt().isEmpty(); + } + ++ @Deprecated //Forge: Use rider sensitive version + public boolean func_205710_ba() { + return true; + } +@@ -1989,7 +2016,7 @@ + } + + protected ITextComponent func_225513_by_() { +- return this.field_200606_g.func_212546_e(); ++ return this.func_200600_R().func_212546_e(); // Forge: Use getter to allow overriding by mods + } + + public boolean func_70028_i(Entity p_70028_1_) { +@@ -2046,6 +2073,11 @@ + + @Nullable + public Entity func_212321_a(DimensionType p_212321_1_) { ++ return this.changeDimension(p_212321_1_, func_184102_h().func_71218_a(p_212321_1_).func_85176_s()); ++ } ++ @Nullable ++ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null; + if (!this.field_70170_p.field_72995_K && !this.field_70128_L) { + this.field_70170_p.func_217381_Z().func_76320_a("changeDimension"); + MinecraftServer minecraftserver = this.func_184102_h(); +@@ -2055,6 +2087,7 @@ + this.field_71093_bK = p_212321_1_; + this.func_213319_R(); + this.field_70170_p.func_217381_Z().func_76320_a("reposition"); ++ Entity transportedEntity = teleporter.placeEntity(this, serverworld, serverworld1, this.field_70177_z, spawnPortal -> { //Forge: Start vanilla logic + Vec3d vec3d = this.func_213322_ci(); + float f = 0.0F; + BlockPos blockpos; +@@ -2063,16 +2096,9 @@ + } else if (p_212321_1_ == DimensionType.field_223229_c_) { + blockpos = serverworld1.func_180504_m(); + } else { +- double d0 = this.func_226277_ct_(); +- double d1 = this.func_226281_cx_(); +- double d2 = 8.0D; +- if (dimensiontype == DimensionType.field_223227_a_ && p_212321_1_ == DimensionType.field_223228_b_) { +- d0 /= 8.0D; +- d1 /= 8.0D; +- } else if (dimensiontype == DimensionType.field_223228_b_ && p_212321_1_ == DimensionType.field_223227_a_) { +- d0 *= 8.0D; +- d1 *= 8.0D; +- } ++ double movementFactor = serverworld.func_201675_m().getMovementFactor() / serverworld1.func_201675_m().getMovementFactor(); ++ double d0 = this.func_226277_ct_() * movementFactor; ++ double d1 = this.func_226281_cx_() * movementFactor; + + double d3 = Math.min(-2.9999872E7D, serverworld1.func_175723_af().func_177726_b() + 16.0D); + double d4 = Math.min(-2.9999872E7D, serverworld1.func_175723_af().func_177736_c() + 16.0D); +@@ -2082,6 +2108,7 @@ + d1 = MathHelper.func_151237_a(d1, d4, d6); + Vec3d vec3d1 = this.func_181014_aG(); + blockpos = new BlockPos(d0, this.func_226278_cu_(), d1); ++ if (spawnPortal) { + BlockPattern.PortalInfo blockpattern$portalinfo = serverworld1.func_85176_s().func_222272_a(blockpos, vec3d, this.func_181012_aH(), vec3d1.field_72450_a, vec3d1.field_72448_b, this instanceof PlayerEntity); + if (blockpattern$portalinfo == null) { + return null; +@@ -2090,6 +2117,7 @@ + blockpos = new BlockPos(blockpattern$portalinfo.field_222505_a); + vec3d = blockpattern$portalinfo.field_222506_b; + f = (float)blockpattern$portalinfo.field_222507_c; ++ } + } + + this.field_70170_p.func_217381_Z().func_219895_b("reloading"); +@@ -2100,13 +2128,15 @@ + entity.func_213317_d(vec3d); + serverworld1.func_217460_e(entity); + } ++ return entity; ++ });//Forge: End vanilla logic + +- this.field_70128_L = true; ++ this.remove(false); + this.field_70170_p.func_217381_Z().func_76319_b(); + serverworld.func_82742_i(); + serverworld1.func_82742_i(); + this.field_70170_p.func_217381_Z().func_76319_b(); +- return entity; ++ return transportedEntity; + } else { + return null; + } +@@ -2129,10 +2159,12 @@ + } + + public Vec3d func_181014_aG() { ++ if (this.field_181017_ao == null) return Vec3d.field_186680_a; + return this.field_181017_ao; + } + + public Direction func_181012_aH() { ++ if (this.field_181018_ap == null) return Direction.NORTH; + return this.field_181018_ap; + } + +@@ -2261,7 +2293,7 @@ + Pose pose = this.func_213283_Z(); + EntitySize entitysize1 = this.func_213305_a(pose); + this.field_213325_aI = entitysize1; +- this.field_213326_aJ = this.func_213316_a(pose, entitysize1); ++ this.field_213326_aJ = getEyeHeightForge(pose, entitysize1); + if (entitysize1.field_220315_a < entitysize.field_220315_a) { + double d0 = (double)entitysize1.field_220315_a / 2.0D; + this.func_174826_a(new AxisAlignedBB(this.func_226277_ct_() - d0, this.func_226278_cu_(), this.func_226281_cx_() - d0, this.func_226277_ct_() + d0, this.func_226278_cu_() + (double)entitysize1.field_220316_b, this.func_226281_cx_() + d0)); +@@ -2713,6 +2745,7 @@ + this.field_70165_t = p_226288_1_; + this.field_70163_u = p_226288_3_; + this.field_70161_v = p_226288_5_; ++ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && !this.field_70128_L) this.field_70170_p.func_212866_a_((int) Math.floor(this.field_70165_t) >> 4, (int) Math.floor(this.field_70161_v) >> 4); // Forge - ensure target chunk is loaded. + } + + public void func_70623_bb() { +@@ -2726,4 +2759,69 @@ + public interface IMoveCallback { + void accept(Entity p_accept_1_, double p_accept_2_, double p_accept_4_, double p_accept_6_); + } ++ ++ /* ================================== Forge Start =====================================*/ ++ ++ private boolean canUpdate = true; ++ @Override ++ public void canUpdate(boolean value) { ++ this.canUpdate = value; ++ } ++ @Override ++ public boolean canUpdate() { ++ return this.canUpdate; ++ } ++ private Collection captureDrops = null; ++ @Override ++ public Collection captureDrops() { ++ return captureDrops; ++ } ++ @Override ++ public Collection captureDrops(Collection value) { ++ Collection ret = captureDrops; ++ this.captureDrops = value; ++ return ret; ++ } ++ private CompoundNBT persistentData; ++ @Override ++ public CompoundNBT getPersistentData() { ++ if (persistentData == null) ++ persistentData = new CompoundNBT(); ++ return persistentData; ++ } ++ @Override ++ public boolean canTrample(BlockState state, BlockPos pos, float fallDistance) { ++ return field_70170_p.field_73012_v.nextFloat() < fallDistance - 0.5F ++ && this instanceof LivingEntity ++ && (this instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(field_70170_p, this)) ++ && this.func_213311_cf() * this.func_213311_cf() * this.func_213302_cg() > 0.512F; ++ } ++ ++ /** ++ * Internal use for keeping track of entities that are tracked by a world, to ++ * allow guarantees that entity position changes will force a chunk load, avoiding ++ * potential issues with entity desyncing and bad chunk data. ++ */ ++ private boolean isAddedToWorld; ++ ++ @Override ++ public final boolean isAddedToWorld() { return this.isAddedToWorld; } ++ ++ @Override ++ public void onAddedToWorld() { this.isAddedToWorld = true; } ++ ++ @Override ++ public void onRemovedFromWorld() { this.isAddedToWorld = false; } ++ ++ @Override ++ public void revive() { ++ this.field_70128_L = false; ++ this.reviveCaps(); ++ } ++ ++ private float getEyeHeightForge(Pose pose, EntitySize size) { ++ net.minecraftforge.event.entity.EntityEvent.EyeHeight evt = new net.minecraftforge.event.entity.EntityEvent.EyeHeight(this, pose, size, this.func_213316_a(pose, size)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(evt); ++ return evt.getNewHeight(); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/entity/EntityClassification.java.patch b/patches_old/minecraft/net/minecraft/entity/EntityClassification.java.patch new file mode 100644 index 000000000..0e2aa4040 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/entity/FlyingEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/FlyingEntity.java.patch new file mode 100644 index 000000000..dcb9a4cc8 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/FlyingEntity.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/entity/FlyingEntity.java ++++ b/net/minecraft/entity/FlyingEntity.java +@@ -28,15 +28,16 @@ + this.func_213315_a(MoverType.SELF, this.func_213322_ci()); + this.func_213317_d(this.func_213322_ci().func_186678_a(0.5D)); + } else { ++ BlockPos ground = new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_()); + float f = 0.91F; + if (this.field_70122_E) { +- f = this.field_70170_p.func_180495_p(new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).func_177230_c().func_208618_m() * 0.91F; ++ f = this.field_70170_p.func_180495_p(ground).getSlipperiness(this.field_70170_p, ground, this) * 0.91F; + } + + float f1 = 0.16277137F / (f * f * f); + f = 0.91F; + if (this.field_70122_E) { +- f = this.field_70170_p.func_180495_p(new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).func_177230_c().func_208618_m() * 0.91F; ++ f = this.field_70170_p.func_180495_p(ground).getSlipperiness(this.field_70170_p, ground, this) * 0.91F; + } + + this.func_213309_a(this.field_70122_E ? 0.1F * f1 : 0.02F, p_213352_1_); diff --git a/patches_old/minecraft/net/minecraft/entity/LivingEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/LivingEntity.java.patch new file mode 100644 index 000000000..9323e64c2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/LivingEntity.java.patch @@ -0,0 +1,530 @@ +--- a/net/minecraft/entity/LivingEntity.java ++++ b/net/minecraft/entity/LivingEntity.java +@@ -109,7 +109,12 @@ + + public abstract class LivingEntity extends Entity { + private static final UUID field_110156_b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); ++ private static final UUID SLOW_FALLING_ID = UUID.fromString("A5B6CF2A-2F7C-31EF-9022-7C3E7D5E6ABA"); + private static final AttributeModifier field_110157_c = (new AttributeModifier(field_110156_b, "Sprinting speed boost", (double)0.3F, AttributeModifier.Operation.MULTIPLY_TOTAL)).func_111168_a(false); ++ private static final AttributeModifier SLOW_FALLING = new AttributeModifier(SLOW_FALLING_ID, "Slow falling acceleration reduction", -0.07, AttributeModifier.Operation.ADDITION).func_111168_a(false); // Add -0.07 to 0.08 so we get the vanilla default of 0.01 ++ public static final net.minecraft.entity.ai.attributes.IAttribute SWIM_SPEED = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.swimSpeed", 1.0D, 0.0D, 1024.0D).func_111112_a(true); ++ public static final net.minecraft.entity.ai.attributes.IAttribute NAMETAG_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.nameTagDistance", 64.0D, 0.0D, Float.MAX_VALUE).func_111112_a(true); ++ public static final net.minecraft.entity.ai.attributes.IAttribute ENTITY_GRAVITY = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.entity_gravity", 0.08D, -8.0D, 8.0D).func_111112_a(true); + protected static final DataParameter 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); +@@ -235,6 +240,9 @@ + this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_111263_d); + this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188791_g); + this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_189429_h); ++ this.func_110140_aT().func_111150_b(SWIM_SPEED); ++ this.func_110140_aT().func_111150_b(NAMETAG_DISTANCE); ++ this.func_110140_aT().func_111150_b(ENTITY_GRAVITY); + } + + protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, BlockState p_184231_4_, BlockPos p_184231_5_) { +@@ -244,9 +252,10 @@ + + if (!this.field_70170_p.field_72995_K && this.field_70143_R > 3.0F && p_184231_3_) { + float f = (float)MathHelper.func_76123_f(this.field_70143_R - 3.0F); +- if (!p_184231_4_.func_196958_f()) { ++ if (!p_184231_4_.isAir(field_70170_p, p_184231_5_)) { + double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); + int i = (int)(150.0D * d0); ++ if (!p_184231_4_.addLandingEffects((ServerWorld)this.field_70170_p, p_184231_5_, p_184231_4_, this, i)) + ((ServerWorld)this.field_70170_p).func_195598_a(new BlockParticleData(ParticleTypes.field_197611_d, p_184231_4_), this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), i, 0.0D, 0.0D, 0.0D, (double)0.15F); + } + } +@@ -310,7 +319,7 @@ + } + } + +- if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && !this.func_184187_bx().func_205710_ba()) { ++ if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && !this.func_184187_bx().canBeRiddenInWater(this)) { + this.func_184210_p(); + } + } else if (this.func_70086_ai() < this.func_205010_bg()) { +@@ -392,7 +401,7 @@ + protected void func_70609_aI() { + ++this.field_70725_aQ; + if (this.field_70725_aQ == 20) { +- this.func_70106_y(); ++ this.remove(this instanceof net.minecraft.entity.player.ServerPlayerEntity); //Forge keep data until we revive player + + for(int i = 0; i < 20; ++i) { + double d0 = this.field_70146_Z.nextGaussian() * 0.02D; +@@ -573,7 +582,7 @@ + if (!effectinstance.func_76455_a(this, () -> { + this.func_70695_b(effectinstance, true); + })) { +- if (!this.field_70170_p.field_72995_K) { ++ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionExpiryEvent(this, effectinstance))) { + iterator.remove(); + this.func_70688_c(effectinstance); + } +@@ -623,8 +632,10 @@ + this.func_82142_c(false); + } else { + Collection collection = this.field_70713_bf.values(); +- this.field_70180_af.func_187227_b(field_184634_g, func_184593_a(collection)); +- this.field_70180_af.func_187227_b(field_184633_f, PotionUtils.func_185181_a(collection)); ++ net.minecraftforge.event.entity.living.PotionColorCalculationEvent event = new net.minecraftforge.event.entity.living.PotionColorCalculationEvent(this, PotionUtils.func_185181_a(collection), func_184593_a(collection), collection); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ this.field_70180_af.func_187227_b(field_184634_g, event.areParticlesHidden()); ++ this.field_70180_af.func_187227_b(field_184633_f, event.getColor()); + this.func_82142_c(this.func_70644_a(Effects.field_76441_p)); + } + +@@ -688,7 +699,9 @@ + + boolean flag; + for(flag = false; iterator.hasNext(); flag = true) { +- this.func_70688_c(iterator.next()); ++ EffectInstance effect = iterator.next(); ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, effect))) continue; ++ this.func_70688_c(effect); + iterator.remove(); + } + +@@ -718,6 +731,7 @@ + return false; + } else { + EffectInstance effectinstance = this.field_70713_bf.get(p_195064_1_.func_188419_a()); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionAddedEvent(this, effectinstance, p_195064_1_)); + if (effectinstance == null) { + this.field_70713_bf.put(p_195064_1_.func_188419_a(), p_195064_1_); + this.func_70670_a(p_195064_1_); +@@ -732,6 +746,9 @@ + } + + public boolean func_70687_e(EffectInstance p_70687_1_) { ++ net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent event = new net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent(this, p_70687_1_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() != net.minecraftforge.eventbus.api.Event.Result.DEFAULT) return event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW; + if (this.func_70668_bt() == CreatureAttribute.field_223223_b_) { + Effect effect = p_70687_1_.func_188419_a(); + if (effect == Effects.field_76428_l || effect == Effects.field_76436_u) { +@@ -752,6 +769,7 @@ + } + + public boolean func_195063_d(Effect p_195063_1_) { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, p_195063_1_))) return false; + EffectInstance effectinstance = this.func_184596_c(p_195063_1_); + if (effectinstance != null) { + this.func_70688_c(effectinstance); +@@ -788,6 +806,8 @@ + } + + public void func_70691_i(float p_70691_1_) { ++ p_70691_1_ = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, p_70691_1_); ++ if (p_70691_1_ <= 0) return; + float f = this.func_110143_aJ(); + if (f > 0.0F) { + this.func_70606_j(f + p_70691_1_); +@@ -804,6 +824,7 @@ + } + + public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false; + if (this.func_180431_b(p_70097_1_)) { + return false; + } else if (this.field_70170_p.field_72995_K) { +@@ -870,8 +891,8 @@ + if (entity1 instanceof PlayerEntity) { + this.field_70718_bc = 100; + this.field_70717_bb = (PlayerEntity)entity1; +- } else if (entity1 instanceof WolfEntity) { +- WolfEntity wolfentity = (WolfEntity)entity1; ++ } else if (entity1 instanceof net.minecraft.entity.passive.TameableEntity) { ++ net.minecraft.entity.passive.TameableEntity wolfentity = (net.minecraft.entity.passive.TameableEntity)entity1; + if (wolfentity.func_70909_n()) { + this.field_70718_bc = 100; + LivingEntity livingentity = wolfentity.func_70902_q(); +@@ -1053,6 +1074,7 @@ + } + + public void func_70645_a(DamageSource p_70645_1_) { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; + if (!this.field_70128_L && !this.field_70729_aU) { + Entity entity = p_70645_1_.func_76346_g(); + LivingEntity livingentity = this.func_94060_bK(); +@@ -1084,10 +1106,10 @@ + if (!this.field_70170_p.field_72995_K) { + boolean flag = false; + if (p_226298_1_ instanceof WitherEntity) { +- if (this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { + BlockPos blockpos = new BlockPos(this); + BlockState blockstate = Blocks.field_222388_bz.func_176223_P(); +- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f() && blockstate.func_196955_c(this.field_70170_p, blockpos)) { ++ if (this.field_70170_p.func_175623_d(blockpos) && blockstate.func_196955_c(this.field_70170_p, blockpos)) { + this.field_70170_p.func_180501_a(blockpos, blockstate, 3); + flag = true; + } +@@ -1104,13 +1126,10 @@ + + protected void func_213345_d(DamageSource p_213345_1_) { + Entity entity = p_213345_1_.func_76346_g(); +- int i; +- if (entity instanceof PlayerEntity) { +- i = EnchantmentHelper.func_185283_h((LivingEntity)entity); +- } else { +- i = 0; +- } + ++ int i = net.minecraftforge.common.ForgeHooks.getLootingLevel(this, entity, p_213345_1_); ++ this.captureDrops(new java.util.ArrayList<>()); ++ + boolean flag = this.field_70718_bc > 0; + if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e)) { + this.func_213354_a(p_213345_1_, flag); +@@ -1119,6 +1138,10 @@ + + this.func_213337_cE(); + this.func_226294_cV_(); ++ ++ Collection drops = captureDrops(null); ++ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_213345_1_, drops, i, field_70718_bc > 0)) ++ drops.forEach(e -> field_70170_p.func_217376_c(e)); + } + + protected void func_213337_cE() { +@@ -1128,6 +1151,7 @@ + if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e))) { + int i = this.func_70693_a(this.field_70717_bb); + ++ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.field_70717_bb, i); + while(i > 0) { + int j = ExperienceOrbEntity.func_70527_a(i); + i -= j; +@@ -1135,6 +1159,7 @@ + } + } + ++ + } + + protected void func_213333_a(DamageSource p_213333_1_, int p_213333_2_, boolean p_213333_3_) { +@@ -1148,7 +1173,8 @@ + ResourceLocation resourcelocation = this.func_213346_cF(); + LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(resourcelocation); + LootContext.Builder lootcontext$builder = this.func_213363_a(p_213354_2_, p_213354_1_); +- loottable.func_216120_b(lootcontext$builder.func_216022_a(LootParameterSets.field_216263_d), this::func_199701_a_); ++ LootContext ctx = lootcontext$builder.func_216022_a(LootParameterSets.field_216263_d); ++ loottable.func_216113_a(ctx).forEach(this::func_199701_a_); + } + + protected LootContext.Builder func_213363_a(boolean p_213363_1_, DamageSource p_213363_2_) { +@@ -1161,6 +1187,9 @@ + } + + public void func_70653_a(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) { ++ net.minecraftforge.event.entity.living.LivingKnockBackEvent event = net.minecraftforge.common.ForgeHooks.onLivingKnockBack(this, p_70653_1_, p_70653_2_, p_70653_3_, p_70653_5_); ++ if(event.isCanceled()) return; ++ p_70653_2_ = event.getStrength(); p_70653_3_ = event.getRatioX(); p_70653_5_ = event.getRatioZ(); + if (!(this.field_70146_Z.nextDouble() < this.func_110148_a(SharedMonsterAttributes.field_111266_c).func_111126_e())) { + this.field_70160_al = true; + Vec3d vec3d = this.func_213322_ci(); +@@ -1196,12 +1225,7 @@ + return false; + } else { + BlockState blockstate = this.func_213339_cH(); +- Block block = blockstate.func_177230_c(); +- if (block != Blocks.field_150468_ap && block != Blocks.field_150395_bd && block != Blocks.field_222420_lI) { +- return block instanceof TrapDoorBlock && this.func_184604_a(new BlockPos(this), blockstate); +- } else { +- return true; +- } ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, field_70170_p, new BlockPos(this), this); + } + } + +@@ -1225,6 +1249,11 @@ + } + + public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) { ++ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, p_225503_1_, p_225503_2_); ++ if (ret == null) return false; ++ p_225503_1_ = ret[0]; ++ p_225503_2_ = ret[1]; ++ + boolean flag = super.func_225503_b_(p_225503_1_, p_225503_2_); + int i = this.func_225508_e_(p_225503_1_, p_225503_2_); + if (i > 0) { +@@ -1248,9 +1277,10 @@ + int i = MathHelper.func_76128_c(this.func_226277_ct_()); + int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F); + int k = MathHelper.func_76128_c(this.func_226281_cx_()); +- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); +- if (!blockstate.func_196958_f()) { +- SoundType soundtype = blockstate.func_215695_r(); ++ BlockPos pos = new BlockPos(i, j, k); ++ BlockState blockstate = this.field_70170_p.func_180495_p(pos); ++ if (!blockstate.isAir(this.field_70170_p, pos)) { ++ SoundType soundtype = blockstate.getSoundType(field_70170_p, pos, this); + this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F); + } + +@@ -1319,6 +1349,8 @@ + + protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { + if (!this.func_180431_b(p_70665_1_)) { ++ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); ++ if (p_70665_2_ <= 0) return; + p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); + p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); + float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); +@@ -1328,10 +1360,11 @@ + ((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f * 10.0F)); + } + ++ f2 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, f2); + if (f2 != 0.0F) { + float f1 = this.func_110143_aJ(); +- this.func_70606_j(f1 - f2); + this.func_110142_aN().func_94547_a(p_70665_1_, f1, f2); ++ this.func_70606_j(f1 - f2); // Forge: moved to fix MC-121048 + this.func_110149_m(this.func_110139_bj() - f2); + } + } +@@ -1385,6 +1418,8 @@ + } + + public void func_226292_a_(Hand p_226292_1_, boolean p_226292_2_) { ++ ItemStack stack = this.func_184586_b(p_226292_1_); ++ if (!stack.func_190926_b() && stack.onEntitySwing(this)) return; + if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { + this.field_110158_av = -1; + this.field_82175_bq = true; +@@ -1771,15 +1806,16 @@ + } + + this.field_70160_al = true; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + @OnlyIn(Dist.CLIENT) + protected void func_203010_cG() { +- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F, 0.0D)); ++ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e(), 0.0D)); + } + + protected void func_180466_bG(Tag p_180466_1_) { +- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F, 0.0D)); ++ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e(), 0.0D)); + } + + protected float func_189749_co() { +@@ -1789,11 +1825,15 @@ + public void func_213352_e(Vec3d p_213352_1_) { + if (this.func_70613_aW() || this.func_184186_bw()) { + double d0 = 0.08D; ++ IAttributeInstance gravity = this.func_110148_a(ENTITY_GRAVITY); + boolean flag = this.func_213322_ci().field_72448_b <= 0.0D; + if (flag && this.func_70644_a(Effects.field_204839_B)) { +- d0 = 0.01D; ++ if (!gravity.func_180374_a(SLOW_FALLING)) gravity.func_111121_a(SLOW_FALLING); + this.field_70143_R = 0.0F; ++ } else if (gravity.func_180374_a(SLOW_FALLING)) { ++ gravity.func_111124_b(SLOW_FALLING); + } ++ d0 = gravity.func_111126_e(); + + if (!this.func_70090_H() || this instanceof PlayerEntity && ((PlayerEntity)this).field_71075_bZ.field_75100_b) { + if (!this.func_180799_ab() || this instanceof PlayerEntity && ((PlayerEntity)this).field_71075_bZ.field_75100_b) { +@@ -1842,7 +1882,7 @@ + } + } else { + BlockPos blockpos = this.func_226270_aj_(); +- float f5 = this.field_70170_p.func_180495_p(blockpos).func_177230_c().func_208618_m(); ++ float f5 = this.field_70170_p.func_180495_p(blockpos).getSlipperiness(field_70170_p, blockpos, this); + float f7 = this.field_70122_E ? f5 * 0.91F : 0.91F; + this.func_213309_a(this.func_213335_r(f5), p_213352_1_); + this.func_213317_d(this.func_213362_f(this.func_213322_ci())); +@@ -1904,6 +1944,7 @@ + f = 0.96F; + } + ++ f1 *= (float)this.func_110148_a(SWIM_SPEED).func_111126_e(); + this.func_213309_a(f1, p_213352_1_); + this.func_213315_a(MoverType.SELF, this.func_213322_ci()); + Vec3d vec3d1 = this.func_213322_ci(); +@@ -1979,6 +2020,7 @@ + } + + public void func_70071_h_() { ++ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; + super.func_70071_h_(); + this.func_184608_ct(); + this.func_205014_p(); +@@ -2022,7 +2064,9 @@ + + ItemStack itemstack1 = this.func_184582_a(equipmentslottype); + if (!ItemStack.func_77989_b(itemstack1, itemstack)) { ++ if (!itemstack1.equals(itemstack, true)) + ((ServerWorld)this.field_70170_p).func_72863_F().func_217218_b(this, new SEntityEquipmentPacket(this.func_145782_y(), equipmentslottype, itemstack1)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent(this, equipmentslottype, itemstack, itemstack1)); + if (!itemstack.func_190926_b()) { + this.func_110140_aT().func_111148_a(itemstack.func_111283_C(equipmentslottype)); + } +@@ -2474,13 +2518,22 @@ + + private void func_184608_ct() { + if (this.func_184587_cr()) { +- if (ItemStack.func_185132_d(this.func_184586_b(this.func_184600_cs()), this.field_184627_bm)) { ++ ItemStack itemstack = this.func_184586_b(this.func_184600_cs()); ++ if (net.minecraftforge.common.ForgeHooks.canContinueUsing(this.field_184627_bm, itemstack)) this.field_184627_bm = itemstack; ++ if (itemstack == this.field_184627_bm) { ++ ++ if (!this.field_184627_bm.func_190926_b()) { ++ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn); ++ if (field_184628_bn > 0) ++ field_184627_bm.onUsingTick(this, field_184628_bn); ++ } ++ + this.field_184627_bm.func_222121_b(this.field_70170_p, this, this.func_184605_cv()); + if (this.func_226299_p_()) { + this.func_226293_b_(this.field_184627_bm, 5); + } + +- if (--this.field_184628_bn == 0 && !this.field_70170_p.field_72995_K && !this.field_184627_bm.func_222122_m()) { ++ if (--this.field_184628_bn <= 0 && !this.field_70170_p.field_72995_K && !this.field_184627_bm.func_222122_m()) { + this.func_71036_o(); + } + } else { +@@ -2522,8 +2575,10 @@ + public void func_184598_c(Hand p_184598_1_) { + ItemStack itemstack = this.func_184586_b(p_184598_1_); + if (!itemstack.func_190926_b() && !this.func_184587_cr()) { ++ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.func_77988_m()); ++ if (duration <= 0) return; + this.field_184627_bm = itemstack; +- this.field_184628_bn = itemstack.func_77988_m(); ++ this.field_184628_bn = duration; + if (!this.field_70170_p.field_72995_K) { + this.func_204802_c(1, true); + this.func_204802_c(2, p_184598_1_ == Hand.OFF_HAND); +@@ -2583,6 +2638,9 @@ + vec3d1 = vec3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F)); + vec3d1 = vec3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F)); + vec3d1 = vec3d1.func_72441_c(this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_()); ++ if (this.field_70170_p instanceof ServerWorld) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant ++ ((ServerWorld)this.field_70170_p).func_195598_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, 1, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c, 0.0D); ++ else + this.field_70170_p.func_195594_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c); + } + +@@ -2594,7 +2652,9 @@ + } else { + if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) { + this.func_226293_b_(this.field_184627_bm, 16); +- this.func_184611_a(this.func_184600_cs(), this.field_184627_bm.func_77950_b(this.field_70170_p, this)); ++ ItemStack copy = this.field_184627_bm.func_77946_l(); ++ ItemStack stack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, copy, func_184605_cv(), this.field_184627_bm.func_77950_b(this.field_70170_p, this)); ++ this.func_184611_a(this.func_184600_cs(), stack); + this.func_184602_cy(); + } + +@@ -2615,7 +2675,11 @@ + + public void func_184597_cx() { + if (!this.field_184627_bm.func_190926_b()) { ++ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv())) { ++ ItemStack copy = this instanceof PlayerEntity ? field_184627_bm.func_77946_l() : null; + this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv()); ++ if (copy != null && field_184627_bm.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem((PlayerEntity)this, copy, func_184600_cs()); ++ } + if (this.field_184627_bm.func_222122_m()) { + this.func_184608_ct(); + } +@@ -2772,16 +2836,16 @@ + + private boolean func_213359_p() { + return this.func_213374_dv().map((p_213347_1_) -> { +- return this.field_70170_p.func_180495_p(p_213347_1_).func_177230_c() instanceof BedBlock; ++ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, p_213347_1_); + }).orElse(false); + } + + public void func_213366_dy() { + this.func_213374_dv().filter(this.field_70170_p::func_175667_e).ifPresent((p_213368_1_) -> { + BlockState blockstate = this.field_70170_p.func_180495_p(p_213368_1_); +- if (blockstate.func_177230_c() instanceof BedBlock) { +- this.field_70170_p.func_180501_a(p_213368_1_, blockstate.func_206870_a(BedBlock.field_176471_b, Boolean.valueOf(false)), 3); +- Vec3d vec3d = BedBlock.func_220172_a(this.func_200600_R(), this.field_70170_p, p_213368_1_, 0).orElseGet(() -> { ++ if (blockstate.isBed(this.field_70170_p, p_213368_1_, this)) { ++ blockstate.setBedOccupied(field_70170_p, p_213368_1_, this, false); ++ Vec3d vec3d = blockstate.getBedSpawnPosition(this.func_200600_R(), field_70170_p, p_213368_1_, this).orElseGet(()-> { + BlockPos blockpos = p_213368_1_.func_177984_a(); + return new Vec3d((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.1D, (double)blockpos.func_177952_p() + 0.5D); + }); +@@ -2797,7 +2861,9 @@ + @OnlyIn(Dist.CLIENT) + public Direction func_213376_dz() { + BlockPos blockpos = this.func_213374_dv().orElse((BlockPos)null); +- return blockpos != null ? BedBlock.func_220174_a(this.field_70170_p, blockpos) : null; ++ if (blockpos == null) return Direction.UP; ++ BlockState state = this.field_70170_p.func_180495_p(blockpos); ++ return !state.isBed(field_70170_p, blockpos, this) ? Direction.UP : state.getBedDirection(field_70170_p, blockpos); + } + + public boolean func_70094_T() { +@@ -2866,4 +2932,58 @@ + public void func_213334_d(Hand p_213334_1_) { + this.func_213361_c(p_213334_1_ == Hand.MAIN_HAND ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND); + } ++ ++ /* ==== FORGE START ==== */ ++ /*** ++ * Removes all potion effects that have curativeItem as a curative item for its effect ++ * @param curativeItem The itemstack we are using to cure potion effects ++ */ ++ public boolean curePotionEffects(ItemStack curativeItem) { ++ if (this.field_70170_p.field_72995_K) ++ return false; ++ boolean ret = false; ++ Iterator itr = this.field_70713_bf.values().iterator(); ++ while (itr.hasNext()) { ++ EffectInstance effect = itr.next(); ++ if (effect.isCurativeItem(curativeItem) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, effect))) { ++ this.func_70688_c(effect); ++ itr.remove(); ++ ret = true; ++ this.field_70752_e = true; ++ } ++ } ++ return ret; ++ } ++ ++ /** ++ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. ++ * currently only used in vanilla code by pigs. ++ * ++ * @param player The player who is riding the entity. ++ * @return If the player should orient the same direction as this entity. ++ */ ++ public boolean shouldRiderFaceForward(PlayerEntity player) { ++ return this instanceof net.minecraft.entity.passive.PigEntity; ++ } ++ ++ private final net.minecraftforge.common.util.LazyOptional[] handlers = net.minecraftforge.items.wrapper.EntityEquipmentInvWrapper.create(this); ++ ++ @Override ++ public 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(); ++ else if (facing.func_176740_k().func_176722_c()) return handlers[1].cast(); ++ } ++ return super.getCapability(capability, facing); ++ } ++ ++ @Override ++ public void remove(boolean keepData) { ++ super.remove(keepData); ++ if (!keepData) { ++ for (int x = 0; x < handlers.length; x++) ++ handlers[x].invalidate(); ++ } ++ } + } diff --git a/patches_old/minecraft/net/minecraft/entity/MobEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/MobEntity.java.patch new file mode 100644 index 000000000..f02a86a3f --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/MobEntity.java.patch @@ -0,0 +1,65 @@ +--- a/net/minecraft/entity/MobEntity.java ++++ b/net/minecraft/entity/MobEntity.java +@@ -176,6 +176,7 @@ + + public void func_70624_b(@Nullable LivingEntity p_70624_1_) { + this.field_70696_bz = p_70624_1_; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); + } + + public boolean func_213358_a(EntityType p_213358_1_) { +@@ -460,7 +461,7 @@ + public void func_70636_d() { + super.func_70636_d(); + this.field_70170_p.func_217381_Z().func_76320_a("looting"); +- if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && this.func_70089_S() && !this.field_70729_aU && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { ++ if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && this.func_70089_S() && !this.field_70729_aU && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { + for(ItemEntity itementity : this.field_70170_p.func_217357_a(ItemEntity.class, this.func_174813_aQ().func_72314_b(1.0D, 0.0D, 1.0D))) { + if (!itementity.field_70128_L && !itementity.func_92059_d().func_190926_b() && !itementity.func_174874_s()) { + this.func_175445_a(itementity); +@@ -556,6 +557,14 @@ + this.func_70106_y(); + } else if (!this.func_104002_bU() && !this.func_213392_I()) { + Entity entity = this.field_70170_p.func_217362_a(this, -1.0D); ++ net.minecraftforge.eventbus.api.Event.Result result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this); ++ if (result == net.minecraftforge.eventbus.api.Event.Result.DENY) { ++ field_70708_bq = 0; ++ entity = null; ++ } else if (result == net.minecraftforge.eventbus.api.Event.Result.ALLOW) { ++ this.func_70106_y(); ++ entity = null; ++ } + if (entity != null) { + double d0 = entity.func_70068_e(this); + if (d0 > 16384.0D && this.func_213397_c(d0)) { +@@ -791,6 +800,8 @@ + } + + public static EquipmentSlotType func_184640_d(ItemStack p_184640_0_) { ++ final EquipmentSlotType slot = p_184640_0_.getEquipmentSlot(); ++ if (slot != null) return slot; // FORGE: Allow modders to set a non-default equipment slot for a stack; e.g. a non-armor chestplate-slot item + Item item = p_184640_0_.func_77973_b(); + if (item != Blocks.field_196625_cS.func_199767_j() && (!(item instanceof BlockItem) || !(((BlockItem)item).func_179223_d() instanceof AbstractSkullBlock))) { + if (item instanceof ArmorItem) { +@@ -798,7 +809,7 @@ + } else if (item == Items.field_185160_cR) { + return EquipmentSlotType.CHEST; + } else { +- return item == Items.field_185159_cQ ? EquipmentSlotType.OFFHAND : EquipmentSlotType.MAINHAND; ++ return p_184640_0_.isShield(null) ? EquipmentSlotType.OFFHAND : EquipmentSlotType.MAINHAND; + } + } else { + return EquipmentSlotType.HEAD; +@@ -1178,10 +1189,10 @@ + PlayerEntity playerentity = (PlayerEntity)p_70652_1_; + ItemStack itemstack = this.func_184614_ca(); + ItemStack itemstack1 = playerentity.func_184587_cr() ? playerentity.func_184607_cu() : ItemStack.field_190927_a; +- if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.func_77973_b() instanceof AxeItem && itemstack1.func_77973_b() == Items.field_185159_cQ) { ++ if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.canDisableShield(itemstack1, playerentity, this) && itemstack1.isShield(playerentity)) { + float f2 = 0.25F + (float)EnchantmentHelper.func_185293_e(this) * 0.05F; + if (this.field_70146_Z.nextFloat() < f2) { +- playerentity.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100); ++ playerentity.func_184811_cZ().func_185145_a(itemstack.func_77973_b(), 100); + this.field_70170_p.func_72960_a(playerentity, (byte)30); + } + } diff --git a/patches/minecraft/net/minecraft/entity/SharedMonsterAttributes.java.patch b/patches_old/minecraft/net/minecraft/entity/SharedMonsterAttributes.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/SharedMonsterAttributes.java.patch rename to patches_old/minecraft/net/minecraft/entity/SharedMonsterAttributes.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch new file mode 100644 index 000000000..01a17200e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java ++++ b/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java +@@ -18,7 +18,7 @@ + import net.minecraft.util.math.IPosWrapper; + import net.minecraft.util.registry.Registry; + +-public class MemoryModuleType { ++public class MemoryModuleType extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final MemoryModuleType field_220940_a = func_223541_a("dummy"); + public static final MemoryModuleType field_220941_b = func_220937_a("home", Optional.of(GlobalPos::func_218176_a)); + public static final MemoryModuleType field_220942_c = func_220937_a("job_site", Optional.of(GlobalPos::func_218176_a)); diff --git a/patches_old/minecraft/net/minecraft/entity/ai/brain/schedule/Activity.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/brain/schedule/Activity.java.patch new file mode 100644 index 000000000..c3c1c0e71 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/ai/brain/schedule/Activity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/ai/brain/schedule/Activity.java ++++ b/net/minecraft/entity/ai/brain/schedule/Activity.java +@@ -2,7 +2,7 @@ + + import net.minecraft.util.registry.Registry; + +-public class Activity { ++public class Activity extends net.minecraftforge.registries.ForgeRegistryEntry { + public static final Activity field_221365_a = func_221363_a("core"); + public static final Activity field_221366_b = func_221363_a("idle"); + public static final Activity field_221367_c = func_221363_a("work"); diff --git a/patches_old/minecraft/net/minecraft/entity/ai/brain/schedule/Schedule.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/brain/schedule/Schedule.java.patch new file mode 100644 index 000000000..f213d56d2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/ai/brain/schedule/Schedule.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/ai/brain/schedule/Schedule.java ++++ b/net/minecraft/entity/ai/brain/schedule/Schedule.java +@@ -8,7 +8,7 @@ + import java.util.stream.Collectors; + import net.minecraft.util.registry.Registry; + +-public class Schedule { ++public class Schedule extends net.minecraftforge.registries.ForgeRegistryEntry { + public static final Schedule field_221383_a = func_221380_a("empty").func_221402_a(0, Activity.field_221366_b).func_221404_a(); + public static final Schedule field_221384_b = func_221380_a("simple").func_221402_a(5000, Activity.field_221367_c).func_221402_a(11000, Activity.field_221369_e).func_221404_a(); + public static final Schedule field_221385_c = func_221380_a("villager_baby").func_221402_a(10, Activity.field_221366_b).func_221402_a(3000, Activity.field_221368_d).func_221402_a(6000, Activity.field_221366_b).func_221402_a(10000, Activity.field_221368_d).func_221402_a(12000, Activity.field_221369_e).func_221404_a(); diff --git a/patches_old/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch new file mode 100644 index 000000000..d1a3ed307 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/ai/brain/sensor/SensorType.java ++++ b/net/minecraft/entity/ai/brain/sensor/SensorType.java +@@ -4,7 +4,7 @@ + import net.minecraft.util.ResourceLocation; + import net.minecraft.util.registry.Registry; + +-public class SensorType> { ++public class SensorType> extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final SensorType field_220997_a = func_220996_a("dummy", DummySensor::new); + public static final SensorType field_220998_b = func_220996_a("nearest_living_entities", NearestLivingEntitiesSensor::new); + public static final SensorType field_220999_c = func_220996_a("nearest_players", NearestPlayersSensor::new); diff --git a/patches_old/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch new file mode 100644 index 000000000..9e6673880 --- /dev/null +++ b/patches_old/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_223586_b(GameRules.field_223599_b)) { ++ 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; +@@ -136,6 +136,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_old/minecraft/net/minecraft/entity/ai/goal/BreakBlockGoal.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/goal/BreakBlockGoal.java.patch new file mode 100644 index 000000000..775739b04 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/ai/goal/BreakBlockGoal.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/ai/goal/BreakBlockGoal.java ++++ b/net/minecraft/entity/ai/goal/BreakBlockGoal.java +@@ -32,7 +32,7 @@ + } + + public boolean func_75250_a() { +- if (!this.field_203118_g.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { ++ if (!net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.field_203118_g.field_70170_p, this.field_179494_b, this.field_203118_g)) { + return false; + } else if (this.field_179496_a > 0) { + --this.field_179496_a; diff --git a/patches_old/minecraft/net/minecraft/entity/ai/goal/BreakDoorGoal.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/goal/BreakDoorGoal.java.patch new file mode 100644 index 000000000..bc4230d67 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/ai/goal/BreakDoorGoal.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/ai/goal/BreakDoorGoal.java ++++ b/net/minecraft/entity/ai/goal/BreakDoorGoal.java +@@ -29,7 +29,7 @@ + public boolean func_75250_a() { + if (!super.func_75250_a()) { + return false; +- } else if (!this.field_75356_a.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { ++ } else if (!net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.field_75356_a.field_70170_p, this.field_179507_b, this.field_75356_a)) { + return false; + } else { + 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/goal/BreedGoal.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/goal/BreedGoal.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/ai/goal/BreedGoal.java.patch rename to patches_old/minecraft/net/minecraft/entity/ai/goal/BreedGoal.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch new file mode 100644 index 000000000..7c4feb3d6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/entity/ai/goal/EatGrassGoal.java ++++ b/net/minecraft/entity/ai/goal/EatGrassGoal.java +@@ -59,7 +59,7 @@ + if (this.field_151502_a == 4) { + 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_223586_b(GameRules.field_223599_b)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b)) { + this.field_151501_c.func_175655_b(blockpos, false); + } + +@@ -67,7 +67,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_223586_b(GameRules.field_223599_b)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b)) { + 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_old/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch new file mode 100644 index 000000000..bba290bbf --- /dev/null +++ b/patches_old/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, 0); ++ 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, 0); + if (this.field_75438_g != null) { + return true; +@@ -92,6 +103,18 @@ + this.field_151495_j = livingentity.func_226278_cu_(); + this.field_151496_k = livingentity.func_226281_cx_(); + 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_old/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch rename to patches_old/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch b/patches_old/minecraft/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch new file mode 100644 index 000000000..07266933d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch @@ -0,0 +1,11 @@ +--- 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, (PlayerEntity)entity)) { + this.field_111180_a.func_110263_g((PlayerEntity)entity); + return; + } diff --git a/patches_old/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch new file mode 100644 index 000000000..3619caf1b --- /dev/null +++ b/patches_old/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 +@@ -212,7 +212,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_223586_b(GameRules.field_223599_b) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; ++ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; + this.field_70170_p.func_217398_a(this, this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_(), 7.0F, false, explosion$mode); + this.field_70170_p.func_175669_a(1023, new BlockPos(this), 0); + } +@@ -287,7 +287,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_223586_b(GameRules.field_223599_b)) { ++ if (this.field_82222_j == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { + int i1 = MathHelper.func_76128_c(this.func_226278_cu_()); + int l1 = MathHelper.func_76128_c(this.func_226277_ct_()); + int i2 = MathHelper.func_76128_c(this.func_226281_cx_()); +@@ -301,7 +301,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_225521_a_(blockpos, true, this) || flag; + } + } +@@ -322,6 +322,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_old/minecraft/net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch rename to patches_old/minecraft/net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch new file mode 100644 index 000000000..c441725bf --- /dev/null +++ b/patches_old/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 +@@ -80,6 +80,7 @@ + List list = this.field_70170_p.func_175674_a(this, new AxisAlignedBB(this.func_226277_ct_() - 3.0D, this.func_226278_cu_() - 3.0D, this.func_226281_cx_() - 3.0D, this.func_226277_ct_() + 3.0D, this.func_226278_cu_() + 6.0D + 3.0D, this.func_226281_cx_() + 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_old/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch new file mode 100644 index 000000000..e63ad54f5 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/entity/item/BoatEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/BoatEntity.java.patch new file mode 100644 index 000000000..4b85b1c0f --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/BoatEntity.java.patch @@ -0,0 +1,28 @@ +--- a/net/minecraft/entity/item/BoatEntity.java ++++ b/net/minecraft/entity/item/BoatEntity.java +@@ -461,7 +461,7 @@ + blockpos$pooledmutable.func_181079_c(l1, k2, i2); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos$pooledmutable); + if (!(blockstate.func_177230_c() instanceof LilyPadBlock) && VoxelShapes.func_197879_c(blockstate.func_196952_d(this.field_70170_p, blockpos$pooledmutable).func_197751_a((double)l1, (double)k2, (double)i2), voxelshape, IBooleanFunction.field_223238_i_)) { +- f += blockstate.func_177230_c().func_208618_m(); ++ f += blockstate.getSlipperiness(this.field_70170_p, blockpos$pooledmutable, this); + ++k1; + } + } +@@ -776,6 +776,16 @@ + return new SSpawnObjectPacket(this); + } + ++ // Forge: Fix MC-119811 by instantly completing lerp on board ++ @Override ++ protected void func_184200_o(Entity passenger) { ++ super.func_184200_o(passenger); ++ if (this.func_184186_bw() && this.field_184476_at > 0) { ++ this.field_184476_at = 0; ++ this.func_70080_a(this.field_70281_h, this.field_184477_av, this.field_184478_aw, (float)this.field_70273_g, (float)this.field_184479_ay); ++ } ++ } ++ + public static enum Status { + IN_WATER, + UNDER_WATER, 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..027066c18 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/entity/item/EnderPearlEntity.java ++++ b/net/minecraft/entity/item/EnderPearlEntity.java +@@ -85,6 +85,8 @@ + if (livingentity instanceof ServerPlayerEntity) { + ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)livingentity; + if (serverplayerentity.field_71135_a.func_147298_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.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), 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_223586_b(GameRules.field_223601_d)) { + EndermiteEntity endermiteentity = EntityType.field_200804_r.func_200721_a(this.field_70170_p); + endermiteentity.func_175496_a(true); +@@ -96,9 +98,10 @@ + livingentity.func_184210_p(); + } + +- livingentity.func_70634_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_()); ++ 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.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_()); +@@ -121,11 +124,11 @@ + } + + @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/ExperienceOrbEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch new file mode 100644 index 000000000..d6935dc02 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch @@ -0,0 +1,36 @@ +--- a/net/minecraft/entity/item/ExperienceOrbEntity.java ++++ b/net/minecraft/entity/item/ExperienceOrbEntity.java +@@ -98,7 +98,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.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).func_177230_c().func_208618_m() * 0.98F; ++ BlockPos pos =new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_()); ++ f = this.field_70170_p.func_180495_p(pos).getSlipperiness(this.field_70170_p, pos, this) * 0.98F; + } + + this.func_213317_d(this.func_213322_ci().func_216372_d((double)f, 0.98D, (double)f)); +@@ -127,6 +128,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 { +@@ -155,13 +157,14 @@ + public void func_70100_b_(PlayerEntity p_70100_1_) { + if (!this.field_70170_p.field_72995_K) { + if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerXpEvent.PickupXp(p_70100_1_, this))) return; + p_70100_1_.field_71090_bL = 2; + p_70100_1_.func_71001_a(this, 1); + Entry 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); + } diff --git a/patches_old/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch new file mode 100644 index 000000000..6f29d16ef --- /dev/null +++ b/patches_old/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 +@@ -153,7 +153,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/FireworkRocketEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/FireworkRocketEntity.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/item/FireworkRocketEntity.java.patch rename to patches_old/minecraft/net/minecraft/entity/item/FireworkRocketEntity.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/item/HangingEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/HangingEntity.java.patch new file mode 100644 index 000000000..7b173e0a1 --- /dev/null +++ b/patches_old/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 +@@ -113,6 +113,8 @@ + int j1 = (j - 1) / -2; + blockpos$mutable.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$mutable); ++ if (net.minecraft.block.Block.func_220055_a(this.field_70170_p, blockpos$mutable, this.field_174860_b)) ++ continue; + if (!blockstate.func_185904_a().func_76220_a() && !RedstoneDiodeBlock.func_185546_B(blockstate)) { + return false; + } 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..8b647d9a6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/ItemEntity.java.patch @@ -0,0 +1,131 @@ +--- 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; ++ /** ++ * The maximum age of this EntityItem. The item is expired once this is reached. ++ */ ++ public int lifespan = 6000; + public final float field_70290_d = (float)(Math.random() * Math.PI * 2.0D); + + 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_225502_at_() { +@@ -65,6 +70,7 @@ + } + + public void func_70071_h_() { ++ if (func_92059_d().onEntityItemUpdate(this)) return; + if (this.func_92059_d().func_190926_b()) { + this.func_70106_y(); + } else { +@@ -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.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).func_177230_c().func_208618_m() * 0.98F; ++ BlockPos pos = new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_()); ++ f = this.field_70170_p.func_180495_p(pos).getSlipperiness(this.field_70170_p, pos, this) * 0.98F; + } + + this.func_213317_d(this.func_213322_ci().func_216372_d((double)f, 0.98D, (double)f)); +@@ -130,7 +137,14 @@ + } + } + +- if (!this.field_70170_p.field_72995_K && this.field_70292_b >= 6000) { ++ ItemStack item = this.func_92059_d(); ++ if (!this.field_70170_p.field_72995_K && this.field_70292_b >= lifespan) { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); ++ if (hook < 0) this.func_70106_y(); ++ else this.lifespan += hook; ++ } ++ ++ if (item.func_190926_b()) { + this.func_70106_y(); + } + +@@ -183,6 +197,8 @@ + return false; + } else if (p_226532_1_.func_77942_o() ^ p_226532_0_.func_77942_o()) { + return false; ++ }else if (!p_226532_0_.areCapsCompatible(p_226532_1_)) { ++ return false; + } else { + return !p_226532_1_.func_77942_o() || p_226532_1_.func_77978_p().equals(p_226532_0_.func_77978_p()); + } +@@ -216,6 +232,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 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()) { +@@ -235,6 +252,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_213281_1_.func_218657_a("Thrower", NBTUtil.func_186862_a(this.func_200214_m())); + } +@@ -255,6 +273,7 @@ + if (p_70037_1_.func_74764_b("PickupDelay")) { + this.field_145804_b = p_70037_1_.func_74765_d("PickupDelay"); + } ++ if (p_70037_1_.func_74764_b("Lifespan")) lifespan = p_70037_1_.func_74762_e("Lifespan"); + + if (p_70037_1_.func_150297_b("Owner", 10)) { + this.field_145802_g = NBTUtil.func_186860_b(p_70037_1_.func_74775_l("Owner")); +@@ -274,12 +293,21 @@ + + 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(); + Item item = itemstack.func_77973_b(); + int i = itemstack.func_190916_E(); +- if (this.field_145804_b == 0 && (this.field_145802_g == null || this.field_145802_g.equals(p_70100_1_.func_110124_au())) && p_70100_1_.field_71071_by.func_70441_a(itemstack)) { ++ ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_70100_1_); ++ if (hook < 0) return; ++ ++ ItemStack copy = itemstack.func_77946_l(); ++ if (this.field_145804_b == 0 && (this.field_145802_g == null || lifespan - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_110124_au())) && (hook == 1 || i <= 0 || p_70100_1_.field_71071_by.func_70441_a(itemstack))) { ++ copy.func_190920_e(copy.func_190916_E() - func_92059_d().func_190916_E()); ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerItemPickupEvent(p_70100_1_, this, copy); + p_70100_1_.func_71001_a(this, i); + if (itemstack.func_190926_b()) { ++ p_70100_1_.func_71001_a(this, i); + this.func_70106_y(); + itemstack.func_190920_e(i); + } +@@ -300,8 +328,8 @@ + } + + @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(); + } +@@ -366,7 +394,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_old/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch new file mode 100644 index 000000000..01a71f9e4 --- /dev/null +++ b/patches_old/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 +@@ -192,7 +192,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_old/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch new file mode 100644 index 000000000..a9b1db525 --- /dev/null +++ b/patches_old/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 +@@ -43,6 +43,7 @@ + + protected void func_174856_o() { + this.func_226288_n_((double)this.field_174861_a.func_177958_n() + 0.5D, (double)this.field_174861_a.func_177956_o() + 0.5D, (double)this.field_174861_a.func_177952_p() + 0.5D); ++ if (this.isAddedToWorld() && this.field_70170_p instanceof net.minecraft.world.server.ServerWorld) ((net.minecraft.world.server.ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. + } + + public void func_174859_a(Direction p_174859_1_) { diff --git a/patches_old/minecraft/net/minecraft/entity/item/PaintingType.java.patch b/patches_old/minecraft/net/minecraft/entity/item/PaintingType.java.patch new file mode 100644 index 000000000..32ab423ee --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/PaintingType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/item/PaintingType.java ++++ b/net/minecraft/entity/item/PaintingType.java +@@ -2,7 +2,7 @@ + + import net.minecraft.util.registry.Registry; + +-public class PaintingType { ++public class PaintingType extends net.minecraftforge.registries.ForgeRegistryEntry { + public static final PaintingType field_200843_b = func_221119_a("kebab", 16, 16); + public static final PaintingType field_200844_c = func_221119_a("aztec", 16, 16); + public static final PaintingType field_200845_d = func_221119_a("alban", 16, 16); diff --git a/patches_old/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch new file mode 100644 index 000000000..f2f092c76 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch @@ -0,0 +1,257 @@ +--- a/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java ++++ b/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java +@@ -40,7 +40,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); +@@ -80,6 +80,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_); +@@ -126,11 +127,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() { +@@ -239,9 +241,9 @@ + + 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) { ++ if (blockstate.func_177230_c() instanceof PoweredRailBlock && ((PoweredRailBlock) blockstate.func_177230_c()).isActivatorRail()) { + this.func_96095_a(i, j, k, blockstate.func_177229_b(PoweredRailBlock.field_176569_M)); + } + } else { +@@ -266,8 +268,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); +@@ -279,7 +284,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); + } +@@ -287,6 +292,7 @@ + } + + this.func_70072_I(); ++ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); + } + } + +@@ -298,16 +304,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())); + } + + } +@@ -322,29 +336,28 @@ + boolean flag = false; + boolean flag1 = false; + AbstractRailBlock abstractrailblock = (AbstractRailBlock)p_180460_2_.func_177230_c(); +- if (abstractrailblock == Blocks.field_196552_aC) { ++ if (abstractrailblock instanceof PoweredRailBlock && !((PoweredRailBlock) abstractrailblock).isActivatorRail()) { + flag = p_180460_2_.func_177229_b(PoweredRailBlock.field_176569_M); + flag1 = !flag; + } + +- double d3 = 0.0078125D; + 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*getSlopeAdjustment(), 0.0D, 0.0D)); + ++d1; + 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(getSlopeAdjustment(), 0.0D, 0.0D)); + ++d1; + 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, getSlopeAdjustment())); + ++d1; + 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*getSlopeAdjustment())); + ++d1; + } + +@@ -375,7 +388,7 @@ + } + } + +- if (flag1) { ++ if (flag1 && shouldDoRailFunctions()) { + double d22 = Math.sqrt(func_213296_b(this.func_213322_ci())); + if (d22 < 0.03D) { + this.func_213317_d(Vec3d.field_186680_a); +@@ -404,10 +417,7 @@ + d0 = d23 + d4 * d14; + d2 = d10 + d5 * d14; + this.func_70107_b(d0, d1, d2); +- double d24 = this.func_184207_aI() ? 0.75D : 1.0D; +- double d25 = this.func_174898_m(); +- vec3d1 = this.func_213322_ci(); +- this.func_213315_a(MoverType.SELF, new Vec3d(MathHelper.func_151237_a(d24 * vec3d1.field_72450_a, -d25, d25), 0.0D, MathHelper.func_151237_a(d24 * vec3d1.field_72449_c, -d25, d25))); ++ this.moveMinecartOnRail(p_180460_1_); + if (vec3i.func_177956_o() != 0 && MathHelper.func_76128_c(this.func_226277_ct_()) - p_180460_1_.func_177958_n() == vec3i.func_177958_n() && MathHelper.func_76128_c(this.func_226281_cx_()) - p_180460_1_.func_177952_p() == vec3i.func_177952_p()) { + this.func_70107_b(this.func_226277_ct_(), this.func_226278_cu_() + (double)vec3i.func_177956_o(), this.func_226281_cx_()); + } else if (vec3i1.func_177956_o() != 0 && MathHelper.func_76128_c(this.func_226277_ct_()) - p_180460_1_.func_177958_n() == vec3i1.func_177958_n() && MathHelper.func_76128_c(this.func_226281_cx_()) - p_180460_1_.func_177952_p() == vec3i1.func_177952_p()) { +@@ -435,7 +445,10 @@ + this.func_213293_j(d26 * (double)(j - p_180460_1_.func_177958_n()), vec3d5.field_72448_b, d26 * (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 d27 = Math.sqrt(func_213296_b(vec3d6)); + if (d27 > 0.01D) { +@@ -490,7 +503,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); +@@ -529,7 +542,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); + Pair pair = func_226573_a_(railshape); + Vec3i vec3i = pair.getFirst(); + Vec3i vec3i1 = pair.getSecond(); +@@ -592,6 +605,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_)) { +@@ -627,11 +645,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)); +@@ -737,6 +755,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 getMaxSpeedWithRail() { //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 d24 = mc.func_184207_aI() ? 0.75D : 1.0D; ++ double d25 = mc.getMaxSpeedWithRail(); ++ Vec3d vec3d1 = mc.func_213322_ci(); ++ mc.func_213315_a(MoverType.SELF, new Vec3d(MathHelper.func_151237_a(d24 * vec3d1.field_72450_a, -d25, d25), 0.0D, MathHelper.func_151237_a(d24 * vec3d1.field_72449_c, -d25, d25))); ++ } ++ + public static enum Type { + RIDEABLE, + CHEST, diff --git a/patches_old/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch new file mode 100644 index 000000000..8459e6051 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch @@ -0,0 +1,61 @@ +--- a/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java ++++ b/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java +@@ -110,17 +110,19 @@ + } + + @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() { ++ @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_) { +@@ -149,6 +151,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; + } +@@ -168,6 +171,8 @@ + 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); ++ // Forge: add this entity to loot context, however, currently Vanilla uses 'this' for the player creating the chests. So we take over 'killer_entity' for this. ++ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this); + 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_); + } +@@ -198,4 +203,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_old/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch new file mode 100644 index 000000000..3cfb77768 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch @@ -0,0 +1,10 @@ +--- 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(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) { + if (!p_184230_1_.field_71075_bZ.field_75098_d) { diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/MinecartCommandBlockEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/minecart/MinecartCommandBlockEntity.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/item/minecart/MinecartCommandBlockEntity.java.patch rename to patches_old/minecraft/net/minecraft/entity/item/minecart/MinecartCommandBlockEntity.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch new file mode 100644 index 000000000..bd7714407 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch @@ -0,0 +1,10 @@ +--- 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(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_226563_dT_()) { + return false; + } else if (this.func_184207_aI()) { diff --git a/patches_old/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch new file mode 100644 index 000000000..02d08e37b --- /dev/null +++ b/patches_old/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/AbstractVillagerEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/merchant/villager/AbstractVillagerEntity.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/merchant/villager/AbstractVillagerEntity.java.patch rename to patches_old/minecraft/net/minecraft/entity/merchant/villager/AbstractVillagerEntity.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch new file mode 100644 index 000000000..b387ba622 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/entity/merchant/villager/VillagerEntity.java ++++ b/net/minecraft/entity/merchant/villager/VillagerEntity.java +@@ -228,7 +228,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_226563_dT_()) { + if (this.func_70631_g_()) { + this.func_213756_es(); + return super.func_184645_a(p_184645_1_, p_184645_2_); +@@ -607,7 +607,8 @@ + } + + protected ITextComponent func_225513_by_() { +- return new TranslationTextComponent(this.func_200600_R().func_210760_d() + '.' + Registry.field_218370_L.func_177774_c(this.func_213700_eh().func_221130_b()).func_110623_a()); ++ net.minecraft.util.ResourceLocation profName = this.func_213700_eh().func_221130_b().getRegistryName(); ++ return new TranslationTextComponent(this.func_200600_R().func_210760_d() + '.' + (!"minecraft".equals(profName.func_110624_b()) ? profName.func_110624_b() + '.' : "") + profName.func_110623_a()); + } + + @OnlyIn(Dist.CLIENT) diff --git a/patches_old/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch b/patches_old/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch new file mode 100644 index 000000000..feb536f75 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/merchant/villager/VillagerProfession.java ++++ b/net/minecraft/entity/merchant/villager/VillagerProfession.java +@@ -12,7 +12,7 @@ + import net.minecraft.util.registry.Registry; + import net.minecraft.village.PointOfInterestType; + +-public class VillagerProfession { ++public class VillagerProfession extends net.minecraftforge.registries.ForgeRegistryEntry { + public static final VillagerProfession field_221151_a = func_226556_a_("none", PointOfInterestType.field_221054_b, (SoundEvent)null); + public static final VillagerProfession field_221152_b = func_226556_a_("armorer", PointOfInterestType.field_221055_c, SoundEvents.field_219694_mB); + public static final VillagerProfession field_221153_c = func_226556_a_("butcher", PointOfInterestType.field_221056_d, SoundEvents.field_219695_mC); diff --git a/patches_old/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch new file mode 100644 index 000000000..87798c670 --- /dev/null +++ b/patches_old/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_.func_226277_ct_() - this.func_226277_ct_(); + double d1 = p_82196_1_.func_226283_e_(0.3333333333333333D) - abstractarrowentity.func_226278_cu_(); + double d2 = p_82196_1_.func_226281_cx_() - this.func_226281_cx_(); diff --git a/patches_old/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch new file mode 100644 index 000000000..556916353 --- /dev/null +++ b/patches_old/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 +@@ -214,7 +214,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_223586_b(GameRules.field_223599_b) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; ++ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; + float f = this.func_225509_J__() ? 2.0F : 1.0F; + this.field_70729_aU = true; + this.field_70170_p.func_217385_a(this, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), (float)this.field_82226_g * f, explosion$mode); diff --git a/patches_old/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch new file mode 100644 index 000000000..98eadfd82 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch @@ -0,0 +1,65 @@ +--- a/net/minecraft/entity/monster/EndermanEntity.java ++++ b/net/minecraft/entity/monster/EndermanEntity.java +@@ -93,7 +93,6 @@ + } + + public void func_70624_b(@Nullable LivingEntity p_70624_1_) { +- super.func_70624_b(p_70624_1_); + IAttributeInstance iattributeinstance = this.func_110148_a(SharedMonsterAttributes.field_111263_d); + if (p_70624_1_ == null) { + this.field_184721_by = 0; +@@ -108,6 +107,7 @@ + } + } + ++ super.func_70624_b(p_70624_1_); //Forge: Moved down to allow event handlers to write data manager values. + } + + protected void func_70088_a() { +@@ -234,7 +234,9 @@ + boolean flag = blockstate.func_185904_a().func_76230_c(); + boolean flag1 = blockstate.func_204520_s().func_206884_a(FluidTags.field_206959_a); + if (flag && !flag1) { +- boolean flag2 = 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 flag2 = this.func_213373_a(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true); + if (flag2) { + 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); +@@ -390,7 +392,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_223586_b(GameRules.field_223599_b)) { ++ } 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; +@@ -408,7 +410,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); + } +@@ -416,7 +418,7 @@ + } + + private boolean func_220836_a(IWorldReader p_220836_1_, BlockPos p_220836_2_, BlockState p_220836_3_, BlockState p_220836_4_, BlockState p_220836_5_, BlockPos p_220836_6_) { +- return p_220836_4_.func_196958_f() && !p_220836_5_.func_196958_f() && p_220836_5_.func_224756_o(p_220836_1_, p_220836_6_) && p_220836_3_.func_196955_c(p_220836_1_, p_220836_2_); ++ return p_220836_4_.isAir(p_220836_1_, p_220836_2_) && !p_220836_5_.isAir(p_220836_1_, p_220836_6_) && p_220836_5_.func_224756_o(p_220836_1_, p_220836_6_) && p_220836_3_.func_196955_c(p_220836_1_, p_220836_2_); + } + } + +@@ -458,7 +460,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_223586_b(GameRules.field_223599_b)) { ++ } 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_old/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch new file mode 100644 index 000000000..83f3bc0b7 --- /dev/null +++ b/patches_old/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 +@@ -282,7 +282,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_223586_b(GameRules.field_223599_b)) { ++ } 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_old/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch new file mode 100644 index 000000000..e1047feae --- /dev/null +++ b/patches_old/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_.func_226277_ct_() - this.func_226277_ct_(); + double d1 = p_82196_1_.func_226283_e_(0.3333333333333333D) - abstractarrowentity.func_226278_cu_(); + double d2 = p_82196_1_.func_226281_cx_() - this.func_226281_cx_(); diff --git a/patches_old/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch new file mode 100644 index 000000000..ccef1a56d --- /dev/null +++ b/patches_old/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 +@@ -72,6 +72,7 @@ + Vec3d vec3d = this.func_213322_ci(); + this.func_213293_j(vec3d.field_72450_a, (double)(this.func_175134_bD() + (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_old/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch new file mode 100644 index 000000000..e66ab3c80 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/monster/RavagerEntity.java ++++ b/net/minecraft/entity/monster/RavagerEntity.java +@@ -139,7 +139,7 @@ + this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(MathHelper.func_219803_d(0.1D, d1, d0)); + } + +- if (this.field_70123_F && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { ++ if (this.field_70123_F && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { + boolean flag = false; + AxisAlignedBB axisalignedbb = this.func_174813_aQ().func_186662_g(0.2D); + diff --git a/patches_old/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch new file mode 100644 index 000000000..d1e4daa17 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch @@ -0,0 +1,32 @@ +--- a/net/minecraft/entity/monster/ShulkerEntity.java ++++ b/net/minecraft/entity/monster/ShulkerEntity.java +@@ -183,7 +183,7 @@ + this.field_184708_bA = 0; + } else if (!this.field_70170_p.field_72995_K) { + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(this.field_70170_p, blockpos)) { + if (blockstate.func_177230_c() == Blocks.field_196603_bb) { + Direction direction = blockstate.func_177229_b(PistonBlock.field_176387_N); + if (this.field_70170_p.func_175623_d(blockpos.func_177972_a(direction))) { +@@ -249,6 +249,7 @@ + this.func_226286_f_((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p() + 0.5D); + double d0 = 0.5D - (double)MathHelper.func_76126_a((0.5F + this.field_184706_by) * (float)Math.PI) * 0.5D; + double d1 = 0.5D - (double)MathHelper.func_76126_a((0.5F + this.field_184705_bx) * (float)Math.PI) * 0.5D; ++ if (this.isAddedToWorld() && this.field_70170_p instanceof net.minecraft.world.server.ServerWorld) ((net.minecraft.world.server.ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. + Direction direction3 = this.func_184696_cZ().func_176734_d(); + this.func_174826_a((new AxisAlignedBB(this.func_226277_ct_() - 0.5D, this.func_226278_cu_(), this.func_226281_cx_() - 0.5D, this.func_226277_ct_() + 0.5D, this.func_226278_cu_() + 1.0D, this.func_226281_cx_() + 0.5D)).func_72321_a((double)direction3.func_82601_c() * d0, (double)direction3.func_96559_d() * d0, (double)direction3.func_82599_e() * d0)); + double d2 = d0 - d1; +@@ -307,6 +308,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_old/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch new file mode 100644 index 000000000..95b0e68a8 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/entity/monster/SilverfishEntity.java ++++ b/net/minecraft/entity/monster/SilverfishEntity.java +@@ -136,7 +136,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_223586_b(GameRules.field_223599_b) && 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 = Direction.func_176741_a(random); + BlockPos blockpos = (new BlockPos(this.field_75457_a.func_226277_ct_(), this.field_75457_a.func_226278_cu_() + 0.5D, this.field_75457_a.func_226281_cx_())).func_177972_a(this.field_179483_b); + BlockState blockstate = this.field_75457_a.field_70170_p.func_180495_p(blockpos); +@@ -205,7 +205,7 @@ + BlockState blockstate = world.func_180495_p(blockpos1); + Block block = blockstate.func_177230_c(); + if (block instanceof SilverfishBlock) { +- if (world.func_82736_K().func_223586_b(GameRules.field_223599_b)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, this.field_179464_a)) { + world.func_225521_a_(blockpos1, true, this.field_179464_a); + } else { + world.func_180501_a(blockpos1, ((SilverfishBlock)block).func_196468_d().func_176223_P(), 3); diff --git a/patches_old/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch new file mode 100644 index 000000000..61266e095 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch @@ -0,0 +1,54 @@ +--- a/net/minecraft/entity/monster/SlimeEntity.java ++++ b/net/minecraft/entity/monster/SlimeEntity.java +@@ -129,6 +129,7 @@ + if (this.field_70122_E && !this.field_175452_bi) { + int i = this.func_70809_q(); + ++ if (spawnCustomParticles()) i = 0; // don't spawn particles if it's handled by the implementation itself + 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; +@@ -180,9 +181,10 @@ + return (EntityType) super.func_200600_R(); + } + +- public void func_70106_y() { ++ @Override ++ public void remove(boolean keepData) { + int i = this.func_70809_q(); +- if (!this.field_70170_p.field_72995_K && i > 1 && this.func_110143_aJ() <= 0.0F) { ++ if (!this.field_70170_p.field_72995_K && i > 1 && this.func_110143_aJ() <= 0.0F && !this.field_70128_L) { + int j = 2 + this.field_70146_Z.nextInt(3); + + for(int k = 0; k < j; ++k) { +@@ -204,7 +206,7 @@ + } + } + +- super.func_70106_y(); ++ super.remove(keepData); + } + + public void func_70108_f(Entity p_70108_1_) { +@@ -262,7 +264,7 @@ + } + + public static boolean func_223366_c(EntityType p_223366_0_, IWorld p_223366_1_, SpawnReason p_223366_2_, BlockPos p_223366_3_, Random p_223366_4_) { +- if (p_223366_1_.func_72912_H().func_76067_t() == WorldType.field_77138_c && p_223366_4_.nextInt(4) != 1) { ++ if (p_223366_1_.func_72912_H().func_76067_t().handleSlimeSpawnReduction(p_223366_4_, p_223366_1_) && p_223366_4_.nextInt(4) != 1) { + return false; + } else { + if (p_223366_1_.func_175659_aa() != Difficulty.PEACEFUL) { +@@ -320,6 +322,12 @@ + return super.func_213305_a(p_213305_1_).func_220313_a(0.255F * (float)this.func_70809_q()); + } + ++ /** ++ * Called when the slime spawns particles on landing, see onUpdate. ++ * Return true to prevent the spawning of the default particles. ++ */ ++ protected boolean spawnCustomParticles() { return false; } ++ + static class AttackGoal extends Goal { + private final SlimeEntity field_179466_a; + private int field_179465_b; diff --git a/patches_old/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch new file mode 100644 index 000000000..1215b5b94 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch new file mode 100644 index 000000000..d15a0c55e --- /dev/null +++ b/patches_old/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 +@@ -110,7 +110,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() { +@@ -315,12 +315,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_223586_b(GameRules.field_223601_d)) { + int i = MathHelper.func_76128_c(this.func_226277_ct_()); + int j = MathHelper.func_76128_c(this.func_226278_cu_()); + int k = MathHelper.func_76128_c(this.func_226281_cx_()); +- ZombieEntity zombieentity = new ZombieEntity(this.field_70170_p); + ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, livingentity, this.func_110148_a(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_223586_b(GameRules.field_223601_d)) { ++ ZombieEntity zombieentity = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.field_200725_aD.func_200721_a(this.field_70170_p); ++ + for(int l = 0; l < 50; ++l) { + int i1 = i + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); + int j1 = j + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); +@@ -330,6 +334,7 @@ + zombieentity.func_70107_b((double)i1, (double)j1, (double)k1); + if (!this.field_70170_p.func_217358_a((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_226668_i_(zombieentity) && this.field_70170_p.func_226669_j_(zombieentity) && !this.field_70170_p.func_72953_d(zombieentity.func_174813_aQ())) { + this.field_70170_p.func_217376_c(zombieentity); ++ 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)); +@@ -468,7 +473,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_old/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch new file mode 100644 index 000000000..618d0032d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/passive/BeeEntity.java ++++ b/net/minecraft/entity/passive/BeeEntity.java +@@ -438,7 +438,7 @@ + return false; + } else { + TileEntity tileentity = this.field_70170_p.func_175625_s(this.field_226369_bI_); +- return tileentity != null && tileentity.func_200662_C() == TileEntityType.field_226985_G_; ++ return tileentity instanceof BeehiveTileEntity; + } + } + diff --git a/patches_old/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch new file mode 100644 index 000000000..8062f6f32 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/passive/FoxEntity.java ++++ b/net/minecraft/entity/passive/FoxEntity.java +@@ -747,7 +747,7 @@ + } + + protected void func_220730_m() { +- if (FoxEntity.this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(FoxEntity.this.field_70170_p, FoxEntity.this)) { + BlockState blockstate = FoxEntity.this.field_70170_p.func_180495_p(this.field_179494_b); + if (blockstate.func_177230_c() == Blocks.field_222434_lW) { + int i = blockstate.func_177229_b(SweetBerryBushBlock.field_220125_a); diff --git a/patches_old/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch new file mode 100644 index 000000000..07c8c58e3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/entity/passive/IronGolemEntity.java ++++ b/net/minecraft/entity/passive/IronGolemEntity.java +@@ -113,9 +113,10 @@ + int i = MathHelper.func_76128_c(this.func_226277_ct_()); + int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F); + int k = MathHelper.func_76128_c(this.func_226281_cx_()); +- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); +- if (!blockstate.func_196958_f()) { +- this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate), this.func_226277_ct_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.func_213311_cf(), this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.func_213311_cf(), 4.0D * ((double)this.field_70146_Z.nextFloat() - 0.5D), 0.5D, ((double)this.field_70146_Z.nextFloat() - 0.5D) * 4.0D); ++ BlockPos pos = new BlockPos(i, j, k); ++ BlockState blockstate = this.field_70170_p.func_180495_p(pos); ++ if (!blockstate.isAir(this.field_70170_p, pos)) { ++ this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate).setPos(pos), this.func_226277_ct_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.func_213311_cf(), this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.func_213311_cf(), 4.0D * ((double)this.field_70146_Z.nextFloat() - 0.5D), 0.5D, ((double)this.field_70146_Z.nextFloat() - 0.5D) * 4.0D); + } + } + diff --git a/patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch rename to patches_old/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch new file mode 100644 index 000000000..12bfcd170 --- /dev/null +++ b/patches_old/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 +@@ -161,7 +161,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_old/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch new file mode 100644 index 000000000..3500854f2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/passive/ParrotEntity.java ++++ b/net/minecraft/entity/passive/ParrotEntity.java +@@ -232,7 +232,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.field_70170_p.func_72960_a(this, (byte)7); + } else { diff --git a/patches_old/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch new file mode 100644 index 000000000..cf77ca9eb --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/passive/RabbitEntity.java ++++ b/net/minecraft/entity/passive/RabbitEntity.java +@@ -492,7 +492,7 @@ + + public boolean func_75250_a() { + if (this.field_179496_a <= 0) { +- if (!this.field_179500_c.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179500_c.field_70170_p, this.field_179500_c)) { + return false; + } + diff --git a/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch rename to patches_old/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch new file mode 100644 index 000000000..3c6557dd6 --- /dev/null +++ b/patches_old/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 +@@ -33,7 +33,7 @@ + import net.minecraft.world.GameRules; + import net.minecraft.world.World; + +-public class SnowGolemEntity extends GolemEntity implements IRangedAttackMob { ++public class SnowGolemEntity extends GolemEntity implements IRangedAttackMob, net.minecraftforge.common.IShearable { + private static final DataParameter field_184749_a = EntityDataManager.func_187226_a(SnowGolemEntity.class, DataSerializers.field_187191_a); + + public SnowGolemEntity(EntityType p_i50244_1_, World p_i50244_2_) { +@@ -88,7 +88,7 @@ + this.func_70097_a(DamageSource.field_76370_b, 1.0F); + } + +- if (!this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { + return; + } + +@@ -99,7 +99,7 @@ + j = MathHelper.func_76128_c(this.func_226278_cu_()); + k = MathHelper.func_76128_c(this.func_226281_cx_() + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F)); + BlockPos blockpos = new BlockPos(i, j, k); +- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f() && this.field_70170_p.func_226691_t_(blockpos).func_225486_c(blockpos) < 0.8F && blockstate.func_196955_c(this.field_70170_p, blockpos)) { ++ if (this.field_70170_p.func_175623_d(blockpos) && this.field_70170_p.func_226691_t_(blockpos).func_225486_c(blockpos) < 0.8F && blockstate.func_196955_c(this.field_70170_p, blockpos)) { + this.field_70170_p.func_175656_a(blockpos, blockstate); + } + } +@@ -125,7 +125,7 @@ + + protected boolean func_184645_a(PlayerEntity p_184645_1_, Hand p_184645_2_) { + ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_); +- if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o()) { ++ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o()) { //Forge: Moved to onSheared + if (!this.field_70170_p.field_72995_K) { + this.func_184747_a(false); + itemstack.func_222118_a(1, p_184645_1_, (p_213622_1_) -> { +@@ -167,4 +167,15 @@ + protected SoundEvent func_184615_bR() { + return SoundEvents.field_187801_fC; + } ++ ++ @Override ++ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) { ++ return this.func_184748_o(); ++ } ++ ++ @Override ++ public java.util.List 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_old/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch new file mode 100644 index 000000000..fea6b0cc8 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/passive/WolfEntity.java ++++ b/net/minecraft/entity/passive/WolfEntity.java +@@ -353,7 +353,7 @@ + itemstack.func_190918_g(1); + } + +- 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.field_70699_by.func_75499_g(); + this.func_70624_b((LivingEntity)null); diff --git a/patches_old/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch new file mode 100644 index 000000000..e221e7abd --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch @@ -0,0 +1,45 @@ +--- a/net/minecraft/entity/passive/horse/AbstractHorseEntity.java ++++ b/net/minecraft/entity/passive/horse/AbstractHorseEntity.java +@@ -263,6 +263,7 @@ + + this.field_110296_bG.func_110134_a(this); + this.func_110232_cE(); ++ this.itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this.field_110296_bG)); + } + + protected void func_110232_cE() { +@@ -324,9 +325,9 @@ + protected void func_180429_a(BlockPos p_180429_1_, BlockState p_180429_2_) { + if (!p_180429_2_.func_185904_a().func_76224_d()) { + BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()); +- SoundType soundtype = p_180429_2_.func_215695_r(); ++ SoundType soundtype = p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this); + if (blockstate.func_177230_c() == Blocks.field_150433_aE) { +- soundtype = blockstate.func_215695_r(); ++ soundtype = blockstate.getSoundType(field_70170_p, p_180429_1_, this); + } + + if (this.func_184207_aI() && this.field_190688_bE) { +@@ -947,4 +948,22 @@ + + return super.func_213386_a(p_213386_1_, p_213386_2_, p_213386_3_, p_213386_4_, p_213386_5_); + } ++ ++ 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.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); ++ } ++ ++ @Override ++ public void remove(boolean keepData) { ++ super.remove(keepData); ++ if (!keepData && itemHandler != null) { ++ itemHandler.invalidate(); ++ itemHandler = null; ++ } ++ } + } diff --git a/patches_old/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch new file mode 100644 index 000000000..889f37dd0 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/passive/horse/HorseEntity.java ++++ b/net/minecraft/entity/passive/horse/HorseEntity.java +@@ -175,6 +175,8 @@ + 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_old/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch new file mode 100644 index 000000000..7997fdbbf --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch @@ -0,0 +1,506 @@ +--- a/net/minecraft/entity/player/PlayerEntity.java ++++ b/net/minecraft/entity/player/PlayerEntity.java +@@ -109,6 +109,10 @@ + import net.minecraftforge.api.distmarker.OnlyIn; + + 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); + 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.CROUCHING, EntitySize.func_220314_b(0.6F, 1.5F)).put(Pose.DYING, EntitySize.func_220311_c(0.2F, 0.2F)).build(); + private static final DataParameter field_184829_a = EntityDataManager.func_187226_a(PlayerEntity.class, DataSerializers.field_187193_c); +@@ -151,6 +155,9 @@ + private final CooldownTracker field_184832_bU = this.func_184815_l(); + @Nullable + public FishingBobberEntity field_71104_cf; ++ private net.minecraft.world.dimension.DimensionType spawnDimension = net.minecraft.world.dimension.DimensionType.field_223227_a_; ++ private final java.util.Collection prefixes = new java.util.LinkedList(); ++ private final java.util.Collection suffixes = new java.util.LinkedList(); + + public PlayerEntity(World p_i45324_1_, GameProfile p_i45324_2_) { + super(EntityType.field_200729_aH, p_i45324_1_); +@@ -182,6 +189,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); ++ this.func_110140_aT().func_111150_b(REACH_DISTANCE); + } + + protected void func_70088_a() { +@@ -195,6 +203,7 @@ + } + + public void func_70071_h_() { ++ net.minecraftforge.fml.hooks.BasicEventHooks.onPlayerPreTick(this); + this.field_70145_X = this.func_175149_v(); + if (this.func_175149_v()) { + this.field_70122_E = false; +@@ -210,7 +219,7 @@ + this.field_71076_b = 100; + } + +- 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_225652_a_(false, true); + } + } else if (this.field_71076_b > 0) { +@@ -268,6 +277,7 @@ + this.func_203041_m(); + this.field_184832_bU.func_185144_a(); + this.func_213832_dB(); ++ net.minecraftforge.fml.hooks.BasicEventHooks.onPlayerPostTick(this); + } + + public boolean func_226563_dT_() { +@@ -454,10 +464,10 @@ + this.field_71107_bF = this.field_71109_bG; + this.field_71109_bG = 0.0F; + this.func_71015_k(this.func_226277_ct_() - d0, this.func_226278_cu_() - d1, this.func_226281_cx_() - d2); +- 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 = ((PigEntity)this.func_184187_bx()).field_70761_aq; ++ this.field_70761_aq = ((LivingEntity)this.func_184187_bx()).field_70761_aq; + } + + } +@@ -570,6 +580,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_226264_Z_(); + if (!this.func_175149_v()) { +@@ -623,12 +634,14 @@ + } + + public boolean func_225609_n_(boolean p_225609_1_) { +- return this.func_146097_a(this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_225609_1_ && !this.field_71071_by.func_70448_g().func_190926_b() ? this.field_71071_by.func_70448_g().func_190916_E() : 1), false, true) != null; ++ ItemStack stack = field_71071_by.func_70448_g(); ++ if (stack.func_190926_b() || !stack.onDroppedByPlayer(this)) return false; ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_225609_1_ && !this.field_71071_by.func_70448_g().func_190926_b() ? this.field_71071_by.func_70448_g().func_190916_E() : 1), true) != null; + } + + @Nullable + 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 +@@ -662,7 +675,12 @@ + } + } + ++ @Deprecated //Use location sensitive version below + public float func_184813_a(BlockState p_184813_1_) { ++ return getDigSpeed(p_184813_1_, null); ++ } ++ ++ 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); +@@ -704,11 +722,12 @@ + f /= 5.0F; + } + ++ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, p_184813_1_, f, pos); + return f; + } + + 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(CompoundNBT p_70037_1_) { +@@ -732,6 +751,17 @@ + this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); + } + ++ p_70037_1_.func_150295_c("Spawns", 10).forEach(e -> { ++ CompoundNBT data = (CompoundNBT)e; ++ ResourceLocation dim = new ResourceLocation(data.func_74779_i("Dim")); ++ this.spawnPosMap.put(dim, new BlockPos(data.func_74762_e("SpawnX"), data.func_74762_e("SpawnY"), data.func_74762_e("SpawnZ"))); ++ this.spawnForcedMap.put(dim, data.func_74767_n("SpawnForced")); ++ }); ++ net.minecraft.world.dimension.DimensionType spawnDim = null; ++ if (p_70037_1_.func_150297_b("SpawnDimension", net.minecraftforge.common.util.Constants.NBT.TAG_STRING)) ++ spawnDim = net.minecraft.world.dimension.DimensionType.func_193417_a(new ResourceLocation(p_70037_1_.func_74779_i("SpawnDimension"))); ++ this.spawnDimension = spawnDim != null ? spawnDim : net.minecraft.world.dimension.DimensionType.field_223227_a_; ++ + 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)) { +@@ -777,6 +807,23 @@ + p_213281_1_.func_218657_a("ShoulderEntityRight", this.func_192025_dl()); + } + ++ ListNBT spawnlist = new ListNBT(); ++ spawnPosMap.forEach((dim, pos) -> { ++ if (pos != null) { ++ CompoundNBT data = new CompoundNBT(); ++ data.func_74778_a("Dim", dim.toString()); ++ data.func_74768_a("SpawnX", pos.func_177958_n()); ++ data.func_74768_a("SpawnY", pos.func_177956_o()); ++ data.func_74768_a("SpawnZ", pos.func_177952_p()); ++ data.func_74757_a("SpawnForced", spawnForcedMap.getOrDefault(dim, false)); ++ spawnlist.add(data); ++ } ++ }); ++ p_213281_1_.func_218657_a("Spawns", spawnlist); ++ if (spawnDimension != net.minecraft.world.dimension.DimensionType.field_223227_a_) { ++ p_213281_1_.func_74778_a("SpawnDimension", spawnDimension.getRegistryName().toString()); ++ } ++ + } + + public boolean func_180431_b(DamageSource p_180431_1_) { +@@ -794,6 +841,7 @@ + } + + public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { ++ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_70097_1_, p_70097_2_)) return false; + 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()) { +@@ -825,7 +873,7 @@ + + 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 AxeItem) { ++ if (p_190629_1_.func_184614_ca().canDisableShield(this.field_184627_bm, this, p_190629_1_)) { + this.func_190777_m(true); + } + +@@ -846,11 +894,12 @@ + } + + protected void func_184590_k(float p_184590_1_) { +- if (p_184590_1_ >= 3.0F && this.field_184627_bm.func_77973_b() == Items.field_185159_cQ) { ++ if (p_184590_1_ >= 3.0F && this.field_184627_bm.isShield(this)) { + int i = 1 + MathHelper.func_76141_d(p_184590_1_); + Hand hand = this.func_184600_cs(); + this.field_184627_bm.func_222118_a(i, this, (p_213833_1_) -> { + p_213833_1_.func_213334_d(hand); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.field_184627_bm, hand); + }); + if (this.field_184627_bm.func_190926_b()) { + if (hand == Hand.MAIN_HAND) { +@@ -868,10 +917,13 @@ + + protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { + if (!this.func_180431_b(p_70665_1_)) { ++ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); ++ if (p_70665_2_ <= 0) return; + p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); + p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); + float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); + this.func_110149_m(this.func_110139_bj() - (p_70665_2_ - f2)); ++ f2 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, f2); + float f = p_70665_2_ - f2; + if (f > 0.0F && f < 3.4028235E37F) { + this.func_195067_a(Stats.field_212738_J, Math.round(f * 10.0F)); +@@ -926,6 +978,8 @@ + + return ActionResultType.PASS; + } else { ++ 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_77946_l(); + if (p_190775_1_.func_184230_a(this, p_190775_2_)) { +@@ -933,6 +987,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 ActionResultType.SUCCESS; + } else { + if (!itemstack.func_190926_b() && p_190775_1_ instanceof LivingEntity) { +@@ -942,6 +999,7 @@ + + 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); + } + +@@ -1018,6 +1076,7 @@ + } + + public void func_71059_n(Entity p_71059_1_) { ++ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, p_71059_1_)) return; + 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(); +@@ -1045,8 +1104,10 @@ + + boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(Effects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof LivingEntity; + flag2 = flag2 && !this.func_70051_ag(); ++ 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) { +- f *= 1.5F; ++ f *= hitResult.getDamageModifier(); + } + + f = f + f1; +@@ -1134,8 +1195,10 @@ + } + + 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((LivingEntity)entity, this); + if (itemstack1.func_190926_b()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, copy, Hand.MAIN_HAND); + this.func_184611_a(Hand.MAIN_HAND, ItemStack.field_190927_a); + } + } +@@ -1177,7 +1240,7 @@ + } + + if (this.field_70146_Z.nextFloat() < f) { +- this.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100); ++ this.func_184811_cZ().func_185145_a(this.func_184607_cu().func_77973_b(), 100); + this.func_184602_cy(); + this.field_70170_p.func_72960_a(this, (byte)30); + } +@@ -1203,8 +1266,9 @@ + public void func_71004_bE() { + } + +- public void func_70106_y() { +- super.func_70106_y(); ++ @Override ++ public void remove(boolean keepData) { ++ super.remove(keepData); + this.field_71069_bz.func_75134_a(this); + if (this.field_71070_bA != null) { + this.field_71070_bA.func_75134_a(this); +@@ -1221,6 +1285,9 @@ + } + + public Either func_213819_a(BlockPos p_213819_1_) { ++ Optional optAt = Optional.of(p_213819_1_); ++ PlayerEntity.SleepResult ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, optAt); ++ 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()) { +@@ -1231,7 +1298,7 @@ + return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_HERE); + } + +- if (this.field_70170_p.func_72935_r()) { ++ if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, optAt)) { + this.func_226560_a_(p_213819_1_, false, true); + return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_NOW); + } +@@ -1273,6 +1340,7 @@ + } + + private boolean func_190774_a(BlockPos p_190774_1_, Direction p_190774_2_) { ++ if (p_190774_2_ == null) return false; + return this.func_230126_g_(p_190774_1_) || this.func_230126_g_(p_190774_1_.func_177972_a(p_190774_2_.func_176734_d())); + } + +@@ -1287,6 +1355,7 @@ + } + + public void func_225652_a_(boolean p_225652_1_, boolean p_225652_2_) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_225652_1_, p_225652_2_); + super.func_213366_dy(); + if (this.field_70170_p instanceof ServerWorld && p_225652_2_) { + ((ServerWorld)this.field_70170_p).func_72854_c(); +@@ -1300,17 +1369,17 @@ + } + + 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 = 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 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); + } + } + +@@ -1325,15 +1394,62 @@ + public void func_146105_b(ITextComponent p_146105_1_, boolean p_146105_2_) { + } + ++ @Deprecated //Forge: Use Dimension sensitive version + public BlockPos func_180470_cg() { +- return this.field_71077_c; ++ return getBedLocation(this.field_71093_bK); + } + ++ /** ++ * A dimension aware version of getBedLocation. ++ * @param dim The dimension to get the bed spawn for ++ * @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.field_223227_a_ ? field_71077_c : spawnPosMap.get(dim.getRegistryName()); ++ } ++ ++ @Deprecated //Forge: Use Dimension sensitive version + public boolean func_82245_bX() { +- return this.field_82248_d; ++ return isSpawnForced(this.field_71093_bK); + } + ++ /** ++ * A dimension aware version of isSpawnForced. ++ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. ++ * This just extends that to be dimension aware. ++ * @param dim The dimension to get whether to check for a bed before spawning for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public boolean isSpawnForced(net.minecraft.world.dimension.DimensionType dim) { ++ return dim == net.minecraft.world.dimension.DimensionType.field_223227_a_ ? field_82248_d : spawnForcedMap.getOrDefault(dim.getRegistryName(), false); ++ } ++ ++ @Deprecated //Forge: Use Dimension sensitive version + public void func_226560_a_(BlockPos p_226560_1_, boolean p_226560_2_, boolean p_226560_3_) { ++ setSpawnPoint(p_226560_1_, p_226560_2_, p_226560_3_, this.field_71093_bK); ++ } ++ ++ /** ++ * A dimension aware version of setSpawnChunk. ++ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. ++ * @param pos The spawn point to set as the player-specific spawn point for the dimension ++ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) ++ * @param dim Which dimension to apply the player-specific respawn point to ++ */ ++ public void setSpawnPoint(@Nullable BlockPos p_226560_1_, boolean p_226560_2_, boolean p_226560_3_, net.minecraft.world.dimension.DimensionType dim) { ++ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, p_226560_1_, p_226560_2_)) return; ++ if (dim != net.minecraft.world.dimension.DimensionType.field_223227_a_) { ++ if (p_226560_1_ != null) { ++ BlockPos old = spawnPosMap.put(dim.getRegistryName(), p_226560_1_); ++ spawnForcedMap.put(dim.getRegistryName(), p_226560_2_); ++ if (p_226560_3_ && !p_226560_1_.equals(old)) ++ this.func_145747_a(new TranslationTextComponent("block.minecraft.bed.set_spawn")); ++ } else { ++ spawnPosMap.remove(dim.getRegistryName()); ++ spawnForcedMap.remove(dim.getRegistryName()); ++ } ++ return; ++ } + if (p_226560_1_ != null) { + if (p_226560_3_ && !p_226560_1_.equals(this.field_71077_c)) { + this.func_145747_a(new TranslationTextComponent("block.minecraft.bed.set_spawn")); +@@ -1506,6 +1622,7 @@ + + public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) { + if (this.field_71075_bZ.field_75101_c) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, p_225503_1_, p_225503_2_); + return false; + } else { + if (p_225503_1_ >= 2.0F) { +@@ -1560,6 +1677,10 @@ + } + + public void func_195068_e(int p_195068_1_) { ++ net.minecraftforge.event.entity.player.PlayerXpEvent.XpChange event = new net.minecraftforge.event.entity.player.PlayerXpEvent.XpChange(this, p_195068_1_); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ p_195068_1_ = event.getAmount(); ++ + this.func_85039_t(p_195068_1_); + this.field_71106_cc += (float)p_195068_1_ / (float)this.func_71050_bK(); + this.field_71067_cb = MathHelper.func_76125_a(this.field_71067_cb + p_195068_1_, 0, Integer.MAX_VALUE); +@@ -1588,7 +1709,7 @@ + } + + public void func_192024_a(ItemStack p_192024_1_, int p_192024_2_) { +- this.field_71068_ca -= p_192024_2_; ++ func_82242_a(-p_192024_2_); + if (this.field_71068_ca < 0) { + this.field_71068_ca = 0; + this.field_71106_cc = 0.0F; +@@ -1599,6 +1720,10 @@ + } + + public void func_82242_a(int p_82242_1_) { ++ net.minecraftforge.event.entity.player.PlayerXpEvent.LevelChange event = new net.minecraftforge.event.entity.player.PlayerXpEvent.LevelChange(this, p_82242_1_); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ p_82242_1_ = event.getLevels(); ++ + this.field_71068_ca += p_82242_1_; + if (this.field_71068_ca < 0) { + this.field_71068_ca = 0; +@@ -1789,7 +1914,10 @@ + } + + public ITextComponent func_145748_c_() { +- ITextComponent itextcomponent = ScorePlayerTeam.func_200541_a(this.func_96124_cp(), this.func_200200_C_()); ++ 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); + } + +@@ -2029,4 +2157,45 @@ + return this.field_221260_g; + } + } ++ ++ // =========== FORGE START ==============// ++ public net.minecraft.world.dimension.DimensionType getSpawnDimension() { ++ return this.spawnDimension; ++ } ++ ++ public void setSpawnDimenion(net.minecraft.world.dimension.DimensionType dim) { ++ this.spawnDimension = dim; ++ } ++ ++ public Collection getPrefixes() { ++ return this.prefixes; ++ } ++ ++ 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 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(); ++ else if (facing.func_176740_k().func_176722_c()) return playerEquipmentHandler.cast(); ++ } ++ return super.getCapability(capability, facing); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch b/patches_old/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch new file mode 100644 index 000000000..d27a05c5e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch @@ -0,0 +1,30 @@ +--- 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_); + if (itemstack.func_190926_b()) { +- itemstack = new ItemStack(item, 0); ++ itemstack = p_191973_2_.func_77946_l(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. ++ itemstack.func_190920_e(0); + if (p_191973_2_.func_77942_o()) { + itemstack.func_77982_d(p_191973_2_.func_77978_p().func_74737_b()); + } +@@ -265,7 +266,7 @@ + } + } + } +- ++ field_70460_b.forEach(e -> e.onArmorTick(field_70458_d.field_70170_p, field_70458_d)); + } + + public boolean func_70441_a(ItemStack p_70441_1_) { +@@ -318,6 +319,8 @@ + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Adding item to inventory"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Item being added"); ++ crashreportcategory.func_189529_a("Registry Name", () -> String.valueOf(p_191971_2_.func_77973_b().getRegistryName())); ++ crashreportcategory.func_189529_a("Item Class", () -> p_191971_2_.func_77973_b().getClass().getName()); + crashreportcategory.func_71507_a("Item ID", Item.func_150891_b(p_191971_2_.func_77973_b())); + crashreportcategory.func_71507_a("Item data", p_191971_2_.func_77952_i()); + crashreportcategory.func_189529_a("Item name", () -> { 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..899fbcfc2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch @@ -0,0 +1,173 @@ +--- a/net/minecraft/entity/player/ServerPlayerEntity.java ++++ b/net/minecraft/entity/player/ServerPlayerEntity.java +@@ -432,6 +432,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_223586_b(GameRules.field_223609_l); + if (flag) { + ITextComponent itextcomponent = this.func_110142_aN().func_151521_b(); +@@ -550,13 +551,15 @@ + 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; + DimensionType dimensiontype = this.field_71093_bK; +- if (dimensiontype == DimensionType.field_223229_c_ && p_212321_1_ == DimensionType.field_223227_a_) { ++ if (dimensiontype == DimensionType.field_223229_c_ && p_212321_1_ == DimensionType.field_223227_a_ && teleporter instanceof net.minecraft.world.Teleporter) { //Forge: Fix non-vanilla teleporters triggering end credits + this.func_213319_R(); +- this.func_71121_q().func_217434_e(this); ++ this.func_71121_q().removePlayer(this, true); //Forge: The player entity is cloned so keep the data until after cloning calls copyFrom + if (!this.field_71136_j) { + this.field_71136_j = true; + this.field_71135_a.func_147359_a(new SChangeGameStatePacket(4, this.field_192040_cp ? 0.0F : 1.0F)); +@@ -569,12 +572,14 @@ + this.field_71093_bK = p_212321_1_; + ServerWorld serverworld1 = this.field_71133_b.func_71218_a(p_212321_1_); + WorldInfo worldinfo = serverworld1.func_72912_H(); ++ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(this.field_71135_a.field_147371_a, this); + this.field_71135_a.func_147359_a(new SRespawnPacket(p_212321_1_, WorldInfo.func_227498_c_(worldinfo.func_76063_b()), 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())); + 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(); ++ Entity e = teleporter.placeEntity(this, serverworld, serverworld1, this.field_70177_z, spawnPortal -> {//Forge: Start vanilla logic + double d0 = this.func_226277_ct_(); + double d1 = this.func_226278_cu_(); + double d2 = this.func_226281_cx_(); +@@ -583,13 +588,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.field_223227_a_ && p_212321_1_ == DimensionType.field_223228_b_) { + this.field_193110_cw = this.func_213303_ch(); +- d0 /= 8.0D; +- d2 /= 8.0D; +- } else if (dimensiontype == DimensionType.field_223228_b_ && p_212321_1_ == DimensionType.field_223227_a_) { +- d0 *= 8.0D; +- d2 *= 8.0D; + } else if (dimensiontype == DimensionType.field_223227_a_ && p_212321_1_ == DimensionType.field_223229_c_) { + BlockPos blockpos = serverworld1.func_180504_m(); + d0 = (double)blockpos.func_177958_n(); +@@ -630,7 +633,7 @@ + + this.func_70012_b((double)i, (double)j, (double)k, f1, 0.0F); + this.func_213317_d(Vec3d.field_186680_a); +- } else if (!serverworld1.func_85176_s().func_222268_a(this, f2)) { ++ } else if (spawnPortal && !serverworld1.func_85176_s().func_222268_a(this, f2)) { + serverworld1.func_85176_s().func_85188_a(this); + serverworld1.func_85176_s().func_222268_a(this, f2); + } +@@ -640,6 +643,9 @@ + serverworld1.func_217447_b(this); + this.func_213846_b(serverworld); + this.field_71135_a.func_147364_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), f1, f); ++ return this;//forge: this is part of the ITeleporter patch ++ });//Forge: End vanilla logic ++ if (e != this) throw new java.lang.IllegalArgumentException(String.format("Teleporter %s returned not the player entity but instead %s, expected PlayerEntity %s", teleporter, e, this)); + this.field_71134_c.func_73080_a(serverworld1); + this.field_71135_a.func_147359_a(new SPlayerAbilitiesPacket(this.field_71075_bZ)); + playerlist.func_72354_b(this, serverworld1); +@@ -653,6 +659,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; + } + } +@@ -788,6 +795,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); + } + } +@@ -806,6 +814,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_) { +@@ -863,6 +872,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; + } + +@@ -989,6 +999,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 != DimensionType.field_223227_a_) { ++ 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_.getPersistentData(); ++ if (old.func_74764_b(PERSISTED_NBT_TAG)) ++ getPersistentData().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_) { +@@ -1207,15 +1231,17 @@ + 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())) { ++ DimensionType oldDimension = this.field_71093_bK; + 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(); ++ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(this.field_71135_a.field_147371_a, this); + this.field_71135_a.func_147359_a(new SRespawnPacket(this.field_71093_bK, WorldInfo.func_227498_c_(worldinfo.func_76063_b()), 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); +@@ -1224,6 +1250,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, oldDimension, this.field_71093_bK); + } + + } +@@ -1261,6 +1288,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_old/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch new file mode 100644 index 000000000..4d7125243 --- /dev/null +++ b/patches_old/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 +@@ -160,7 +160,7 @@ + + BlockPos blockpos = new BlockPos(this); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); +- if (!blockstate.func_196958_f() && !flag) { ++ if (!blockstate.isAir(this.field_70170_p, blockpos) && !flag) { + VoxelShape voxelshape = blockstate.func_196952_d(this.field_70170_p, blockpos); + if (!voxelshape.func_197766_b()) { + Vec3d vec3d1 = this.func_213303_ch(); +@@ -218,7 +218,7 @@ + } + } + +- if (raytraceresult != null && !flag) { ++ if (raytraceresult != null && raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.func_184549_a(raytraceresult); + this.field_70160_al = true; + } diff --git a/patches_old/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch new file mode 100644 index 000000000..72ac1fc65 --- /dev/null +++ b/patches_old/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 +@@ -81,7 +81,7 @@ + + ++this.field_70234_an; + RayTraceResult raytraceresult = ProjectileHelper.func_221266_a(this, true, this.field_70234_an >= 25, this.field_70235_a, RayTraceContext.BlockMode.COLLIDER); +- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) { ++ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.func_70227_a(raytraceresult); + } + diff --git a/patches_old/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch new file mode 100644 index 000000000..ee544eeb7 --- /dev/null +++ b/patches_old/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 +@@ -38,7 +38,7 @@ + this.func_174815_a(this.field_70235_a, entity); + } + +- boolean flag = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b); ++ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a); + this.field_70170_p.func_217398_a((Entity)null, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), (float)this.field_92057_e, flag, flag ? Explosion.Mode.DESTROY : Explosion.Mode.NONE); + this.func_70106_y(); + } diff --git a/patches_old/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch new file mode 100644 index 000000000..bbc76d9e8 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch @@ -0,0 +1,76 @@ +--- a/net/minecraft/entity/projectile/FishingBobberEntity.java ++++ b/net/minecraft/entity/projectile/FishingBobberEntity.java +@@ -207,8 +207,8 @@ + private boolean func_190625_o() { + ItemStack itemstack = this.field_146042_b.func_184614_ca(); + ItemStack itemstack1 = this.field_146042_b.func_184592_cb(); +- boolean flag = itemstack.func_77973_b() == Items.field_151112_aM; +- boolean flag1 = itemstack1.func_77973_b() == Items.field_151112_aM; ++ boolean flag = itemstack.func_77973_b() instanceof net.minecraft.item.FishingRodItem; ++ boolean flag1 = itemstack1.func_77973_b() instanceof net.minecraft.item.FishingRodItem; + if (!this.field_146042_b.field_70128_L && this.field_146042_b.func_70089_S() && (flag || flag1) && !(this.func_70068_e(this.field_146042_b) > 1024.0D)) { + return false; + } else { +@@ -292,7 +292,7 @@ + double d1 = (double)((float)MathHelper.func_76128_c(this.func_226278_cu_()) + 1.0F); + double d2 = this.func_226281_cx_() + (double)(f2 * (float)this.field_146038_az * 0.1F); + Block block = serverworld.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2)).func_177230_c(); +- if (block == Blocks.field_150355_j) { ++ if (serverworld.func_180495_p(new BlockPos((int)d0, (int)d1 - 1, (int)d2)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) { + if (this.field_70146_Z.nextFloat() < 0.15F) { + serverworld.func_195598_a(ParticleTypes.field_197612_e, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D); + } +@@ -329,7 +329,7 @@ + double d5 = (double)((float)MathHelper.func_76128_c(this.func_226278_cu_()) + 1.0F); + double d6 = this.func_226281_cx_() + (double)(MathHelper.func_76134_b(f6) * f7 * 0.1F); + Block block1 = serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)).func_177230_c(); +- if (block1 == Blocks.field_150355_j) { ++ if (serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) { + serverworld.func_195598_a(ParticleTypes.field_218422_X, d4, d5, d6, 2 + this.field_70146_Z.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D); + } + } +@@ -354,6 +354,7 @@ + public int func_146034_e(ItemStack p_146034_1_) { + if (!this.field_70170_p.field_72995_K && this.field_146042_b != null) { + int i = 0; ++ net.minecraftforge.event.entity.player.ItemFishedEvent event = null; + if (this.field_146043_c != null) { + this.func_184527_k(); + CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)this.field_146042_b, p_146034_1_, this, Collections.emptyList()); +@@ -361,8 +362,15 @@ + i = this.field_146043_c instanceof ItemEntity ? 3 : 5; + } else if (this.field_146045_ax > 0) { + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)).func_216015_a(LootParameters.field_216289_i, p_146034_1_).func_216023_a(this.field_70146_Z).func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da()); ++ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this.field_146042_b).func_216015_a(LootParameters.field_216281_a, this); + LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(LootTables.field_186387_al); + List list = loottable.func_216113_a(lootcontext$builder.func_216022_a(LootParameterSets.field_216262_c)); ++ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.field_146051_au ? 2 : 1, this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.isCanceled()) { ++ this.func_70106_y(); ++ return event.getRodDamage(); ++ } + CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)this.field_146042_b, p_146034_1_, this, list); + + for(ItemStack itemstack : list) { +@@ -387,7 +395,7 @@ + } + + this.func_70106_y(); +- return i; ++ return event == null ? i : event.getRodDamage(); + } else { + return 0; + } +@@ -413,8 +421,9 @@ + return false; + } + +- public void func_70106_y() { +- super.func_70106_y(); ++ @Override ++ public void remove(boolean keepData) { ++ super.remove(keepData); + if (this.field_146042_b != null) { + this.field_146042_b.field_71104_cf = null; + } diff --git a/patches_old/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch new file mode 100644 index 000000000..ee8e50480 --- /dev/null +++ b/patches_old/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 && raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.func_190536_a(raytraceresult); + } + diff --git a/patches_old/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch b/patches_old/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch new file mode 100644 index 000000000..bb63e85d5 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/projectile/ProjectileHelper.java ++++ b/net/minecraft/entity/projectile/ProjectileHelper.java +@@ -86,7 +86,7 @@ + Vec3d vec3d1 = optional.get(); + double d1 = p_221273_1_.func_72436_e(vec3d1); + if (d1 < d0 || d0 == 0.0D) { +- if (entity1.func_184208_bv() == p_221273_0_.func_184208_bv()) { ++ if (entity1.func_184208_bv() == p_221273_0_.func_184208_bv() && !entity1.canRiderInteract()) { + if (d0 == 0.0D) { + entity = entity1; + vec3d = vec3d1; diff --git a/patches_old/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch new file mode 100644 index 000000000..4d51dd74d --- /dev/null +++ b/patches_old/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 +@@ -255,7 +255,7 @@ + } + + RayTraceResult raytraceresult = ProjectileHelper.func_221266_a(this, true, false, this.field_184570_a, RayTraceContext.BlockMode.COLLIDER); +- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) { ++ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.func_184567_a(raytraceresult); + } + } diff --git a/patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch rename to patches_old/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch new file mode 100644 index 000000000..8c2c14e89 --- /dev/null +++ b/patches_old/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 +@@ -130,7 +130,7 @@ + if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) { + if (raytraceresult.func_216346_c() == RayTraceResult.Type.BLOCK && this.field_70170_p.func_180495_p(((BlockRayTraceResult)raytraceresult).func_216350_a()).func_177230_c() == Blocks.field_150427_aO) { + this.func_181015_d(((BlockRayTraceResult)raytraceresult).func_216350_a()); +- } else { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)){ + this.func_70184_a(raytraceresult); + } + } diff --git a/patches_old/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch new file mode 100644 index 000000000..6da8d57e0 --- /dev/null +++ b/patches_old/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 +@@ -48,7 +48,7 @@ + } + + public float func_180428_a(Explosion p_180428_1_, IBlockReader p_180428_2_, BlockPos p_180428_3_, BlockState p_180428_4_, IFluidState p_180428_5_, float p_180428_6_) { +- return this.func_82342_d() && WitherEntity.func_181033_a(p_180428_4_) ? Math.min(0.8F, p_180428_6_) : p_180428_6_; ++ return this.func_82342_d() && p_180428_4_.canEntityDestroy(p_180428_2_, p_180428_3_, this) ? Math.min(0.8F, p_180428_6_) : p_180428_6_; + } + + protected void func_70227_a(RayTraceResult p_70227_1_) { +@@ -82,7 +82,7 @@ + } + } + +- Explosion.Mode explosion$mode = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; ++ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; + this.field_70170_p.func_217398_a(this, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), 1.0F, false, explosion$mode); + this.func_70106_y(); + } diff --git a/patches_old/minecraft/net/minecraft/fluid/Fluid.java.patch b/patches_old/minecraft/net/minecraft/fluid/Fluid.java.patch new file mode 100644 index 000000000..29ed2bf07 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/fluid/Fluid.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/fluid/Fluid.java ++++ b/net/minecraft/fluid/Fluid.java +@@ -18,7 +18,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public abstract class Fluid { ++public abstract class Fluid extends net.minecraftforge.registries.ForgeRegistryEntry implements net.minecraftforge.common.extensions.IForgeFluid { + public static final ObjectIntIdentityMap field_207201_d = new ObjectIntIdentityMap<>(); + protected final StateContainer field_207202_e; + private IFluidState field_207200_b; +@@ -98,4 +98,26 @@ + } + + public abstract VoxelShape func_215664_b(IFluidState p_215664_1_, IBlockReader p_215664_2_, BlockPos p_215664_3_); ++ ++ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.FluidTags::getGeneration, net.minecraft.tags.FluidTags::func_226157_a_); ++ @Override ++ public java.util.Set getTags() { ++ return reverseTags.getTagNames(); ++ } ++ ++ /** ++ * Creates the fluid attributes object, which will contain all the extended values for the fluid that aren't part of the vanilla system. ++ * Do not call this from outside. To retrieve the values use {@link Fluid#getAttributes()} ++ */ ++ protected net.minecraftforge.fluids.FluidAttributes createAttributes() ++ { ++ return net.minecraftforge.common.ForgeHooks.createVanillaFluidAttributes(this); ++ } ++ ++ private net.minecraftforge.fluids.FluidAttributes forgeFluidAttributes; ++ public final net.minecraftforge.fluids.FluidAttributes getAttributes() { ++ if (forgeFluidAttributes == null) ++ forgeFluidAttributes = createAttributes(); ++ return forgeFluidAttributes; ++ } + } diff --git a/patches/minecraft/net/minecraft/fluid/IFluidState.java.patch b/patches_old/minecraft/net/minecraft/fluid/IFluidState.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/fluid/IFluidState.java.patch rename to patches_old/minecraft/net/minecraft/fluid/IFluidState.java.patch diff --git a/patches_old/minecraft/net/minecraft/fluid/LavaFluid.java.patch b/patches_old/minecraft/net/minecraft/fluid/LavaFluid.java.patch new file mode 100644 index 000000000..593382ed8 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/fluid/LavaFluid.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/fluid/LavaFluid.java ++++ b/net/minecraft/fluid/LavaFluid.java +@@ -70,7 +70,7 @@ + BlockState blockstate = p_207186_1_.func_180495_p(blockpos); + if (blockstate.func_196958_f()) { + if (this.func_176369_e(p_207186_1_, blockpos)) { +- p_207186_1_.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P()); ++ p_207186_1_.func_175656_a(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos, p_207186_2_, Blocks.field_150480_ab.func_176223_P())); + return; + } + } else if (blockstate.func_185904_a().func_76230_c()) { +@@ -85,7 +85,7 @@ + } + + if (p_207186_1_.func_175623_d(blockpos1.func_177984_a()) && this.func_176368_m(p_207186_1_, blockpos1)) { +- p_207186_1_.func_175656_a(blockpos1.func_177984_a(), Blocks.field_150480_ab.func_176223_P()); ++ p_207186_1_.func_175656_a(blockpos1.func_177984_a(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos1.func_177984_a(), p_207186_2_, Blocks.field_150480_ab.func_176223_P())); + } + } + } +@@ -163,7 +163,7 @@ + IFluidState ifluidstate = p_205574_1_.func_204610_c(p_205574_2_); + if (this.func_207185_a(FluidTags.field_206960_b) && ifluidstate.func_206884_a(FluidTags.field_206959_a)) { + if (p_205574_3_.func_177230_c() instanceof FlowingFluidBlock) { +- p_205574_1_.func_180501_a(p_205574_2_, Blocks.field_150348_b.func_176223_P(), 3); ++ p_205574_1_.func_180501_a(p_205574_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_205574_1_, p_205574_2_, p_205574_2_, Blocks.field_150348_b.func_176223_P()), 3); + } + + this.func_205581_a(p_205574_1_, p_205574_2_); diff --git a/patches_old/minecraft/net/minecraft/inventory/container/BrewingStandContainer.java.patch b/patches_old/minecraft/net/minecraft/inventory/container/BrewingStandContainer.java.patch new file mode 100644 index 000000000..5f9380ffd --- /dev/null +++ b/patches_old/minecraft/net/minecraft/inventory/container/BrewingStandContainer.java.patch @@ -0,0 +1,29 @@ +--- 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_) { +- return PotionBrewing.func_185205_a(p_75214_1_); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_75214_1_); + } + + public int func_75219_a() { +@@ -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((ServerPlayerEntity)p_190901_1_, potion); + } + +@@ -175,8 +176,7 @@ + } + + public static boolean func_75243_a_(ItemStack p_75243_0_) { +- Item item = p_75243_0_.func_77973_b(); +- return item == Items.field_151068_bn || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.field_151069_bo; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); + } + } + } diff --git a/patches_old/minecraft/net/minecraft/inventory/container/ContainerType.java.patch b/patches_old/minecraft/net/minecraft/inventory/container/ContainerType.java.patch new file mode 100644 index 000000000..d73023fcd --- /dev/null +++ b/patches_old/minecraft/net/minecraft/inventory/container/ContainerType.java.patch @@ -0,0 +1,26 @@ +--- a/net/minecraft/inventory/container/ContainerType.java ++++ b/net/minecraft/inventory/container/ContainerType.java +@@ -5,7 +5,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class ContainerType { ++public class ContainerType extends net.minecraftforge.registries.ForgeRegistryEntry> implements net.minecraftforge.common.extensions.IForgeContainerType { + public static final ContainerType field_221507_a = func_221505_a("generic_9x1", ChestContainer::func_216986_a); + public static final ContainerType field_221508_b = func_221505_a("generic_9x2", ChestContainer::func_216987_b); + public static final ContainerType field_221509_c = func_221505_a("generic_9x3", ChestContainer::func_216988_c); +@@ -45,6 +45,14 @@ + public T func_221506_a(int p_221506_1_, PlayerInventory p_221506_2_) { + return this.field_221530_x.create(p_221506_1_, p_221506_2_); + } ++ ++ @Override ++ public T create(int windowId, PlayerInventory playerInv, net.minecraft.network.PacketBuffer extraData) { ++ if (this.field_221530_x instanceof net.minecraftforge.fml.network.IContainerFactory) { ++ return ((net.minecraftforge.fml.network.IContainerFactory) this.field_221530_x).create(windowId, playerInv, extraData); ++ } ++ return func_221506_a(windowId, playerInv); ++ } + + public interface IFactory { + @OnlyIn(Dist.CLIENT) diff --git a/patches_old/minecraft/net/minecraft/inventory/container/CraftingResultSlot.java.patch b/patches_old/minecraft/net/minecraft/inventory/container/CraftingResultSlot.java.patch new file mode 100644 index 000000000..2bc3bb302 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/inventory/container/CraftingResultSlot.java.patch @@ -0,0 +1,21 @@ +--- 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); + } + + if (this.field_75224_c instanceof IRecipeHolder) { +@@ -54,8 +55,9 @@ + + public ItemStack func_190901_a(PlayerEntity p_190901_1_, ItemStack p_190901_2_) { + this.func_75208_c(p_190901_2_); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(p_190901_1_); + 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_old/minecraft/net/minecraft/inventory/container/FurnaceResultSlot.java.patch b/patches_old/minecraft/net/minecraft/inventory/container/FurnaceResultSlot.java.patch new file mode 100644 index 000000000..34ef30cf5 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/inventory/container/FurnaceResultSlot.java.patch @@ -0,0 +1,9 @@ +--- a/net/minecraft/inventory/container/FurnaceResultSlot.java ++++ b/net/minecraft/inventory/container/FurnaceResultSlot.java +@@ -44,5 +44,6 @@ + } + + this.field_75228_b = 0; ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerSmeltedEvent(this.field_75229_a, p_75208_1_); + } + } diff --git a/patches_old/minecraft/net/minecraft/inventory/container/GrindstoneContainer.java.patch b/patches_old/minecraft/net/minecraft/inventory/container/GrindstoneContainer.java.patch new file mode 100644 index 000000000..3d10230db --- /dev/null +++ b/patches_old/minecraft/net/minecraft/inventory/container/GrindstoneContainer.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/inventory/container/GrindstoneContainer.java ++++ b/net/minecraft/inventory/container/GrindstoneContainer.java +@@ -141,12 +141,13 @@ + } + + Item item = itemstack.func_77973_b(); +- int k = item.func_77612_l() - itemstack.func_77952_i(); +- int l = item.func_77612_l() - itemstack1.func_77952_i(); +- int i1 = k + l + item.func_77612_l() * 5 / 100; +- i = Math.max(item.func_77612_l() - i1, 0); ++ int k = itemstack.func_77958_k() - itemstack.func_77952_i(); ++ int l = itemstack.func_77958_k() - itemstack1.func_77952_i(); ++ int i1 = k + l + itemstack.func_77958_k() * 5 / 100; ++ i = Math.max(itemstack.func_77958_k() - i1, 0); + itemstack2 = this.func_217011_b(itemstack, itemstack1); +- if (!itemstack2.func_77984_f()) { ++ if (!itemstack2.isRepairable()) i = itemstack.func_77952_i(); ++ if (!itemstack2.func_77984_f() || !itemstack2.isRepairable()) { + if (!ItemStack.func_77989_b(itemstack, itemstack1)) { + this.field_217013_c.func_70299_a(0, ItemStack.field_190927_a); + this.func_75142_b(); diff --git a/patches_old/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch b/patches_old/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch new file mode 100644 index 000000000..166ad22be --- /dev/null +++ b/patches_old/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 +@@ -50,7 +50,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_old/minecraft/net/minecraft/inventory/container/RecipeBookContainer.java.patch b/patches_old/minecraft/net/minecraft/inventory/container/RecipeBookContainer.java.patch new file mode 100644 index 000000000..021a03c2f --- /dev/null +++ b/patches_old/minecraft/net/minecraft/inventory/container/RecipeBookContainer.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/inventory/container/RecipeBookContainer.java ++++ b/net/minecraft/inventory/container/RecipeBookContainer.java +@@ -31,4 +31,8 @@ + + @OnlyIn(Dist.CLIENT) + public abstract int func_203721_h(); ++ ++ public java.util.List getRecipeBookCategories() { ++ return net.minecraft.client.util.ClientRecipeBook.func_216769_b(this); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/inventory/container/Slot.java.patch b/patches_old/minecraft/net/minecraft/inventory/container/Slot.java.patch new file mode 100644 index 000000000..7a99868fa --- /dev/null +++ b/patches_old/minecraft/net/minecraft/inventory/container/Slot.java.patch @@ -0,0 +1,48 @@ +--- a/net/minecraft/inventory/container/Slot.java ++++ b/net/minecraft/inventory/container/Slot.java +@@ -77,7 +77,7 @@ + @Nullable + @OnlyIn(Dist.CLIENT) + public Pair func_225517_c_() { +- return null; ++ return backgroundPair; + } + + public ItemStack func_75209_a(int p_75209_1_) { +@@ -92,4 +92,36 @@ + public boolean func_111238_b() { + return true; + } ++ ++ /** ++ * Retrieves the index in the inventory for this slot, this value should typically not ++ * be used, but can be useful for some occasions. ++ * ++ * @return Index in associated inventory for this slot. ++ */ ++ public int getSlotIndex() { ++ return field_75225_a; ++ } ++ ++ /** ++ * Checks if the other slot is in the same inventory, by comparing the inventory reference. ++ * @param other ++ * @return true if the other slot is in the same inventory ++ */ ++ public boolean isSameInventory(Slot other) { ++ return this.field_75224_c == other.field_75224_c; ++ } ++ ++ private Pair backgroundPair; ++ /** ++ * Sets the background atlas and sprite location. ++ * ++ * @param atlas The atlas name ++ * @param sprite The sprite located on that atlas. ++ * @return this, to allow chaining. ++ */ ++ public Slot setBackground(ResourceLocation atlas, ResourceLocation sprite) { ++ this.backgroundPair = Pair.of(atlas, sprite); ++ return this; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/item/ArmorItem.java.patch b/patches_old/minecraft/net/minecraft/item/ArmorItem.java.patch new file mode 100644 index 000000000..ac2688615 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/ArmorItem.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/item/ArmorItem.java ++++ b/net/minecraft/item/ArmorItem.java +@@ -102,4 +102,8 @@ + public int func_200881_e() { + return this.field_77879_b; + } ++ ++ public float getToughness() { ++ return this.field_189415_e; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/item/ArrowItem.java.patch b/patches_old/minecraft/net/minecraft/item/ArrowItem.java.patch new file mode 100644 index 000000000..cff1d60a1 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/item/BlockItem.java.patch b/patches_old/minecraft/net/minecraft/item/BlockItem.java.patch new file mode 100644 index 000000000..32cf5ad8e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/BlockItem.java.patch @@ -0,0 +1,49 @@ +--- a/net/minecraft/item/BlockItem.java ++++ b/net/minecraft/item/BlockItem.java +@@ -69,8 +69,8 @@ + } + } + +- SoundType soundtype = blockstate1.func_215695_r(); +- 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); ++ SoundType soundtype = blockstate1.getSoundType(world, blockpos, p_195942_1_.func_195999_j()); ++ world.func_184133_a(playerentity, blockpos, this.getPlaceSound(blockstate1, world, blockpos, p_195942_1_.func_195999_j()), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F); + itemstack.func_190918_g(1); + return ActionResultType.SUCCESS; + } +@@ -78,10 +78,16 @@ + } + } + ++ @Deprecated //Forge: Use more sensitive version {@link BlockItem#getPlaceSound(BlockState, IBlockReader, BlockPos, Entity) } + protected SoundEvent func_219983_a(BlockState p_219983_1_) { + return p_219983_1_.func_215695_r().func_185841_e(); + } + ++ //Forge: Sensitive version of BlockItem#getPlaceSound ++ protected SoundEvent getPlaceSound(BlockState state, World world, BlockPos pos, PlayerEntity entity) { ++ return state.getSoundType(world, pos, entity).func_185841_e(); ++ } ++ + @Nullable + public BlockItemUseContext func_219984_b(BlockItemUseContext p_219984_1_) { + return p_219984_1_; +@@ -189,10 +195,18 @@ + } + + public Block func_179223_d() { ++ return this.getBlockRaw() == null ? null : this.getBlockRaw().delegate.get(); ++ } ++ ++ private Block getBlockRaw() { + return this.field_150939_a; + } + + public void func_195946_a(Map p_195946_1_, Item p_195946_2_) { + p_195946_1_.put(this.func_179223_d(), p_195946_2_); + } ++ ++ public void removeFromBlockToItemMap(Map blockToItemMap, Item itemIn) { ++ blockToItemMap.remove(this.func_179223_d()); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/item/BoneMealItem.java.patch b/patches_old/minecraft/net/minecraft/item/BoneMealItem.java.patch new file mode 100644 index 000000000..69195f1f5 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/BoneMealItem.java.patch @@ -0,0 +1,49 @@ +--- 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.server.ServerWorld) ++ return applyBonemeal(p_195966_0_, p_195966_1_, p_195966_2_, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.server.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)) { +@@ -87,7 +96,9 @@ + } + } + +- if (biome == Biomes.field_203614_T || biome == Biomes.field_203617_W) { ++ // FORGE: Use BiomeDictionary here to allow modded warm ocean biomes to spawn coral from bonemeal ++ if (net.minecraftforge.common.BiomeDictionary.hasType(biome, net.minecraftforge.common.BiomeDictionary.Type.OCEAN) ++ && net.minecraftforge.common.BiomeDictionary.hasType(biome, net.minecraftforge.common.BiomeDictionary.Type.HOT)) { + if (i == 0 && p_203173_3_ != null && p_203173_3_.func_176740_k().func_176722_c()) { + blockstate = BlockTags.field_211922_B.func_205596_a(p_203173_1_.field_73012_v).func_176223_P().func_206870_a(DeadCoralWallFanBlock.field_211884_b, p_203173_3_); + } else if (field_77697_d.nextInt(4) == 0) { +@@ -126,7 +137,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_old/minecraft/net/minecraft/item/DyeColor.java.patch b/patches_old/minecraft/net/minecraft/item/DyeColor.java.patch new file mode 100644 index 000000000..8fce4c2bd --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/DyeColor.java.patch @@ -0,0 +1,44 @@ +--- a/net/minecraft/item/DyeColor.java ++++ b/net/minecraft/item/DyeColor.java +@@ -41,6 +41,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 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_) { +@@ -53,6 +54,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("forge", "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_i50049_7_; + } +@@ -111,4 +113,25 @@ + public String func_176610_l() { + return this.field_176785_v; + } ++ ++ public int getColorValue() { ++ return field_193351_w; ++ } ++ ++ public net.minecraft.tags.Tag getTag() { ++ return tag; ++ } ++ ++ @Nullable ++ public static DyeColor getColor(ItemStack stack) { ++ if (stack.func_77973_b() instanceof DyeItem) ++ return ((DyeItem)stack.func_77973_b()).func_195962_g(); ++ ++ for (DyeColor color : field_196062_q) { ++ if (stack.func_77973_b().func_206844_a(color.getTag())) ++ return color; ++ } ++ ++ return null; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/item/DyeableHorseArmorItem.java.patch b/patches_old/minecraft/net/minecraft/item/DyeableHorseArmorItem.java.patch new file mode 100644 index 000000000..52fe87e3f --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/item/FilledMapItem.java.patch b/patches_old/minecraft/net/minecraft/item/FilledMapItem.java.patch new file mode 100644 index 000000000..19b52fe96 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/item/FishBucketItem.java.patch b/patches_old/minecraft/net/minecraft/item/FishBucketItem.java.patch new file mode 100644 index 000000000..cd8070e4f --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/FishBucketItem.java.patch @@ -0,0 +1,32 @@ +--- a/net/minecraft/item/FishBucketItem.java ++++ b/net/minecraft/item/FishBucketItem.java +@@ -25,11 +25,19 @@ + public class FishBucketItem extends BucketItem { + private final EntityType field_203794_a; + ++ @Deprecated + public FishBucketItem(EntityType p_i49022_1_, Fluid p_i49022_2_, Item.Properties p_i49022_3_) { + super(p_i49022_2_, p_i49022_3_); + this.field_203794_a = p_i49022_1_; ++ this.fishTypeSupplier = () -> p_i49022_1_; + } + ++ public FishBucketItem(java.util.function.Supplier> fishTypeIn, java.util.function.Supplier p_i49022_2_, Item.Properties builder) { ++ super(p_i49022_2_, builder); ++ this.field_203794_a = null; ++ this.fishTypeSupplier = fishTypeIn; ++ } ++ + public void func_203792_a(World p_203792_1_, ItemStack p_203792_2_, BlockPos p_203792_3_) { + if (!p_203792_1_.field_72995_K) { + this.func_205357_b(p_203792_1_, p_203792_2_, p_203792_3_); +@@ -78,4 +86,9 @@ + } + + } ++ ++ private final java.util.function.Supplier> fishTypeSupplier; ++ protected EntityType getFishType() { ++ return fishTypeSupplier.get(); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/FlintAndSteelItem.java.patch b/patches_old/minecraft/net/minecraft/item/FlintAndSteelItem.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/item/FlintAndSteelItem.java.patch rename to patches_old/minecraft/net/minecraft/item/FlintAndSteelItem.java.patch diff --git a/patches_old/minecraft/net/minecraft/item/Food.java.patch b/patches_old/minecraft/net/minecraft/item/Food.java.patch new file mode 100644 index 000000000..8b1215590 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/Food.java.patch @@ -0,0 +1,73 @@ +--- a/net/minecraft/item/Food.java ++++ b/net/minecraft/item/Food.java +@@ -11,15 +11,26 @@ + private final boolean field_221472_c; + private final boolean field_221473_d; + private final boolean field_221474_e; +- private final List> field_221475_f; ++ private final List, Float>> field_221475_f; ++ ++ private Food(Food.Builder builder) { ++ this.field_221470_a = builder.field_221458_a; ++ this.field_221471_b = builder.field_221459_b; ++ this.field_221472_c = builder.field_221460_c; ++ this.field_221473_d = builder.field_221461_d; ++ this.field_221474_e = builder.field_221462_e; ++ this.field_221475_f = builder.field_221463_f; ++ } + ++ // Forge: Use builder method instead ++ @Deprecated + private Food(int p_i50106_1_, float p_i50106_2_, boolean p_i50106_3_, boolean p_i50106_4_, boolean p_i50106_5_, List> p_i50106_6_) { + this.field_221470_a = p_i50106_1_; + this.field_221471_b = p_i50106_2_; + this.field_221472_c = p_i50106_3_; + this.field_221473_d = p_i50106_4_; + this.field_221474_e = p_i50106_5_; +- this.field_221475_f = p_i50106_6_; ++ this.field_221475_f = p_i50106_6_.stream().map(pair -> Pair., Float>of(pair::getLeft, pair.getRight())).collect(java.util.stream.Collectors.toList()); + } + + public int func_221466_a() { +@@ -43,7 +54,7 @@ + } + + public List> func_221464_f() { +- return this.field_221475_f; ++ return this.field_221475_f.stream().map(pair -> Pair.of(pair.getLeft() != null ? pair.getLeft().get() : null, pair.getRight())).collect(java.util.stream.Collectors.toList()); + } + + public static class Builder { +@@ -52,7 +63,7 @@ + private boolean field_221460_c; + private boolean field_221461_d; + private boolean field_221462_e; +- private final List> field_221463_f = Lists.newArrayList(); ++ private final List, Float>> field_221463_f = Lists.newArrayList(); + + public Food.Builder func_221456_a(int p_221456_1_) { + this.field_221458_a = p_221456_1_; +@@ -78,14 +89,21 @@ + this.field_221462_e = true; + return this; + } ++ ++ public Food.Builder effect(java.util.function.Supplier effectIn, float probability) { ++ this.field_221463_f.add(Pair.of(effectIn, probability)); ++ return this; ++ } + ++ // Forge: Use supplier method instead ++ @Deprecated + public Food.Builder func_221452_a(EffectInstance p_221452_1_, float p_221452_2_) { +- this.field_221463_f.add(Pair.of(p_221452_1_, p_221452_2_)); ++ this.field_221463_f.add(Pair.of(() -> p_221452_1_, p_221452_2_)); + return this; + } + + public Food func_221453_d() { +- return new Food(this.field_221458_a, this.field_221459_b, this.field_221460_c, this.field_221461_d, this.field_221462_e, this.field_221463_f); ++ return new Food(this); + } + } + } diff --git a/patches_old/minecraft/net/minecraft/item/HoeItem.java.patch b/patches_old/minecraft/net/minecraft/item/HoeItem.java.patch new file mode 100644 index 000000000..b75b128f5 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/item/HorseArmorItem.java.patch b/patches_old/minecraft/net/minecraft/item/HorseArmorItem.java.patch new file mode 100644 index 000000000..49f526153 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/item/ItemGroup.java.patch b/patches_old/minecraft/net/minecraft/item/ItemGroup.java.patch new file mode 100644 index 000000000..411c9d11e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/ItemGroup.java.patch @@ -0,0 +1,92 @@ +--- a/net/minecraft/item/ItemGroup.java ++++ b/net/minecraft/item/ItemGroup.java +@@ -104,11 +104,14 @@ + private EnchantmentType[] field_111230_s = new EnchantmentType[0]; + private ItemStack field_151245_t; + ++ public ItemGroup(String label) { ++ this(-1, label); ++ } ++ + public ItemGroup(int p_i1853_1_, String p_i1853_2_) { +- this.field_78033_n = p_i1853_1_; + this.field_78034_o = p_i1853_2_; + this.field_151245_t = ItemStack.field_190927_a; +- field_78032_a[p_i1853_1_] = this; ++ this.field_78033_n = addGroupSafe(p_i1853_1_, this); + } + + @OnlyIn(Dist.CLIENT) +@@ -179,11 +182,13 @@ + + @OnlyIn(Dist.CLIENT) + public int func_78020_k() { ++ if (field_78033_n > 11) return ((field_78033_n - 12) % 10) % 5; + return this.field_78033_n % 6; + } + + @OnlyIn(Dist.CLIENT) + public boolean func_78023_l() { ++ if (field_78033_n > 11) return ((field_78033_n - 12) % 10) < 5; + return this.field_78033_n < 6; + } + +@@ -220,4 +225,58 @@ + } + + } ++ ++ public int getTabPage() { ++ return field_78033_n < 12 ? 0 : ((field_78033_n - 12) / 10) + 1; ++ } ++ ++ public boolean hasSearchBar() { ++ return field_78033_n == field_78027_g.field_78033_n; ++ } ++ ++ /** ++ * Gets the width of the search bar of the creative tab, use this if your ++ * creative tab name overflows together with a custom texture. ++ * ++ * @return The width of the search bar, 89 by default ++ */ ++ public int getSearchbarWidth() { ++ return 89; ++ } ++ ++ @OnlyIn(Dist.CLIENT) ++ public net.minecraft.util.ResourceLocation getBackgroundImage() { ++ return new net.minecraft.util.ResourceLocation("textures/gui/container/creative_inventory/tab_" + this.func_78015_f()); ++ } ++ ++ private static final net.minecraft.util.ResourceLocation CREATIVE_INVENTORY_TABS = new net.minecraft.util.ResourceLocation("textures/gui/container/creative_inventory/tabs.png"); ++ @OnlyIn(Dist.CLIENT) ++ public net.minecraft.util.ResourceLocation getTabsImage() { ++ return CREATIVE_INVENTORY_TABS; ++ } ++ ++ public int getLabelColor() { ++ return 4210752; ++ } ++ ++ public int getSlotColor() { ++ return -2130706433; ++ } ++ ++ public static synchronized int getGroupCountSafe() { ++ return ItemGroup.field_78032_a.length; ++ } ++ ++ private static synchronized int addGroupSafe(int index, ItemGroup newGroup) { ++ if(index == -1) { ++ index = field_78032_a.length; ++ } ++ if (index >= field_78032_a.length) { ++ ItemGroup[] tmp = new ItemGroup[index + 1]; ++ System.arraycopy(field_78032_a, 0, tmp, 0, field_78032_a.length); ++ field_78032_a = tmp; ++ } ++ field_78032_a[index] = newGroup; ++ return index; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/item/ItemStack.java.patch b/patches_old/minecraft/net/minecraft/item/ItemStack.java.patch new file mode 100644 index 000000000..dc7384472 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/ItemStack.java.patch @@ -0,0 +1,245 @@ +--- a/net/minecraft/item/ItemStack.java ++++ b/net/minecraft/item/ItemStack.java +@@ -66,7 +66,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-public final class ItemStack { ++public final class ItemStack extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeItemStack { + 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(); +@@ -82,6 +82,9 @@ + private CachedBlockInfo field_179550_j; + private boolean field_179551_k; + ++ private net.minecraftforge.registries.IRegistryDelegate delegate; ++ private CompoundNBT capNBT; ++ + private static DecimalFormat func_208306_D() { + DecimalFormat decimalformat = new DecimalFormat("#.##"); + decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); +@@ -92,7 +95,10 @@ + 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 CompoundNBT capNBT) { ++ super(ItemStack.class); ++ this.capNBT = capNBT; + this.field_151002_e = p_i48204_1_ == null ? null : p_i48204_1_.func_199767_j(); + this.field_77994_a = p_i48204_2_; + if (this.field_151002_e != null && this.field_151002_e.func_77645_m()) { +@@ -100,6 +106,7 @@ + } + + this.func_190923_F(); ++ this.forgeInit(); + } + + private void func_190923_F() { +@@ -108,6 +115,8 @@ + } + + 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; + 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)) { +@@ -120,6 +129,7 @@ + } + + this.func_190923_F(); ++ this.forgeInit(); + } + + public static ItemStack func_199557_a(CompoundNBT p_199557_0_) { +@@ -134,7 +144,7 @@ + public boolean func_190926_b() { + if (this == field_190927_a) { + return true; +- } else if (this.func_77973_b() != null && this.func_77973_b() != Items.field_190931_a) { ++ } else if (this.getItemRaw() != null && this.getItemRaw() != Items.field_190931_a) { + return this.field_77994_a <= 0; + } else { + return true; +@@ -150,10 +160,19 @@ + } + + public Item func_77973_b() { +- return this.field_190928_g ? Items.field_190931_a : this.field_151002_e; ++ return this.field_190928_g || this.delegate == null ? Items.field_190931_a : this.delegate.get(); + } + + 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 ActionResultType onItemUseFirst(ItemUseContext context) { ++ return onItemUse(context, (c) -> func_77973_b().onItemUseFirst(this, context)); ++ } ++ ++ 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); +@@ -161,7 +180,7 @@ + return ActionResultType.PASS; + } else { + Item item = this.func_77973_b(); +- 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)); + } +@@ -189,12 +208,15 @@ + if (this.field_77990_d != null) { + p_77955_1_.func_218657_a("tag", this.field_77990_d.func_74737_b()); + } +- ++ CompoundNBT cnbt = this.serializeCaps(); ++ if (cnbt != null && !cnbt.isEmpty()) { ++ p_77955_1_.func_218657_a("ForgeCaps", cnbt); ++ } + return p_77955_1_; + } + + public int func_77976_d() { +- return this.func_77973_b().func_77639_j(); ++ return this.func_77973_b().getItemStackLimit(this); + } + + public boolean func_77985_e() { +@@ -202,7 +224,7 @@ + } + + 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) { + CompoundNBT compoundnbt = this.func_77978_p(); + return compoundnbt == null || !compoundnbt.func_74767_n("Unbreakable"); + } else { +@@ -211,19 +233,19 @@ + } + + public boolean func_77951_h() { +- return this.func_77984_f() && this.func_77952_i() > 0; ++ return this.func_77984_f() && func_77973_b().isDamaged(this); + } + + public int func_77952_i() { +- return this.field_77990_d == null ? 0 : this.field_77990_d.func_74762_e("Damage"); ++ return this.func_77973_b().getDamage(this); + } + + public void func_196085_b(int p_196085_1_) { +- this.func_196082_o().func_74768_a("Damage", Math.max(0, p_196085_1_)); ++ this.func_77973_b().setDamage(this, p_196085_1_); + } + + public int func_77958_k() { +- return this.func_77973_b().func_77612_l(); ++ return this.func_77973_b().getMaxDamage(this); + } + + public boolean func_96631_a(int p_96631_1_, Random p_96631_2_, @Nullable ServerPlayerEntity p_96631_3_) { +@@ -259,6 +281,7 @@ + public void func_222118_a(int p_222118_1_, T p_222118_2_, Consumer p_222118_3_) { + if (!p_222118_2_.field_70170_p.field_72995_K && (!(p_222118_2_ instanceof PlayerEntity) || !((PlayerEntity)p_222118_2_).field_71075_bZ.field_75098_d)) { + if (this.func_77984_f()) { ++ p_222118_1_ = this.func_77973_b().damageItem(this, p_222118_1_, p_222118_2_, p_222118_3_); + if (this.func_96631_a(p_222118_1_, p_222118_2_.func_70681_au(), p_222118_2_ instanceof ServerPlayerEntity ? (ServerPlayerEntity)p_222118_2_ : null)) { + p_222118_3_.accept(p_222118_2_); + Item item = this.func_77973_b(); +@@ -291,7 +314,7 @@ + } + + 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(PlayerEntity p_111282_1_, LivingEntity p_111282_2_, Hand p_111282_3_) { +@@ -302,7 +325,7 @@ + if (this.func_190926_b()) { + return field_190927_a; + } else { +- ItemStack itemstack = new ItemStack(this.func_77973_b(), this.field_77994_a); ++ ItemStack itemstack = new ItemStack(this.func_77973_b(), this.field_77994_a, this.serializeCaps()); + itemstack.func_190915_d(this.func_190921_D()); + if (this.field_77990_d != null) { + itemstack.field_77990_d = this.field_77990_d.func_74737_b(); +@@ -319,7 +342,7 @@ + if (p_77970_0_.field_77990_d == null && p_77970_1_.field_77990_d != null) { + return false; + } else { +- return p_77970_0_.field_77990_d == null || p_77970_0_.field_77990_d.equals(p_77970_1_.field_77990_d); ++ return (p_77970_0_.field_77990_d == null || p_77970_0_.field_77990_d.equals(p_77970_1_.field_77990_d)) && p_77970_0_.areCapsCompatible(p_77970_1_); + } + } else { + return false; +@@ -342,7 +365,7 @@ + } else if (this.field_77990_d == null && p_77959_1_.field_77990_d != null) { + return false; + } else { +- return this.field_77990_d == null || this.field_77990_d.equals(p_77959_1_.field_77990_d); ++ return (this.field_77990_d == null || this.field_77990_d.equals(p_77959_1_.field_77990_d)) && this.areCapsCompatible(p_77959_1_); + } + } + +@@ -652,6 +675,7 @@ + } + } + ++ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, p_82840_1_, list, p_82840_2_); + return list; + } + +@@ -772,7 +796,7 @@ + } + } + } else { +- multimap = this.func_77973_b().func_111205_h(p_111283_1_); ++ multimap = this.func_77973_b().getAttributeModifiers(p_111283_1_, this); + } + + multimap.values().forEach((p_226631_0_) -> { +@@ -915,6 +939,35 @@ + return this.func_77973_b().func_219971_r(); + } + ++ // FORGE START ++ 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); ++ } ++ } ++ ++ /** ++ * Internal call to get the actual item, not the delegate. ++ * In all other methods, FML replaces calls to this.item with the item delegate. ++ */ ++ @Nullable ++ private Item getItemRaw() { ++ return this.field_151002_e; ++ } ++ + public SoundEvent func_226629_F_() { + return this.func_77973_b().func_225520_U__(); + } diff --git a/patches_old/minecraft/net/minecraft/item/Items.java.patch b/patches_old/minecraft/net/minecraft/item/Items.java.patch new file mode 100644 index 000000000..c2fcd96b3 --- /dev/null +++ b/patches_old/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/LilyPadItem.java.patch b/patches_old/minecraft/net/minecraft/item/LilyPadItem.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/item/LilyPadItem.java.patch rename to patches_old/minecraft/net/minecraft/item/LilyPadItem.java.patch diff --git a/patches_old/minecraft/net/minecraft/item/MilkBucketItem.java.patch b/patches_old/minecraft/net/minecraft/item/MilkBucketItem.java.patch new file mode 100644 index 000000000..133b3f114 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/MilkBucketItem.java.patch @@ -0,0 +1,32 @@ +--- a/net/minecraft/item/MilkBucketItem.java ++++ b/net/minecraft/item/MilkBucketItem.java +@@ -15,6 +15,8 @@ + } + + 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 ServerPlayerEntity) { + ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)p_77654_3_; + CriteriaTriggers.field_193138_y.func_193148_a(serverplayerentity, p_77654_1_); +@@ -25,10 +27,6 @@ + p_77654_1_.func_190918_g(1); + } + +- if (!p_77654_2_.field_72995_K) { +- p_77654_3_.func_195061_cb(); +- } +- + return p_77654_1_.func_190926_b() ? new ItemStack(Items.field_151133_ar) : p_77654_1_; + } + +@@ -44,4 +42,9 @@ + p_77659_2_.func_184598_c(p_77659_3_); + return ActionResult.func_226248_a_(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.CompoundNBT nbt) { ++ return new net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper(stack); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/item/MinecartItem.java.patch b/patches_old/minecraft/net/minecraft/item/MinecartItem.java.patch new file mode 100644 index 000000000..957a16961 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/item/MusicDiscItem.java.patch b/patches_old/minecraft/net/minecraft/item/MusicDiscItem.java.patch new file mode 100644 index 000000000..915348992 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/MusicDiscItem.java.patch @@ -0,0 +1,51 @@ +--- a/net/minecraft/item/MusicDiscItem.java ++++ b/net/minecraft/item/MusicDiscItem.java +@@ -21,17 +21,40 @@ + import net.minecraftforge.api.distmarker.OnlyIn; + + public class MusicDiscItem extends Item { ++ @Deprecated // Forge: refer to WorldRender#playRecord. Modders: there's no need to reflectively modify this map! + private static final Map field_150928_b = Maps.newHashMap(); + private final int field_195977_c; ++ @Deprecated // Forge: refer to soundSupplier + private final SoundEvent field_185076_b; ++ private final java.util.function.Supplier soundSupplier; + ++ @Deprecated // Forge: Use the constructor that takes a supplier instead + protected MusicDiscItem(int p_i48475_1_, SoundEvent p_i48475_2_, Item.Properties p_i48475_3_) { + super(p_i48475_3_); + this.field_195977_c = p_i48475_1_; + this.field_185076_b = p_i48475_2_; + field_150928_b.put(this.field_185076_b, this); ++ this.soundSupplier = this.field_185076_b.delegate; + } + ++ /** ++ * For mod use, allows to create a music disc without having to create a new ++ * SoundEvent before their registry event is fired. ++ * ++ * @param comparatorValue The value this music disc should output on the comparator. Must be between 0 and 15. ++ * @param soundSupplier A supplier that provides the sound that should be played. Use a ++ * {@link net.minecraftforge.fml.RegistryObject}{@code } or a ++ * {@link net.minecraftforge.registries.IRegistryDelegate} for this parameter. ++ * @param builder A set of {@link Item.Properties} that describe this item. ++ */ ++ public MusicDiscItem(int comparatorValue, java.util.function.Supplier soundSupplier, Item.Properties builder) ++ { ++ super(builder); ++ this.field_195977_c = comparatorValue; ++ this.field_185076_b = null; ++ this.soundSupplier = soundSupplier; ++ } ++ + 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(); +@@ -76,6 +99,6 @@ + + @OnlyIn(Dist.CLIENT) + public SoundEvent func_185075_h() { +- return this.field_185076_b; ++ return this.soundSupplier.get(); + } + } diff --git a/patches_old/minecraft/net/minecraft/item/Rarity.java.patch b/patches_old/minecraft/net/minecraft/item/Rarity.java.patch new file mode 100644 index 000000000..333800c24 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/item/ShearsItem.java.patch b/patches_old/minecraft/net/minecraft/item/ShearsItem.java.patch new file mode 100644 index 000000000..2cb1d3f8e --- /dev/null +++ b/patches_old/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.func_226277_ct_(), entity.func_226278_cu_(), entity.func_226281_cx_()); ++ 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(d, 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_old/minecraft/net/minecraft/item/ShovelItem.java.patch b/patches_old/minecraft/net/minecraft/item/ShovelItem.java.patch new file mode 100644 index 000000000..4e504aa46 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/ShovelItem.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/item/ShovelItem.java ++++ b/net/minecraft/item/ShovelItem.java +@@ -22,7 +22,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_) { +@@ -40,7 +40,7 @@ + PlayerEntity playerentity = p_195939_1_.func_195999_j(); + BlockState blockstate1 = field_195955_e.get(blockstate.func_177230_c()); + BlockState blockstate2 = null; +- if (blockstate1 != null && world.func_180495_p(blockpos.func_177984_a()).func_196958_f()) { ++ if (blockstate1 != null && world.func_175623_d(blockpos.func_177984_a())) { + world.func_184133_a(playerentity, blockpos, SoundEvents.field_187771_eN, SoundCategory.BLOCKS, 1.0F, 1.0F); + blockstate2 = blockstate1; + } else if (blockstate.func_177230_c() instanceof CampfireBlock && blockstate.func_177229_b(CampfireBlock.field_220101_b)) { diff --git a/patches_old/minecraft/net/minecraft/item/ToolItem.java.patch b/patches_old/minecraft/net/minecraft/item/ToolItem.java.patch new file mode 100644 index 000000000..86958c9e0 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/ToolItem.java.patch @@ -0,0 +1,10 @@ +--- 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_, 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_old/minecraft/net/minecraft/item/WallOrFloorItem.java.patch b/patches_old/minecraft/net/minecraft/item/WallOrFloorItem.java.patch new file mode 100644 index 000000000..392861e30 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/WallOrFloorItem.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/item/WallOrFloorItem.java ++++ b/net/minecraft/item/WallOrFloorItem.java +@@ -41,4 +41,9 @@ + super.func_195946_a(p_195946_1_, p_195946_2_); + p_195946_1_.put(this.field_195947_b, p_195946_2_); + } ++ ++ public void removeFromBlockToItemMap(Map blockToItemMap, Item itemIn) { ++ super.removeFromBlockToItemMap(blockToItemMap, itemIn); ++ blockToItemMap.remove(this.field_195947_b); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch new file mode 100644 index 000000000..a0bcbfbf6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/item/crafting/BannerDuplicateRecipe.java ++++ b/net/minecraft/item/crafting/BannerDuplicateRecipe.java +@@ -77,8 +77,8 @@ + for(int i = 0; i < nonnulllist.size(); ++i) { + ItemStack itemstack = p_179532_1_.func_70301_a(i); + if (!itemstack.func_190926_b()) { +- if (itemstack.func_77973_b().func_77634_r()) { +- 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() && BannerTileEntity.func_175113_c(itemstack) > 0) { + ItemStack itemstack1 = itemstack.func_77946_l(); + itemstack1.func_190920_e(1); diff --git a/patches_old/minecraft/net/minecraft/item/crafting/BookCloningRecipe.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/BookCloningRecipe.java.patch new file mode 100644 index 000000000..8952a808e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/BookCloningRecipe.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/item/crafting/BookCloningRecipe.java ++++ b/net/minecraft/item/crafting/BookCloningRecipe.java +@@ -79,8 +79,8 @@ + + for(int i = 0; i < nonnulllist.size(); ++i) { + ItemStack itemstack = p_179532_1_.func_70301_a(i); +- if (itemstack.func_77973_b().func_77634_r()) { +- 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 WrittenBookItem) { + ItemStack itemstack1 = itemstack.func_77946_l(); + itemstack1.func_190920_e(1); diff --git a/patches_old/minecraft/net/minecraft/item/crafting/CookingRecipeSerializer.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/CookingRecipeSerializer.java.patch new file mode 100644 index 000000000..1dd2da6b9 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/CookingRecipeSerializer.java.patch @@ -0,0 +1,30 @@ +--- a/net/minecraft/item/crafting/CookingRecipeSerializer.java ++++ b/net/minecraft/item/crafting/CookingRecipeSerializer.java +@@ -8,7 +8,7 @@ + import net.minecraft.util.ResourceLocation; + import net.minecraft.util.registry.Registry; + +-public class CookingRecipeSerializer implements IRecipeSerializer { ++public class CookingRecipeSerializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements IRecipeSerializer { + private final int field_222178_t; + private final CookingRecipeSerializer.IFactory field_222179_u; + +@@ -21,11 +21,17 @@ + String s = JSONUtils.func_151219_a(p_199425_2_, "group", ""); + JsonElement jsonelement = (JsonElement)(JSONUtils.func_151202_d(p_199425_2_, "ingredient") ? JSONUtils.func_151214_t(p_199425_2_, "ingredient") : JSONUtils.func_152754_s(p_199425_2_, "ingredient")); + Ingredient ingredient = Ingredient.func_199802_a(jsonelement); ++ //Forge: Check if primitive string to keep vanilla or a object which can contain a count field. ++ if (!p_199425_2_.has("result")) throw new com.google.gson.JsonSyntaxException("Missing result, expected to find a string or object"); ++ ItemStack itemstack; ++ if (p_199425_2_.get("result").isJsonObject()) itemstack = ShapedRecipe.func_199798_a(JSONUtils.func_152754_s(p_199425_2_, "result")); ++ else { + String s1 = JSONUtils.func_151200_h(p_199425_2_, "result"); + ResourceLocation resourcelocation = new ResourceLocation(s1); +- ItemStack itemstack = new ItemStack(Registry.field_212630_s.func_218349_b(resourcelocation).orElseThrow(() -> { ++ itemstack = new ItemStack(Registry.field_212630_s.func_218349_b(resourcelocation).orElseThrow(() -> { + return new IllegalStateException("Item: " + s1 + " does not exist"); + })); ++ } + float f = JSONUtils.func_151221_a(p_199425_2_, "experience", 0.0F); + int i = JSONUtils.func_151208_a(p_199425_2_, "cookingtime", this.field_222178_t); + return this.field_222179_u.create(p_199425_1_, s, ingredient, itemstack, f, i); diff --git a/patches_old/minecraft/net/minecraft/item/crafting/IRecipe.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/IRecipe.java.patch new file mode 100644 index 000000000..9bf817be7 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/IRecipe.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/item/crafting/IRecipe.java ++++ b/net/minecraft/item/crafting/IRecipe.java +@@ -21,9 +21,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) { +- Item item = p_179532_1_.func_70301_a(i).func_77973_b(); +- if (item.func_77634_r()) { +- nonnulllist.set(i, new ItemStack(item.func_77668_q())); ++ ItemStack item = p_179532_1_.func_70301_a(i); ++ if (item.hasContainerItem()) { ++ nonnulllist.set(i, item.getContainerItem()); + } + } + diff --git a/patches_old/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch new file mode 100644 index 000000000..1a0f0d345 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch @@ -0,0 +1,17 @@ +--- 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_) { + int i = p_201501_1_; + int j = p_201501_2_; +- if (p_201501_4_ instanceof ShapedRecipe) { +- ShapedRecipe shapedrecipe = (ShapedRecipe)p_201501_4_; +- i = shapedrecipe.func_192403_f(); +- j = shapedrecipe.func_192404_g(); ++ if (p_201501_4_ instanceof net.minecraftforge.common.crafting.IShapedRecipe) { ++ net.minecraftforge.common.crafting.IShapedRecipe shapedrecipe = (net.minecraftforge.common.crafting.IShapedRecipe)p_201501_4_; ++ i = shapedrecipe.getRecipeWidth(); ++ j = shapedrecipe.getRecipeHeight(); + } + + int k1 = 0; diff --git a/patches_old/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch new file mode 100644 index 000000000..6d1c6fd51 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/item/crafting/IRecipeSerializer.java ++++ b/net/minecraft/item/crafting/IRecipeSerializer.java +@@ -5,7 +5,7 @@ + import net.minecraft.util.ResourceLocation; + import net.minecraft.util.registry.Registry; + +-public interface IRecipeSerializer> { ++public interface IRecipeSerializer> extends net.minecraftforge.registries.IForgeRegistryEntry> { + IRecipeSerializer field_222157_a = func_222156_a("crafting_shaped", new ShapedRecipe.Serializer()); + IRecipeSerializer field_222158_b = func_222156_a("crafting_shapeless", new ShapelessRecipe.Serializer()); + SpecialRecipeSerializer field_222159_c = func_222156_a("crafting_special_armordye", new SpecialRecipeSerializer<>(ArmorDyeRecipe::new)); +@@ -29,6 +29,7 @@ + + T func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_); + ++ @javax.annotation.Nullable + T func_199426_a_(ResourceLocation p_199426_1_, PacketBuffer p_199426_2_); + + void func_199427_a_(PacketBuffer p_199427_1_, T p_199427_2_); diff --git a/patches_old/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch new file mode 100644 index 000000000..fc263ce75 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/item/crafting/RepairItemRecipe.java ++++ b/net/minecraft/item/crafting/RepairItemRecipe.java +@@ -22,7 +22,7 @@ + list.add(itemstack); + if (list.size() > 1) { + ItemStack itemstack1 = list.get(0); +- if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.func_190916_E() != 1 || itemstack.func_190916_E() != 1 || !itemstack1.func_77973_b().func_77645_m()) { ++ if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.func_190916_E() != 1 || itemstack.func_190916_E() != 1 || !itemstack1.isRepairable()) { + return false; + } + } +@@ -41,7 +41,7 @@ + list.add(itemstack); + if (list.size() > 1) { + ItemStack itemstack1 = list.get(0); +- if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.func_190916_E() != 1 || itemstack.func_190916_E() != 1 || !itemstack1.func_77973_b().func_77645_m()) { ++ if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.func_190916_E() != 1 || itemstack.func_190916_E() != 1 || !itemstack1.isRepairable()) { + return ItemStack.field_190927_a; + } + } +@@ -51,12 +51,12 @@ + if (list.size() == 2) { + 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()) { ++ if (itemstack3.func_77973_b() == itemstack4.func_77973_b() && itemstack3.func_190916_E() == 1 && itemstack4.func_190916_E() == 1 && itemstack3.isRepairable()) { + 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; + } diff --git a/patches_old/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch new file mode 100644 index 000000000..93b58b6c4 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch @@ -0,0 +1,80 @@ +--- a/net/minecraft/item/crafting/ShapedRecipe.java ++++ b/net/minecraft/item/crafting/ShapedRecipe.java +@@ -21,7 +21,20 @@ + import net.minecraft.util.registry.Registry; + import net.minecraft.world.World; + +-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; ++ /** ++ * Expand the max width and height allowed in the deserializer. ++ * This should be called by modders who add custom crafting tables that are larger than the vanilla 3x3. ++ * @param width your max recipe width ++ * @param height your max recipe height ++ */ ++ public static void setCraftingSize(int width, int height) { ++ if (MAX_WIDTH < width) MAX_WIDTH = width; ++ if (MAX_HEIGHT < height) MAX_HEIGHT = height; ++ } ++ + private final int field_77576_b; + private final int field_77577_c; + private final NonNullList field_77574_d; +@@ -109,10 +122,20 @@ + return this.field_77576_b; + } + ++ @Override ++ public int getRecipeWidth() { ++ return func_192403_f(); ++ } ++ + public int func_192404_g() { + return this.field_77577_c; + } + ++ @Override ++ public int getRecipeHeight() { ++ return func_192404_g(); ++ } ++ + 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()); +@@ -194,15 +217,15 @@ + + private static String[] func_192407_a(JsonArray p_192407_0_) { + String[] astring = new String[p_192407_0_.size()]; +- if (astring.length > 3) { +- throw new JsonSyntaxException("Invalid pattern: too many rows, 3 is maximum"); ++ if (astring.length > MAX_HEIGHT) { ++ throw new JsonSyntaxException("Invalid pattern: too many rows, " + MAX_HEIGHT + " is maximum"); + } else if (astring.length == 0) { + 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 + "]"); +- if (s.length() > 3) { +- throw new JsonSyntaxException("Invalid pattern: too many columns, 3 is maximum"); ++ if (s.length() > MAX_WIDTH) { ++ throw new JsonSyntaxException("Invalid pattern: too many columns, " + MAX_WIDTH + " is maximum"); + } + + if (i > 0 && astring[0].length() != s.length()) { +@@ -244,11 +267,12 @@ + throw new JsonParseException("Disallowed data tag found"); + } else { + 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); + } + } + +- public static class Serializer implements IRecipeSerializer { ++ public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> 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")); diff --git a/patches_old/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch new file mode 100644 index 000000000..f781cb219 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch @@ -0,0 +1,58 @@ +--- a/net/minecraft/item/crafting/ShapelessRecipe.java ++++ b/net/minecraft/item/crafting/ShapelessRecipe.java +@@ -17,12 +17,14 @@ + private final String field_194138_c; + private final ItemStack field_77580_a; + private final NonNullList field_77579_b; ++ private final boolean isSimple; + + public ShapelessRecipe(ResourceLocation p_i48161_1_, String p_i48161_2_, ItemStack p_i48161_3_, NonNullList p_i48161_4_) { + this.field_199562_a = p_i48161_1_; + this.field_194138_c = p_i48161_2_; + this.field_77580_a = p_i48161_3_; + this.field_77579_b = p_i48161_4_; ++ this.isSimple = p_i48161_4_.stream().allMatch(Ingredient::isSimple); + } + + public ResourceLocation func_199560_c() { +@@ -47,17 +49,20 @@ + + 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_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); + } + + public ItemStack func_77572_b(CraftingInventory p_77572_1_) { +@@ -68,14 +73,15 @@ + return p_194133_1_ * p_194133_2_ >= this.field_77579_b.size(); + } + +- public static class Serializer implements IRecipeSerializer { ++ public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> 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")); + if (nonnulllist.isEmpty()) { + throw new JsonParseException("No ingredients for shapeless recipe"); +- } else if (nonnulllist.size() > 9) { +- throw new JsonParseException("Too many ingredients for shapeless recipe"); ++ } 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")); + return new ShapelessRecipe(p_199425_1_, s, itemstack, nonnulllist); diff --git a/patches_old/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch new file mode 100644 index 000000000..b8e099fa4 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java ++++ b/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java +@@ -25,7 +25,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; + } + +@@ -43,7 +43,7 @@ + + public ItemStack func_77572_b(CraftingInventory p_77572_1_) { + ItemStack itemstack = ItemStack.field_190927_a; +- 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); +@@ -51,13 +51,14 @@ + Item item = itemstack1.func_77973_b(); + if (Block.func_149634_a(item) instanceof ShulkerBoxBlock) { + itemstack = itemstack1; +- } else if (item instanceof DyeItem) { +- dyeitem = (DyeItem)item; ++ } else { ++ net.minecraft.item.DyeColor tmp = net.minecraft.item.DyeColor.getColor(itemstack1); ++ if (tmp != null) dyecolor = tmp; + } + } + } + +- 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()); + } diff --git a/patches_old/minecraft/net/minecraft/item/crafting/SingleItemRecipe.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/SingleItemRecipe.java.patch new file mode 100644 index 000000000..43387b576 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/SingleItemRecipe.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/item/crafting/SingleItemRecipe.java ++++ b/net/minecraft/item/crafting/SingleItemRecipe.java +@@ -60,7 +60,7 @@ + return this.field_222132_b.func_77946_l(); + } + +- public static class Serializer implements IRecipeSerializer { ++ public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements IRecipeSerializer { + final SingleItemRecipe.Serializer.IRecipeFactory field_222180_t; + + protected Serializer(SingleItemRecipe.Serializer.IRecipeFactory p_i50146_1_) { diff --git a/patches_old/minecraft/net/minecraft/item/crafting/SpecialRecipeSerializer.java.patch b/patches_old/minecraft/net/minecraft/item/crafting/SpecialRecipeSerializer.java.patch new file mode 100644 index 000000000..195ee9902 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/item/crafting/SpecialRecipeSerializer.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/item/crafting/SpecialRecipeSerializer.java ++++ b/net/minecraft/item/crafting/SpecialRecipeSerializer.java +@@ -5,7 +5,7 @@ + import net.minecraft.network.PacketBuffer; + import net.minecraft.util.ResourceLocation; + +-public class SpecialRecipeSerializer> implements IRecipeSerializer { ++public class SpecialRecipeSerializer> extends net.minecraftforge.registries.ForgeRegistryEntry> implements IRecipeSerializer { + private final Function field_222176_t; + + public SpecialRecipeSerializer(Function p_i50024_1_) { diff --git a/patches_old/minecraft/net/minecraft/nbt/CompoundNBT.java.patch b/patches_old/minecraft/net/minecraft/nbt/CompoundNBT.java.patch new file mode 100644 index 000000000..eaca9d010 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/nbt/CompoundNBT.java.patch @@ -0,0 +1,32 @@ +--- a/net/minecraft/nbt/CompoundNBT.java ++++ b/net/minecraft/nbt/CompoundNBT.java +@@ -39,6 +39,7 @@ + while((b0 = CompoundNBT.func_152447_a(p_225649_1_, p_225649_3_)) != 0) { + String s = CompoundNBT.func_152448_b(p_225649_1_, p_225649_3_); + p_225649_3_.func_152450_a((long)(224 + 16 * s.length())); ++ p_225649_3_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. + INBT inbt = CompoundNBT.func_229680_b_(NBTTypes.func_229710_a_(b0), s, p_225649_1_, p_225649_2_ + 1, p_225649_3_); + if (map.put(s, inbt) != null) { + p_225649_3_.func_152450_a(288L); +@@ -94,6 +95,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_); + } + +@@ -410,11 +412,12 @@ + } + + 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(); + } + + private static String func_152448_b(DataInput p_152448_0_, NBTSizeTracker p_152448_1_) throws IOException { +- return p_152448_0_.readUTF(); ++ return p_152448_1_.readUTF(p_152448_0_.readUTF()); + } + + private static INBT func_229680_b_(INBTType p_229680_0_, String p_229680_1_, DataInput p_229680_2_, int p_229680_3_, NBTSizeTracker p_229680_4_) { diff --git a/patches_old/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches_old/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch new file mode 100644 index 000000000..cf6e70f88 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/nbt/CompressedStreamTools.java ++++ b/net/minecraft/nbt/CompressedStreamTools.java +@@ -110,10 +110,12 @@ + + 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 EndNBT.field_229686_b_; + } else { +- p_152455_0_.readUTF(); ++ p_152455_2_.readUTF(p_152455_0_.readUTF()); //Forge: Count this string. ++ p_152455_2_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. + + try { + return NBTTypes.func_229710_a_(b0).func_225649_b_(p_152455_0_, p_152455_1_, p_152455_2_); diff --git a/patches_old/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches_old/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch new file mode 100644 index 000000000..8bde6e848 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch @@ -0,0 +1,37 @@ +--- a/net/minecraft/nbt/NBTSizeTracker.java ++++ b/net/minecraft/nbt/NBTSizeTracker.java +@@ -18,4 +18,34 @@ + throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.field_152453_c + "bytes where max allowed: " + this.field_152452_b); + } + } ++ ++ /* ++ * UTF8 is not a simple encoding system, each character can be either ++ * 1, 2, or 3 bytes. Depending on where it's numerical value falls. ++ * We have to count up each character individually to see the true ++ * length of the data. ++ * ++ * Basic concept is that it uses the MSB of each byte as a 'read more' signal. ++ * So it has to shift each 7-bit segment. ++ * ++ * This will accurately count the correct byte length to encode this string, plus the 2 bytes for it's length prefix. ++ */ ++ public String readUTF(String data) { ++ func_152450_a(16); //Header length ++ if (data == null) ++ return data; ++ ++ int len = data.length(); ++ int utflen = 0; ++ ++ for (int i = 0; i < len; i++) { ++ int c = data.charAt(i); ++ if ((c >= 0x0001) && (c <= 0x007F)) utflen += 1; ++ else if (c > 0x07FF) utflen += 3; ++ else utflen += 2; ++ } ++ func_152450_a(8 * utflen); ++ ++ return data; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/nbt/StringNBT.java.patch b/patches_old/minecraft/net/minecraft/nbt/StringNBT.java.patch new file mode 100644 index 000000000..1a2c869e8 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/nbt/StringNBT.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/nbt/StringNBT.java ++++ b/net/minecraft/nbt/StringNBT.java +@@ -12,7 +12,7 @@ + public StringNBT func_225649_b_(DataInput p_225649_1_, int p_225649_2_, NBTSizeTracker p_225649_3_) throws IOException { + p_225649_3_.func_152450_a(288L); + String s = p_225649_1_.readUTF(); +- p_225649_3_.func_152450_a((long)(16 * s.length())); ++ p_225649_3_.readUTF(s); + return StringNBT.func_229705_a_(s); + } + diff --git a/patches_old/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches_old/minecraft/net/minecraft/network/NetworkManager.java.patch new file mode 100644 index 000000000..fd756db38 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -0,0 +1,60 @@ +--- a/net/minecraft/network/NetworkManager.java ++++ b/net/minecraft/network/NetworkManager.java +@@ -74,6 +74,7 @@ + private float field_211397_t; + private int field_211398_u; + private boolean field_211399_v; ++ private java.util.function.Consumer activationHandler; + + public NetworkManager(PacketDirection p_i46004_1_) { + this.field_179294_g = p_i46004_1_; +@@ -83,6 +84,7 @@ + super.channelActive(p_channelActive_1_); + this.field_150746_k = p_channelActive_1_.channel(); + this.field_150743_l = this.field_150746_k.remoteAddress(); ++ if (activationHandler != null) activationHandler.accept(this); + + try { + this.func_150723_a(ProtocolType.HANDSHAKING); +@@ -173,7 +175,7 @@ + ++this.field_211395_r; + if (protocoltype1 != protocoltype) { + field_150735_g.debug("Disabled auto read"); +- this.field_150746_k.config().setAutoRead(false); ++ this.field_150746_k.eventLoop().execute(()->this.field_150746_k.config().setAutoRead(false)); + } + + if (this.field_150746_k.eventLoop().inEventLoop()) { +@@ -257,7 +259,9 @@ + + @OnlyIn(Dist.CLIENT) + public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) { ++ if (p_181124_0_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false"); + final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND); ++ networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel; + Class oclass; + LazyValue lazyvalue; + if (Epoll.isAvailable() && p_181124_2_) { +@@ -285,6 +289,7 @@ + @OnlyIn(Dist.CLIENT) + public static NetworkManager func_150722_a(SocketAddress p_150722_0_) { + final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND); ++ networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel; + (new Bootstrap()).group(field_179296_e.func_179281_c()).handler(new ChannelInitializer() { + protected void initChannel(Channel p_initChannel_1_) throws Exception { + p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); +@@ -376,6 +381,14 @@ + return this.field_211397_t; + } + ++ public Channel channel() { ++ return field_150746_k; ++ } ++ ++ public PacketDirection getDirection() { ++ return this.field_179294_g; ++ } ++ + static class QueuedPacket { + private final IPacket field_150774_a; + @Nullable diff --git a/patches_old/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches_old/minecraft/net/minecraft/network/NetworkSystem.java.patch new file mode 100644 index 000000000..53b4733d3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -0,0 +1,34 @@ +--- a/net/minecraft/network/NetworkSystem.java ++++ b/net/minecraft/network/NetworkSystem.java +@@ -42,11 +42,12 @@ + + public class NetworkSystem { + private static final Logger field_151275_b = LogManager.getLogger(); ++ private static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("forge.readTimeout", "30")); + public static final LazyValue field_151276_c = new LazyValue<>(() -> { +- return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build()); ++ return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER).build()); + }); + public static final LazyValue field_181141_b = new LazyValue<>(() -> { +- return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).build()); ++ return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER).build()); + }); + private final MinecraftServer field_151273_d; + public volatile boolean field_151277_a; +@@ -59,6 +60,7 @@ + } + + public void func_151265_a(@Nullable InetAddress p_151265_1_, int p_151265_2_) throws IOException { ++ if (p_151265_1_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false"); + synchronized(this.field_151274_e) { + Class oclass; + LazyValue lazyvalue; +@@ -80,7 +82,7 @@ + ; + } + +- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(PacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(PacketDirection.CLIENTBOUND)); ++ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(PacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(PacketDirection.CLIENTBOUND)); + NetworkManager networkmanager = new NetworkManager(PacketDirection.SERVERBOUND); + NetworkSystem.this.field_151272_f.add(networkmanager); + p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); diff --git a/patches_old/minecraft/net/minecraft/network/PacketBuffer.java.patch b/patches_old/minecraft/net/minecraft/network/PacketBuffer.java.patch new file mode 100644 index 000000000..9b6d57a65 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/PacketBuffer.java.patch @@ -0,0 +1,45 @@ +--- a/net/minecraft/network/PacketBuffer.java ++++ b/net/minecraft/network/PacketBuffer.java +@@ -35,7 +35,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class PacketBuffer extends ByteBuf { ++public class PacketBuffer extends ByteBuf implements net.minecraftforge.common.extensions.IForgePacketBuffer { + private final ByteBuf field_150794_a; + + public PacketBuffer(ByteBuf p_i45154_1_) { +@@ -265,6 +265,15 @@ + } + + public PacketBuffer func_150788_a(ItemStack p_150788_1_) { ++ return writeItemStack(p_150788_1_, true); ++ } ++ ++ /** ++ * Most ItemStack serialization is Server to Client,and doesn't need to know the FULL tag details. ++ * One exception is items from the creative menu, which must be sent from Client to Server with their full NBT. ++ * If you want to send the FULL tag set limitedTag to false ++ */ ++ public PacketBuffer writeItemStack(ItemStack p_150788_1_, boolean limitedTag) { + if (p_150788_1_.func_190926_b()) { + this.writeBoolean(false); + } else { +@@ -274,7 +283,7 @@ + this.writeByte(p_150788_1_.func_190916_E()); + CompoundNBT compoundnbt = null; + if (item.func_77645_m() || item.func_77651_p()) { +- compoundnbt = p_150788_1_.func_77978_p(); ++ compoundnbt = limitedTag ? p_150788_1_.getShareTag() : p_150788_1_.func_77978_p(); + } + + this.func_150786_a(compoundnbt); +@@ -290,7 +299,7 @@ + int i = this.func_150792_a(); + int j = this.readByte(); + ItemStack itemstack = new ItemStack(Item.func_150899_d(i), j); +- itemstack.func_77982_d(this.func_150793_b()); ++ itemstack.readShareTag(this.func_150793_b()); + return itemstack; + } + } diff --git a/patches_old/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches_old/minecraft/net/minecraft/network/ServerStatusResponse.java.patch new file mode 100644 index 000000000..d1c68139d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -0,0 +1,109 @@ +--- a/net/minecraft/network/ServerStatusResponse.java ++++ b/net/minecraft/network/ServerStatusResponse.java +@@ -19,13 +19,24 @@ + private ServerStatusResponse.Players field_151324_b; + private ServerStatusResponse.Version field_151325_c; + private String field_151323_d; ++ private transient net.minecraftforge.fml.network.FMLStatusPing forgeData; + ++ public net.minecraftforge.fml.network.FMLStatusPing getForgeData() { ++ return this.forgeData; ++ } ++ ++ public void setForgeData(net.minecraftforge.fml.network.FMLStatusPing data){ ++ this.forgeData = data; ++ invalidateJson(); ++ } ++ + public ITextComponent func_151317_a() { + return this.field_151326_a; + } + + public void func_151315_a(ITextComponent p_151315_1_) { + this.field_151326_a = p_151315_1_; ++ invalidateJson(); + } + + public ServerStatusResponse.Players func_151318_b() { +@@ -34,6 +45,7 @@ + + public void func_151319_a(ServerStatusResponse.Players p_151319_1_) { + this.field_151324_b = p_151319_1_; ++ invalidateJson(); + } + + public ServerStatusResponse.Version func_151322_c() { +@@ -42,16 +54,51 @@ + + public void func_151321_a(ServerStatusResponse.Version p_151321_1_) { + this.field_151325_c = p_151321_1_; ++ invalidateJson(); + } + + public void func_151320_a(String p_151320_1_) { + this.field_151323_d = p_151320_1_; ++ invalidateJson(); + } + + public String func_151316_d() { + return this.field_151323_d; + } + ++ private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); ++ private String json = null; ++ /** ++ * Returns this object as a Json string. ++ * Converting to JSON if a cached version is not available. ++ * ++ * Also to prevent potentially large memory allocations on the server ++ * this is moved from the SPacketServerInfo writePacket function ++ * ++ * As this method is called from the network threads so thread safety is important! ++ */ ++ public String getJson() { ++ String ret = this.json; ++ if (ret == null) { ++ mutex.acquireUninterruptibly(); ++ ret = this.json; ++ if (ret == null) { ++ ret = net.minecraft.network.status.server.SServerInfoPacket.field_149297_a.toJson(this); ++ this.json = ret; ++ } ++ mutex.release(); ++ } ++ return ret; ++ } ++ ++ /** ++ * Invalidates the cached json, causing the next call to getJson to rebuild it. ++ * This is needed externally because PlayerCountData.setPlayer's is public. ++ */ ++ public void invalidateJson() { ++ this.json = null; ++ } ++ + public static class Players { + private final int field_151336_a; + private final int field_151334_b; +@@ -143,6 +190,10 @@ + serverstatusresponse.func_151320_a(JSONUtils.func_151200_h(jsonobject, "favicon")); + } + ++ if (jsonobject.has("forgeData")) { ++ serverstatusresponse.setForgeData(net.minecraftforge.fml.network.FMLStatusPing.Serializer.deserialize(JSONUtils.func_152754_s(jsonobject, "forgeData"), p_deserialize_3_)); ++ } ++ + return serverstatusresponse; + } + +@@ -164,6 +215,10 @@ + jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d()); + } + ++ if(p_serialize_1_.getForgeData() != null){ ++ jsonobject.add("forgeData", net.minecraftforge.fml.network.FMLStatusPing.Serializer.serialize(p_serialize_1_.getForgeData(), p_serialize_3_)); ++ } ++ + return jsonobject; + } + } diff --git a/patches_old/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch b/patches_old/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch new file mode 100644 index 000000000..b94bcaa2b --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/network/datasync/DataSerializers.java ++++ b/net/minecraft/network/datasync/DataSerializers.java +@@ -301,16 +301,16 @@ + }; + + public static void func_187189_a(IDataSerializer p_187189_0_) { +- field_187204_n.func_186808_c(p_187189_0_); ++ if (field_187204_n.func_186808_c(p_187189_0_) >= 256) throw new RuntimeException("Vanilla DataSerializer ID limit exceeded"); + } + + @Nullable + public static IDataSerializer func_187190_a(int p_187190_0_) { +- return field_187204_n.func_148745_a(p_187190_0_); ++ return net.minecraftforge.common.ForgeHooks.getSerializer(p_187190_0_, field_187204_n); + } + + public static int func_187188_b(IDataSerializer p_187188_0_) { +- return field_187204_n.func_186815_a(p_187188_0_); ++ return net.minecraftforge.common.ForgeHooks.getSerializerId(p_187188_0_, field_187204_n); + } + + static { diff --git a/patches_old/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch b/patches_old/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch new file mode 100644 index 000000000..c2ebd8ff1 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/network/datasync/EntityDataManager.java ++++ b/net/minecraft/network/datasync/EntityDataManager.java +@@ -36,11 +36,13 @@ + } + + 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 { + Class oclass = Class.forName(Thread.currentThread().getStackTrace()[2].getClassName()); + if (!oclass.equals(p_187226_0_)) { +- field_190303_a.debug("defineId called for: {} from {}", p_187226_0_, oclass, new RuntimeException()); ++ // Forge: log at warn, mods should not add to classes that they don't own, and only add stacktrace when in debug is enabled as it is mostly not needed and consumes time ++ if (field_190303_a.isDebugEnabled()) field_190303_a.warn("defineId called for: {} from {}", p_187226_0_, oclass, new RuntimeException()); ++ else field_190303_a.warn("defineId called for: {} from {}", p_187226_0_, oclass); + } + } catch (ClassNotFoundException var5) { + ; diff --git a/patches_old/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch b/patches_old/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch new file mode 100644 index 000000000..0e83ffd3d --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/network/handshake/client/CHandshakePacket.java.patch b/patches_old/minecraft/net/minecraft/network/handshake/client/CHandshakePacket.java.patch new file mode 100644 index 000000000..c0bd3b03d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/handshake/client/CHandshakePacket.java.patch @@ -0,0 +1,34 @@ +--- a/net/minecraft/network/handshake/client/CHandshakePacket.java ++++ b/net/minecraft/network/handshake/client/CHandshakePacket.java +@@ -14,6 +14,7 @@ + private String field_149598_b; + private int field_149599_c; + private ProtocolType field_149597_d; ++ private String fmlVersion = net.minecraftforge.fml.network.FMLNetworkConstants.NETVERSION; + + public CHandshakePacket() { + } +@@ -31,11 +32,13 @@ + this.field_149598_b = p_148837_1_.func_150789_c(255); + this.field_149599_c = p_148837_1_.readUnsignedShort(); + this.field_149597_d = ProtocolType.func_150760_a(p_148837_1_.func_150792_a()); ++ this.fmlVersion = net.minecraftforge.fml.network.NetworkHooks.getFMLVersion(this.field_149598_b); ++ this.field_149598_b = this.field_149598_b.split("\0")[0]; + } + + public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { + p_148840_1_.func_150787_b(this.field_149600_a); +- p_148840_1_.func_180714_a(this.field_149598_b); ++ p_148840_1_.func_180714_a(this.field_149598_b + "\0"+net.minecraftforge.fml.network.FMLNetworkConstants.NETVERSION+"\0"); + p_148840_1_.writeShort(this.field_149599_c); + p_148840_1_.func_150787_b(this.field_149597_d.func_150759_c()); + } +@@ -51,4 +54,8 @@ + public int func_149595_d() { + return this.field_149600_a; + } ++ ++ public String getFMLVersion() { ++ return this.fmlVersion; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/network/login/ServerLoginNetHandler.java.patch b/patches_old/minecraft/net/minecraft/network/login/ServerLoginNetHandler.java.patch new file mode 100644 index 000000000..7885213bd --- /dev/null +++ b/patches_old/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()); +@@ -128,7 +134,7 @@ + this.field_147328_g = ServerLoginNetHandler.State.KEY; + this.field_147333_a.func_179290_a(new SEncryptionRequestPacket("", this.field_147327_f.func_71250_E().getPublic(), this.field_147330_e)); + } else { +- this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; + } + + } +@@ -142,7 +148,7 @@ + this.field_147335_k = p_147315_1_.func_149300_a(privatekey); + this.field_147328_g = ServerLoginNetHandler.State.AUTHENTICATING; + this.field_147333_a.func_150727_a(this.field_147335_k); +- Thread thread = new Thread("User Authenticator #" + field_147331_b.incrementAndGet()) { ++ Thread thread = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, "User Authenticator #" + field_147331_b.incrementAndGet()) { + public void run() { + GameProfile gameprofile = ServerLoginNetHandler.this.field_147337_i; + +@@ -151,11 +157,11 @@ + ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.func_191235_a()); + if (ServerLoginNetHandler.this.field_147337_i != null) { + ServerLoginNetHandler.field_147332_c.info("UUID of player {} is {}", ServerLoginNetHandler.this.field_147337_i.getName(), ServerLoginNetHandler.this.field_147337_i.getId()); +- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; + } else if (ServerLoginNetHandler.this.field_147327_f.func_71264_H()) { + ServerLoginNetHandler.field_147332_c.warn("Failed to verify username but will let them in anyway!"); + ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.func_152506_a(gameprofile); +- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; + } else { + ServerLoginNetHandler.this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.unverified_username")); + ServerLoginNetHandler.field_147332_c.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName()); +@@ -164,7 +170,7 @@ + if (ServerLoginNetHandler.this.field_147327_f.func_71264_H()) { + ServerLoginNetHandler.field_147332_c.warn("Authentication servers are down but will let them in anyway!"); + ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.func_152506_a(gameprofile); +- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; + } else { + ServerLoginNetHandler.this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.authservers_down")); + ServerLoginNetHandler.field_147332_c.error("Couldn't verify username because servers are unavailable"); +@@ -185,6 +191,7 @@ + } + + public void func_209526_a(CCustomPayloadLoginPacket p_209526_1_) { ++ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209526_1_, this.field_147333_a)) + this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.unexpected_query_response")); + } + diff --git a/patches_old/minecraft/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java.patch b/patches_old/minecraft/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java.patch new file mode 100644 index 000000000..74a47fd28 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java.patch b/patches_old/minecraft/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java.patch new file mode 100644 index 000000000..f83916c0c --- /dev/null +++ b/patches_old/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/SLoginSuccessPacket.java.patch b/patches_old/minecraft/net/minecraft/network/login/server/SLoginSuccessPacket.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/network/login/server/SLoginSuccessPacket.java.patch rename to patches_old/minecraft/net/minecraft/network/login/server/SLoginSuccessPacket.java.patch diff --git a/patches_old/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch b/patches_old/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch new file mode 100644 index 000000000..a76cabf10 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch @@ -0,0 +1,62 @@ +--- a/net/minecraft/network/play/ServerPlayNetHandler.java ++++ b/net/minecraft/network/play/ServerPlayNetHandler.java +@@ -336,9 +336,11 @@ + } + + entity.func_70080_a(d3, d4, d5, f, f1); ++ this.field_147369_b.func_70080_a(d3, d4, d5, this.field_147369_b.field_70177_z, this.field_147369_b.field_70125_A); // Forge - Resync player position on vehicle moving + boolean flag2 = serverworld.func_226665_a__(entity, entity.func_174813_aQ().func_186664_h(0.0625D)); + if (flag && (flag1 || !flag2)) { + entity.func_70080_a(d0, d1, d2, f, f1); ++ this.field_147369_b.func_70080_a(d3, d4, d5, this.field_147369_b.field_70177_z, this.field_147369_b.field_70125_A); // Forge - Resync player position on vehicle moving + this.field_147371_a.func_179290_a(new SMoveVehiclePacket(entity)); + return; + } +@@ -845,7 +847,9 @@ + Direction direction = blockraytraceresult.func_216354_b(); + this.field_147369_b.func_143004_u(); + if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z() - 1 || direction != Direction.UP && blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) { +- if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && serverworld.func_175660_a(this.field_147369_b, blockpos)) { ++ double dist = field_147369_b.func_110148_a(net.minecraft.entity.player.PlayerEntity.REACH_DISTANCE).func_111126_e() + 3; ++ dist *= dist; ++ if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && serverworld.func_175660_a(this.field_147369_b, blockpos)) { + ActionResultType actionresulttype = this.field_147369_b.field_71134_c.func_219441_a(this.field_147369_b, serverworld, itemstack, hand, blockraytraceresult); + if (actionresulttype.func_226247_b_()) { + this.field_147369_b.func_226292_a_(hand, true); +@@ -968,7 +972,9 @@ + if (s.startsWith("/")) { + this.func_147361_d(s); + } else { +- ITextComponent itextcomponent = new TranslationTextComponent("chat.type.text", this.field_147369_b.func_145748_c_(), s); ++ ITextComponent itextcomponent = new TranslationTextComponent("chat.type.text", this.field_147369_b.func_145748_c_(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); ++ itextcomponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, itextcomponent); ++ if (itextcomponent == null) return; + this.field_147367_d.func_184103_al().func_148544_a(itextcomponent, false); + } + +@@ -1061,6 +1067,7 @@ + this.field_147369_b.func_190775_a(entity, hand); + } else if (p_147340_1_.func_149565_c() == CUseEntityPacket.Action.INTERACT_AT) { + Hand hand1 = p_147340_1_.func_186994_b(); ++ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), hand1) != null) return; + ActionResultType actionresulttype = entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), hand1); + if (actionresulttype.func_226247_b_()) { + this.field_147369_b.func_226292_a_(hand1, true); +@@ -1094,7 +1101,7 @@ + return; + } + +- this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, DimensionType.field_223227_a_, false); ++ this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, this.field_147369_b.field_71093_bK, false); + if (this.field_147367_d.func_71199_h()) { + this.field_147369_b.func_71033_a(GameType.SPECTATOR); + this.field_147369_b.func_71121_q().func_82736_K().func_223585_a(GameRules.field_223613_p).func_223570_a(false, this.field_147367_d); +@@ -1268,6 +1275,8 @@ + } + + public void func_147349_a(CCustomPayloadPacket p_147349_1_) { ++ PacketThreadUtil.func_218796_a(p_147349_1_, this, this.field_147369_b.func_71121_q()); ++ net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147349_1_, this.field_147371_a); + } + + public void func_217263_a(CSetDifficultyPacket p_217263_1_) { diff --git a/patches_old/minecraft/net/minecraft/network/play/client/CClickWindowPacket.java.patch b/patches_old/minecraft/net/minecraft/network/play/client/CClickWindowPacket.java.patch new file mode 100644 index 000000000..14348bc64 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/play/client/CClickWindowPacket.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/network/play/client/CClickWindowPacket.java ++++ b/net/minecraft/network/play/client/CClickWindowPacket.java +@@ -49,7 +49,7 @@ + p_148840_1_.writeByte(this.field_149553_c); + p_148840_1_.writeShort(this.field_149550_d); + p_148840_1_.func_179249_a(this.field_149549_f); +- p_148840_1_.func_150788_a(this.field_149551_e); ++ p_148840_1_.writeItemStack(this.field_149551_e, false); //Forge: Include full tag for C->S + } + + public int func_149548_c() { diff --git a/patches_old/minecraft/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java.patch b/patches_old/minecraft/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java.patch new file mode 100644 index 000000000..7a8874202 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java ++++ b/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java +@@ -32,7 +32,7 @@ + + public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { + p_148840_1_.writeShort(this.field_149629_a); +- p_148840_1_.func_150788_a(this.field_149628_b); ++ p_148840_1_.writeItemStack(this.field_149628_b, false); //Forge: Include full tag for C->S + } + + public int func_149627_c() { diff --git a/patches_old/minecraft/net/minecraft/network/play/client/CCustomPayloadPacket.java.patch b/patches_old/minecraft/net/minecraft/network/play/client/CCustomPayloadPacket.java.patch new file mode 100644 index 000000000..aa6f287f6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/play/client/CCustomPayloadPacket.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/network/play/client/CCustomPayloadPacket.java ++++ b/net/minecraft/network/play/client/CCustomPayloadPacket.java +@@ -9,7 +9,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class CCustomPayloadPacket implements IPacket { ++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 +35,7 @@ + + public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { + p_148840_1_.func_192572_a(this.field_149562_a); +- p_148840_1_.writeBytes((ByteBuf)this.field_149561_c); ++ p_148840_1_.writeBytes((ByteBuf)this.field_149561_c.copy()); //This may be access multiple times, from multiple threads, lets be safe like the S->C packet + } + + public void func_148833_a(IServerPlayNetHandler p_148833_1_) { diff --git a/patches_old/minecraft/net/minecraft/network/play/server/SCommandListPacket.java.patch b/patches_old/minecraft/net/minecraft/network/play/server/SCommandListPacket.java.patch new file mode 100644 index 000000000..34a406a83 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/play/server/SCommandListPacket.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/network/play/server/SCommandListPacket.java ++++ b/net/minecraft/network/play/server/SCommandListPacket.java +@@ -110,6 +110,9 @@ + String s = p_197695_1_.func_150789_c(32767); + ArgumentType argumenttype = ArgumentTypes.func_197486_a(p_197695_1_); + if (argumenttype == null) { ++ if ((p_197695_2_ & 16) != 0) { // FORGE: Flush unused suggestion data ++ p_197695_1_.func_192575_l(); ++ } + return null; + } else { + RequiredArgumentBuilder requiredargumentbuilder = RequiredArgumentBuilder.argument(s, argumenttype); diff --git a/patches_old/minecraft/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java.patch b/patches_old/minecraft/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java.patch new file mode 100644 index 000000000..dfe6a4754 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/network/play/server/SJoinGamePacket.java.patch b/patches_old/minecraft/net/minecraft/network/play/server/SJoinGamePacket.java.patch new file mode 100644 index 000000000..042734589 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/play/server/SJoinGamePacket.java.patch @@ -0,0 +1,28 @@ +--- a/net/minecraft/network/play/server/SJoinGamePacket.java ++++ b/net/minecraft/network/play/server/SJoinGamePacket.java +@@ -21,6 +21,7 @@ + private int field_218729_g; + private boolean field_179745_h; + private boolean field_229741_j_; ++ private int dimensionInt; + + public SJoinGamePacket() { + } +@@ -44,7 +45,7 @@ + this.field_149204_b = (i & 8) == 8; + i = i & -9; + this.field_149205_c = GameType.func_77146_a(i); +- this.field_149202_d = DimensionType.func_186069_a(p_148837_1_.readInt()); ++ this.dimensionInt = p_148837_1_.readInt(); + this.field_229740_b_ = p_148837_1_.readLong(); + this.field_149200_f = p_148837_1_.readUnsignedByte(); + this.field_149201_g = WorldType.func_77130_a(p_148837_1_.func_150789_c(16)); +@@ -100,7 +101,7 @@ + + @OnlyIn(Dist.CLIENT) + public DimensionType func_212642_e() { +- return this.field_149202_d; ++ return this.field_149202_d == null ? this.field_149202_d = net.minecraftforge.fml.network.NetworkHooks.getDummyDimType(this.dimensionInt) : this.field_149202_d; + } + + @OnlyIn(Dist.CLIENT) diff --git a/patches_old/minecraft/net/minecraft/network/play/server/SRespawnPacket.java.patch b/patches_old/minecraft/net/minecraft/network/play/server/SRespawnPacket.java.patch new file mode 100644 index 000000000..70c58689e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/play/server/SRespawnPacket.java.patch @@ -0,0 +1,28 @@ +--- a/net/minecraft/network/play/server/SRespawnPacket.java ++++ b/net/minecraft/network/play/server/SRespawnPacket.java +@@ -15,6 +15,7 @@ + private long field_229746_b_; + private GameType field_149087_c; + private WorldType field_149085_d; ++ private int dimensionInt; + + public SRespawnPacket() { + } +@@ -31,7 +32,7 @@ + } + + public void func_148837_a(PacketBuffer p_148837_1_) throws IOException { +- this.field_149088_a = DimensionType.func_186069_a(p_148837_1_.readInt()); ++ this.dimensionInt = p_148837_1_.readInt(); + this.field_229746_b_ = p_148837_1_.readLong(); + this.field_149087_c = GameType.func_77146_a(p_148837_1_.readUnsignedByte()); + this.field_149085_d = WorldType.func_77130_a(p_148837_1_.func_150789_c(16)); +@@ -50,7 +51,7 @@ + + @OnlyIn(Dist.CLIENT) + public DimensionType func_212643_b() { +- return this.field_149088_a; ++ return this.field_149088_a == null ? this.field_149088_a = net.minecraftforge.fml.network.NetworkHooks.getDummyDimType(this.dimensionInt) : this.field_149088_a; + } + + @OnlyIn(Dist.CLIENT) diff --git a/patches_old/minecraft/net/minecraft/network/status/server/SServerInfoPacket.java.patch b/patches_old/minecraft/net/minecraft/network/status/server/SServerInfoPacket.java.patch new file mode 100644 index 000000000..3eeb50c60 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/network/status/server/SServerInfoPacket.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/network/status/server/SServerInfoPacket.java ++++ b/net/minecraft/network/status/server/SServerInfoPacket.java +@@ -30,7 +30,7 @@ + } + + public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { +- p_148840_1_.func_180714_a(field_149297_a.toJson(this.field_149296_b)); ++ p_148840_1_.func_180714_a(this.field_149296_b.getJson()); //Forge: Let the response cache the JSON + } + + public void func_148833_a(IClientStatusNetHandler p_148833_1_) { diff --git a/patches_old/minecraft/net/minecraft/particles/BlockParticleData.java.patch b/patches_old/minecraft/net/minecraft/particles/BlockParticleData.java.patch new file mode 100644 index 000000000..0611b41a4 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/particles/BlockParticleData.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/particles/BlockParticleData.java ++++ b/net/minecraft/particles/BlockParticleData.java +@@ -45,4 +45,15 @@ + public BlockState func_197584_c() { + return this.field_197587_c; + } ++ ++ //FORGE: Add a source pos property, so we can provide models with additional model data ++ private net.minecraft.util.math.BlockPos pos; ++ public BlockParticleData setPos(net.minecraft.util.math.BlockPos pos) { ++ this.pos = pos; ++ return this; ++ } ++ ++ public net.minecraft.util.math.BlockPos getPos() { ++ return pos; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/particles/ItemParticleData.java.patch b/patches_old/minecraft/net/minecraft/particles/ItemParticleData.java.patch new file mode 100644 index 000000000..7181811a3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/particles/ItemParticleData.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/particles/ItemParticleData.java ++++ b/net/minecraft/particles/ItemParticleData.java +@@ -28,7 +28,7 @@ + + public ItemParticleData(ParticleType p_i47952_1_, ItemStack p_i47952_2_) { + this.field_197558_b = p_i47952_1_; +- this.field_197559_c = p_i47952_2_; ++ this.field_197559_c = p_i47952_2_.func_77946_l(); //Forge: Fix stack updating after the fact causing particle changes. + } + + public void func_197553_a(PacketBuffer p_197553_1_) { diff --git a/patches_old/minecraft/net/minecraft/particles/ParticleTypes.java.patch b/patches_old/minecraft/net/minecraft/particles/ParticleTypes.java.patch new file mode 100644 index 000000000..e0438e948 --- /dev/null +++ b/patches_old/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/PathNavigator.java.patch b/patches_old/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch rename to patches_old/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch diff --git a/patches_old/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch b/patches_old/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch new file mode 100644 index 000000000..012842b6d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/pathfinding/PathNodeType.java ++++ b/net/minecraft/pathfinding/PathNodeType.java +@@ -33,4 +33,13 @@ + public float func_186289_a() { + return this.field_186307_r; + } ++ ++ @javax.annotation.Nullable ++ public PathNodeType getDanger() { ++ return (this == DAMAGE_FIRE || this == DANGER_FIRE ) ? DANGER_FIRE : ++ (this == DAMAGE_CACTUS || this == DANGER_CACTUS) ? DANGER_CACTUS : ++ (this == DAMAGE_OTHER || this == DANGER_OTHER ) ? DANGER_OTHER : ++ (this == LAVA) ? DAMAGE_FIRE : ++ null; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch b/patches_old/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch new file mode 100644 index 000000000..f1d47f3df --- /dev/null +++ b/patches_old/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch @@ -0,0 +1,35 @@ +--- a/net/minecraft/pathfinding/WalkNodeProcessor.java ++++ b/net/minecraft/pathfinding/WalkNodeProcessor.java +@@ -383,16 +383,9 @@ + for(int j = -1; j <= 1; ++j) { + for(int k = -1; k <= 1; ++k) { + if (i != 0 || k != 0) { +- Block block = p_193578_0_.func_180495_p(blockpos$pooledmutable.func_181079_c(i + p_193578_1_, j + p_193578_2_, k + p_193578_3_)).func_177230_c(); +- if (block == Blocks.field_150434_aF) { +- p_193578_4_ = PathNodeType.DANGER_CACTUS; +- } else if (block != Blocks.field_150480_ab && block != Blocks.field_150353_l) { +- if (block == Blocks.field_222434_lW) { +- p_193578_4_ = PathNodeType.DANGER_OTHER; +- } +- } else { +- p_193578_4_ = PathNodeType.DANGER_FIRE; +- } ++ PathNodeType type = func_189553_b(p_193578_0_, p_193578_1_ + i, p_193578_2_ + j, p_193578_3_ + k).getDanger(); ++ if (type != null) ++ p_193578_4_ = type; + } + } + } +@@ -405,9 +398,11 @@ + protected static PathNodeType func_189553_b(IBlockReader p_189553_0_, int p_189553_1_, int p_189553_2_, int p_189553_3_) { + BlockPos blockpos = new BlockPos(p_189553_1_, p_189553_2_, p_189553_3_); + BlockState blockstate = p_189553_0_.func_180495_p(blockpos); ++ PathNodeType type = blockstate.getAiPathNodeType(p_189553_0_, blockpos); ++ if (type != null) return type; + Block block = blockstate.func_177230_c(); + Material material = blockstate.func_185904_a(); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(p_189553_0_, 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_old/minecraft/net/minecraft/potion/Effect.java.patch b/patches_old/minecraft/net/minecraft/potion/Effect.java.patch new file mode 100644 index 000000000..5608193c0 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/potion/Effect.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/potion/Effect.java ++++ b/net/minecraft/potion/Effect.java +@@ -18,7 +18,7 @@ + import net.minecraft.util.text.ITextComponent; + import net.minecraft.util.text.TranslationTextComponent; + +-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; diff --git a/patches_old/minecraft/net/minecraft/potion/EffectInstance.java.patch b/patches_old/minecraft/net/minecraft/potion/EffectInstance.java.patch new file mode 100644 index 000000000..50dd4ad31 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/potion/EffectInstance.java.patch @@ -0,0 +1,85 @@ +--- a/net/minecraft/potion/EffectInstance.java ++++ b/net/minecraft/potion/EffectInstance.java +@@ -9,7 +9,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-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; +@@ -64,6 +64,7 @@ + this.field_82724_e = p_230117_1_.field_82724_e; + this.field_188421_h = p_230117_1_.field_188421_h; + this.field_205349_i = p_230117_1_.field_205349_i; ++ this.curativeItems = p_230117_1_.curativeItems == null ? null : new java.util.ArrayList(p_230117_1_.curativeItems); + } + + public boolean func_199308_a(EffectInstance p_199308_1_) { +@@ -112,7 +113,7 @@ + } + + public Effect func_188419_a() { +- return this.field_188420_b; ++ return this.field_188420_b == null ? null : this.field_188420_b.delegate.get(); + } + + public int func_76459_b() { +@@ -231,11 +232,12 @@ + this.field_230115_j_.func_82719_a(compoundnbt); + p_230119_1_.func_218657_a("HiddenEffect", compoundnbt); + } ++ writeCurativeItems(p_230119_1_); + + } + + 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; + Effect effect = Effect.func_188412_a(i); + return effect == null ? null : func_230116_a_(effect, p_82722_0_); + } +@@ -259,7 +261,7 @@ + effectinstance = func_230116_a_(p_230116_0_, p_230116_1_.func_74775_l("HiddenEffect")); + } + +- return new EffectInstance(p_230116_0_, j, i < 0 ? 0 : i, flag, flag1, flag2, effectinstance); ++ return readCurativeItems(new EffectInstance(p_230116_0_, j, i < 0 ? 0 : i, flag, flag1, flag2, effectinstance), p_230116_1_); + } + + @OnlyIn(Dist.CLIENT) +@@ -274,6 +276,32 @@ + + 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(); + } ++ ++ //======================= 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. ++ this.curativeItems = func_188419_a().getCurativeItems(); ++ return this.curativeItems; ++ } ++ @Override ++ public void setCurativeItems(java.util.List curativeItems) { ++ this.curativeItems = curativeItems; ++ } ++ 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.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))); ++ } ++ effect.setCurativeItems(items); ++ } ++ ++ return effect; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/potion/Effects.java.patch b/patches_old/minecraft/net/minecraft/potion/Effects.java.patch new file mode 100644 index 000000000..7d0df2667 --- /dev/null +++ b/patches_old/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.server.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_old/minecraft/net/minecraft/potion/Potion.java.patch b/patches_old/minecraft/net/minecraft/potion/Potion.java.patch new file mode 100644 index 000000000..019651479 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/potion/Potion.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/potion/Potion.java ++++ b/net/minecraft/potion/Potion.java +@@ -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 String field_185179_d; + private final ImmutableList field_185180_e; + diff --git a/patches_old/minecraft/net/minecraft/potion/PotionBrewing.java.patch b/patches_old/minecraft/net/minecraft/potion/PotionBrewing.java.patch new file mode 100644 index 000000000..7de69e80c --- /dev/null +++ b/patches_old/minecraft/net/minecraft/potion/PotionBrewing.java.patch @@ -0,0 +1,72 @@ +--- a/net/minecraft/potion/PotionBrewing.java ++++ b/net/minecraft/potion/PotionBrewing.java +@@ -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); +- if (mixpredicate.field_185198_a == item && mixpredicate.field_185199_b.test(p_185206_1_)) { ++ if (mixpredicate.field_185198_a.get() == item && mixpredicate.field_185199_b.test(p_185206_1_)) { + return true; + } + } +@@ -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 == 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; + } + } +@@ -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), 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()), potion); + } + } + +@@ -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 == 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()); + } + } + } +@@ -212,15 +212,15 @@ + field_185213_a.add(new PotionBrewing.MixPredicate<>(p_193357_0_, Ingredient.func_199804_a(p_193357_1_), p_193357_2_)); + } + +- static class MixPredicate { +- private final T field_185198_a; ++ static class MixPredicate> { ++ private final net.minecraftforge.registries.IRegistryDelegate field_185198_a; + private final Ingredient field_185199_b; +- 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_) { +- this.field_185198_a = p_i47570_1_; ++ this.field_185198_a = p_i47570_1_.delegate; + this.field_185199_b = p_i47570_2_; +- this.field_185200_c = p_i47570_3_; ++ this.field_185200_c = p_i47570_3_.delegate; + } + } + } diff --git a/patches_old/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch b/patches_old/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch new file mode 100644 index 000000000..0c2d4a0ee --- /dev/null +++ b/patches_old/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch @@ -0,0 +1,24 @@ +--- a/net/minecraft/resources/IResourceManagerReloadListener.java ++++ b/net/minecraft/resources/IResourceManagerReloadListener.java +@@ -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 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/IResourcePack.java.patch b/patches_old/minecraft/net/minecraft/resources/IResourcePack.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/resources/IResourcePack.java.patch rename to patches_old/minecraft/net/minecraft/resources/IResourcePack.java.patch diff --git a/patches_old/minecraft/net/minecraft/resources/ResourcePackList.java.patch b/patches_old/minecraft/net/minecraft/resources/ResourcePackList.java.patch new file mode 100644 index 000000000..db3e5cf11 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/resources/ResourcePackList.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/resources/ResourcePackList.java ++++ b/net/minecraft/resources/ResourcePackList.java +@@ -48,7 +48,7 @@ + private void func_198986_e() { + List> list = Lists.newArrayList(this.field_198988_b.entrySet()); + this.field_198988_b.clear(); +- list.stream().sorted(Entry.comparingByKey()).forEachOrdered((p_198984_1_) -> { ++ list.stream().sorted(net.minecraftforge.fml.packs.ResourcePackLoader.getSorter()).forEachOrdered((p_198984_1_) -> { + ResourcePackInfo resourcepackinfo = (ResourcePackInfo)this.field_198988_b.put(p_198984_1_.getKey(), p_198984_1_.getValue()); + }); + } diff --git a/patches_old/minecraft/net/minecraft/resources/VanillaPack.java.patch b/patches_old/minecraft/net/minecraft/resources/VanillaPack.java.patch new file mode 100644 index 000000000..91b1519a3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/resources/VanillaPack.java.patch @@ -0,0 +1,39 @@ +--- a/net/minecraft/resources/VanillaPack.java ++++ b/net/minecraft/resources/VanillaPack.java +@@ -176,7 +176,7 @@ + + try { + URL url = VanillaPack.class.getResource(s); +- return func_223459_a(s, url) ? url.openStream() : null; ++ return func_223459_a(s, url) ? getExtraInputStream(p_195782_1_, s) : null; + } catch (IOException var6) { + return VanillaPack.class.getResourceAsStream(s); + } +@@ -192,7 +192,7 @@ + + @Nullable + protected InputStream func_200010_a(String p_200010_1_) { +- return VanillaPack.class.getResourceAsStream("/" + p_200010_1_); ++ return getExtraInputStream(ResourcePackType.SERVER_DATA, "/" + p_200010_1_); + } + + public boolean func_195764_b(ResourcePackType p_195764_1_, ResourceLocation p_195764_2_) { +@@ -232,4 +232,18 @@ + + public void close() { + } ++ ++ //Vanilla used to just grab from the classpath, this breaks dev environments, and Forge runtime ++ //as forge ships vanilla assets in an 'extra' jar with no classes. ++ //So find that extra jar using the .mcassetsroot marker. ++ private InputStream getExtraInputStream(ResourcePackType type, String resource) { ++ try { ++ FileSystem fs = field_217810_e.get(type); ++ if (fs != null) ++ return Files.newInputStream(fs.getPath(resource)); ++ return VanillaPack.class.getResourceAsStream(resource); ++ } catch (IOException e) { ++ return VanillaPack.class.getResourceAsStream(resource); ++ } ++ } + } diff --git a/patches_old/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches_old/minecraft/net/minecraft/server/MinecraftServer.java.patch new file mode 100644 index 000000000..8cf20075d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -0,0 +1,263 @@ +--- a/net/minecraft/server/MinecraftServer.java ++++ b/net/minecraft/server/MinecraftServer.java +@@ -196,7 +196,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_); + }); +@@ -221,6 +221,7 @@ + private final LootTableManager field_200256_aj = new LootTableManager(this.field_229734_an_); + private final AdvancementManager field_200257_ak = new AdvancementManager(); + private final FunctionManager field_200258_al = new FunctionManager(this); ++ private final net.minecraftforge.common.loot.LootModifierManager lootManager = new net.minecraftforge.common.loot.LootModifierManager(); + private final FrameTimer field_213215_ap = new FrameTimer(); + private boolean field_205745_an; + private boolean field_212205_ao; +@@ -249,6 +250,7 @@ + this.field_195576_ac.func_219534_a(this.field_200256_aj); + this.field_195576_ac.func_219534_a(this.field_200258_al); + this.field_195576_ac.func_219534_a(this.field_200257_ak); ++ field_195576_ac.func_219534_a(lootManager); + this.field_213217_au = Util.func_215072_e(); + this.field_71294_K = p_i50590_10_; + } +@@ -336,6 +338,8 @@ + this.func_200245_b(new TranslationTextComponent("menu.loadingLevel")); + SaveHandler savehandler = this.func_71254_M().func_197715_a(p_71247_1_, this); + this.func_175584_a(this.func_71270_I(), savehandler); ++ // Move factory creation earlier to prevent startupquery deadlock ++ IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11); + WorldInfo worldinfo = savehandler.func_75757_d(); + WorldSettings worldsettings; + if (worldinfo == null) { +@@ -357,13 +361,13 @@ + + worldinfo.func_230145_a_(this.getServerModName(), this.func_230045_q_().isPresent()); + this.func_195560_a(savehandler.func_75765_b(), worldinfo); +- IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11); + this.func_213194_a(savehandler, worldinfo, worldsettings, ichunkstatuslistener); + this.func_147139_a(this.func_147135_j(), true); + this.func_213186_a(ichunkstatuslistener); + } + + protected void func_213194_a(SaveHandler p_213194_1_, WorldInfo p_213194_2_, WorldSettings p_213194_3_, IChunkStatusListener p_213194_4_) { ++ net.minecraftforge.common.DimensionManager.fireRegister(); + if (this.func_71242_L()) { + p_213194_2_.func_176127_a(field_213219_c); + } +@@ -407,6 +411,7 @@ + if (dimensiontype != DimensionType.field_223227_a_) { + 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))); + } + + } +@@ -565,6 +570,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); +@@ -605,6 +611,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 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())); +@@ -636,9 +643,15 @@ + this.field_71304_b.func_219897_b(); + this.field_71296_Q = true; + } ++ net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStopping(this); ++ net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions + } else { ++ net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions + this.func_71228_a((CrashReport)null); + } ++ } catch (net.minecraftforge.fml.StartupQuery.AbortedException e) { ++ // ignore silently ++ net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions + } catch (Throwable throwable1) { + field_147145_h.error("Encountered an unexpected exception", throwable1); + CrashReport crashreport; +@@ -655,6 +668,7 @@ + field_147145_h.error("We were unable to save this crash report to disk."); + } + ++ net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions + this.func_71228_a(crashreport); + } finally { + try { +@@ -663,6 +677,7 @@ + } catch (Throwable throwable) { + field_147145_h.error("Exception stopping the server", throwable); + } finally { ++ net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStopped(this); + this.func_71240_o(); + } + +@@ -764,6 +779,7 @@ + + 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; + this.func_71190_q(p_71217_1_); + if (i - this.field_147142_T >= 5000000000L) { +@@ -778,6 +794,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 % 6000 == 0) { +@@ -805,6 +822,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(); + } + + protected void func_71190_q(BooleanSupplier p_71190_1_) { +@@ -812,7 +830,8 @@ + this.func_193030_aL().func_73660_a(); + this.field_71304_b.func_219895_b("levels"); + +- for(ServerWorld serverworld : this.func_212370_w()) { ++ for(ServerWorld serverworld : this.getWorldArray()) { ++ long tickStart = Util.func_211178_c(); + if (serverworld.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ || this.func_71255_r()) { + this.field_71304_b.func_194340_a(() -> { + return serverworld.func_72912_H().func_76065_j() + " " + Registry.field_212622_k.func_177774_c(serverworld.field_73011_w.func_186058_p()); +@@ -824,6 +843,7 @@ + } + + this.field_71304_b.func_76320_a("tick"); ++ net.minecraftforge.fml.hooks.BasicEventHooks.onPreWorldTick(serverworld); + + try { + serverworld.func_72835_b(p_71190_1_); +@@ -832,12 +852,16 @@ + serverworld.func_72914_a(crashreport); + throw new ReportedException(crashreport); + } ++ net.minecraftforge.fml.hooks.BasicEventHooks.onPostWorldTick(serverworld); + + this.field_71304_b.func_76319_b(); + this.field_71304_b.func_76319_b(); + } ++ perWorldTickTimes.computeIfAbsent(serverworld.func_201675_m().func_186058_p(), k -> new long[100])[this.field_71315_w % 100] = Util.func_211178_c() - tickStart; + } + ++ 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_219895_b("connection"); + this.func_147137_ag().func_151269_c(); + this.field_71304_b.func_219895_b("players"); +@@ -878,6 +902,7 @@ + OptionSpec optionspec10 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1); + OptionSpec optionspec11 = optionparser.accepts("serverId").withRequiredArg(); + OptionSpec optionspec12 = optionparser.nonOptions(); ++ optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); //Forge: Consume this argument, we use it in the launcher, and the client side. + + try { + OptionSet optionset = optionparser.parse(p_main_0_); +@@ -888,7 +913,7 @@ + + Path path = Paths.get("server.properties"); + ServerPropertiesProvider serverpropertiesprovider = new ServerPropertiesProvider(path); +- serverpropertiesprovider.func_219035_b(); ++ if (optionset.has(optionspec1) || !Files.exists(path)) serverpropertiesprovider.func_219035_b(); + Path path1 = Paths.get("eula.txt"); + ServerEula servereula = new ServerEula(path1); + if (optionset.has(optionspec1)) { +@@ -910,6 +935,10 @@ + GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); + PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(s, field_152367_a.getName())); + String s1 = Optional.ofNullable(optionset.valueOf(optionspec9)).orElse(serverpropertiesprovider.func_219034_a().field_219021_o); ++ if (s1 == null || s1.isEmpty() || new File(s, s1).getAbsolutePath().equals(new File(s).getAbsolutePath())) { ++ field_147145_h.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + s1); ++ return; ++ } + final DedicatedServer dedicatedserver = new DedicatedServer(new File(s), serverpropertiesprovider, DataFixesManager.func_210901_a(), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, playerprofilecache, LoggingChunkStatusListener::new, s1); + dedicatedserver.func_71224_l(optionset.valueOf(optionspec7)); + dedicatedserver.func_71208_b(optionset.valueOf(optionspec10)); +@@ -927,6 +956,7 @@ + Thread thread = new Thread("Server Shutdown Thread") { + public void run() { + dedicatedserver.func_71263_m(true); ++ LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end. + } + }; + thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(field_147145_h)); +@@ -971,7 +1001,7 @@ + } + + 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() { +@@ -1010,7 +1040,7 @@ + } + + public String getServerModName() { +- return "vanilla"; ++ return net.minecraftforge.fml.BrandingControl.getServerBranding(); + } + + public CrashReport func_71230_b(CrashReport p_71230_1_) { +@@ -1396,6 +1426,10 @@ + public FunctionManager func_193030_aL() { + return this.field_200258_al; + } ++ ++ public net.minecraftforge.common.loot.LootModifierManager getLootModifierManager() { ++ return lootManager; ++ } + + public void func_193031_aM() { + if (!this.func_213162_bc()) { +@@ -1567,6 +1601,31 @@ + + public abstract boolean func_213199_b(GameProfile p_213199_1_); + ++ private Map perWorldTickTimes = Maps.newIdentityHashMap(); ++ @Nullable ++ public long[] getTickTime(DimensionType dim) { ++ return perWorldTickTimes.get(dim); ++ } ++ ++ @Deprecated //Forge Internal use Only, You can screw up a lot of things if you mess with this map. ++ public synchronized Map forgeGetWorldMap() { ++ return this.field_71305_c; ++ } ++ private int worldArrayMarker = 0; ++ private int worldArrayLast = -1; ++ private ServerWorld[] worldArray; ++ @Deprecated //Forge Internal use Only, use to protect against concurrent modifications in the world tick loop. ++ public synchronized void markWorldsDirty() { ++ worldArrayMarker++; ++ } ++ private ServerWorld[] getWorldArray() { ++ if (worldArrayMarker == worldArrayLast && worldArray != null) ++ return worldArray; ++ worldArray = this.field_71305_c.values().stream().toArray(x -> new ServerWorld[x]); ++ worldArrayLast = worldArrayMarker; ++ return worldArray; ++ } ++ + public void func_223711_a(Path p_223711_1_) throws IOException { + Path path = p_223711_1_.resolve("levels"); + diff --git a/patches_old/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches_old/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch new file mode 100644 index 000000000..721e91509 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -0,0 +1,64 @@ +--- a/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/net/minecraft/server/dedicated/DedicatedServer.java +@@ -97,6 +97,7 @@ + public boolean func_71197_b() throws IOException { + Thread thread = new Thread("Server console handler") { + public void run() { ++ if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); + + String s3; +@@ -118,7 +119,9 @@ + field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); + } + ++ net.minecraftforge.fml.server.ServerModLoader.begin(this); + field_155771_h.info("Loading properties"); ++ this.field_71340_o.func_219033_a(properties -> ServerProperties.func_218985_a(java.nio.file.Paths.get("server.properties"))); + ServerProperties serverproperties = this.field_71340_o.func_219034_a(); + if (this.func_71264_H()) { + this.func_71189_e("127.0.0.1"); +@@ -175,6 +178,7 @@ + if (!PreYggdrasilConverter.func_219587_e(this)) { + return false; + } else { ++ net.minecraftforge.fml.server.ServerModLoader.end(); + this.func_184105_a(new DedicatedPlayerList(this)); + long i = Util.func_211178_c(); + String s = serverproperties.field_219022_p; +@@ -196,6 +200,7 @@ + SkullTileEntity.func_184293_a(this.func_152358_ax()); + SkullTileEntity.func_184294_a(this.func_147130_as()); + PlayerProfileCache.func_187320_a(this.func_71266_T()); ++ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; + field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I()); + JsonObject jsonobject = new JsonObject(); + if (worldtype == WorldType.field_77138_c) { +@@ -208,6 +213,7 @@ + long l = Util.func_211178_c() - i; + String s2 = String.format(Locale.ROOT, "%.3fs", (double)l / 1.0E9D); + field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s2); ++ this.field_211151_aa = Util.func_211177_b(); //Forge: Update server time to prevent watchdog/spaming during long load. + if (serverproperties.field_219027_u != null) { + this.func_200252_aR().func_223585_a(GameRules.field_223620_w).func_223570_a(serverproperties.field_219027_u, this); + } +@@ -233,7 +239,8 @@ + } + + Items.field_190931_a.func_150895_a(ItemGroup.field_78027_g, NonNullList.func_191196_a()); +- return true; ++ // <3 you Grum for this, saves us ~30 patch files! --^ ++ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this); + } + } + +@@ -547,4 +554,9 @@ + public boolean func_213199_b(GameProfile p_213199_1_) { + return false; + } ++ ++ @Override //Forge: Enable formated text for colors in console. ++ public void func_145747_a(net.minecraft.util.text.ITextComponent message) { ++ field_155771_h.info(message.func_150254_d()); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch b/patches_old/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch new file mode 100644 index 000000000..912daf292 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/server/dedicated/PropertyManager.java ++++ b/net/minecraft/server/dedicated/PropertyManager.java +@@ -38,7 +38,7 @@ + + public void func_218970_c(Path p_218970_1_) { + try (OutputStream outputstream = Files.newOutputStream(p_218970_1_)) { +- this.field_73672_b.store(outputstream, "Minecraft server properties"); ++ net.minecraftforge.common.util.SortedProperties.store(field_73672_b, outputstream, "Minecraft server properties"); + } catch (IOException var15) { + field_164440_a.error("Failed to store properties to file: " + p_218970_1_); + } diff --git a/patches_old/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch b/patches_old/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch new file mode 100644 index 000000000..89fee4eda --- /dev/null +++ b/patches_old/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/server/dedicated/ServerHangWatchdog.java ++++ b/net/minecraft/server/dedicated/ServerHangWatchdog.java +@@ -36,7 +36,7 @@ + ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean(); + ThreadInfo[] athreadinfo = threadmxbean.dumpAllThreads(true, true); + StringBuilder stringbuilder = new StringBuilder(); +- Error error = new Error(); ++ Error error = new Error(String.format("ServerHangWatchdog detected that a single server tick took %.2f seconds (should be max 0.05)", k / 1000F)); // Forge: don't just make a crash report with a seemingly-inexplicable Error + + for(ThreadInfo threadinfo : athreadinfo) { + if (threadinfo.getThreadId() == this.field_180249_b.func_213170_ax().getId()) { diff --git a/patches_old/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches_old/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch new file mode 100644 index 000000000..4e062f2c5 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -0,0 +1,23 @@ +--- a/net/minecraft/server/gui/MinecraftServerGui.java ++++ b/net/minecraft/server/gui/MinecraftServerGui.java +@@ -138,8 +138,10 @@ + return jpanel; + } + ++ private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1); + public void func_206931_a() { + this.field_206932_d.start(); ++ latch.countDown(); + } + + public void func_219050_b() { +@@ -154,6 +156,9 @@ + } + + public void func_164247_a(JTextArea p_164247_1_, JScrollPane p_164247_2_, String p_164247_3_) { ++ try { ++ latch.await(); ++ } catch (InterruptedException e){} //Prevent logging until after constructor has ended. + if (!SwingUtilities.isEventDispatchThread()) { + SwingUtilities.invokeLater(() -> { + this.func_164247_a(p_164247_1_, p_164247_2_, p_164247_3_); diff --git a/patches_old/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches_old/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch new file mode 100644 index 000000000..49f4f78f2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -0,0 +1,47 @@ +--- a/net/minecraft/server/integrated/IntegratedServer.java ++++ b/net/minecraft/server/integrated/IntegratedServer.java +@@ -64,6 +64,8 @@ + this.func_71237_c(p_71247_1_); + SaveHandler savehandler = this.func_71254_M().func_197715_a(p_71247_1_, this); + this.func_175584_a(this.func_71270_I(), savehandler); ++ // Move factory creation earlier to prevent startupquery deadlock ++ IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11); + WorldInfo worldinfo = savehandler.func_75757_d(); + if (worldinfo == null) { + worldinfo = new WorldInfo(this.field_71350_m, p_71247_2_); +@@ -73,7 +75,6 @@ + + worldinfo.func_230145_a_(this.getServerModName(), this.func_230045_q_().isPresent()); + this.func_195560_a(savehandler.func_75765_b(), worldinfo); +- IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11); + this.func_213194_a(savehandler, worldinfo, this.field_71350_m, ichunkstatuslistener); + if (this.func_71218_a(DimensionType.field_223227_a_).func_72912_H().func_176130_y() == null) { + this.func_147139_a(this.field_71349_l.field_71474_y.field_74318_M, true); +@@ -91,9 +92,10 @@ + this.func_71245_h(true); + field_147148_h.info("Generating keypair"); + this.func_71253_a(CryptManager.func_75891_b()); ++ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; + this.func_71247_a(this.func_71270_I(), this.func_71221_J(), this.field_71350_m.func_77160_d(), this.field_71350_m.func_77165_h(), this.field_71350_m.func_205391_j()); + this.func_71205_p(this.func_71214_G() + " - " + this.func_71218_a(DimensionType.field_223227_a_).func_72912_H().func_76065_j()); +- return true; ++ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this); + } + + public void func_71217_p(BooleanSupplier p_71217_1_) { +@@ -128,6 +130,7 @@ + } + + 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(); + } + +@@ -219,6 +222,7 @@ + } + + public void func_71263_m(boolean p_71263_1_) { ++ if (func_71278_l()) + 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_old/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches_old/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch new file mode 100644 index 000000000..ad0263ee0 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -0,0 +1,159 @@ +--- a/net/minecraft/server/management/PlayerInteractionManager.java ++++ b/net/minecraft/server/management/PlayerInteractionManager.java +@@ -77,7 +77,7 @@ + ++this.field_73100_i; + if (this.field_73097_j) { + BlockState blockstate = this.field_73092_a.func_180495_p(this.field_180241_i); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(field_73092_a, field_180241_i)) { + this.field_73097_j = false; + } else { + float f = this.func_229859_a_(blockstate, this.field_180241_i, this.field_73093_n); +@@ -88,7 +88,7 @@ + } + } else if (this.field_73088_d) { + BlockState blockstate1 = this.field_73092_a.func_180495_p(this.field_180240_f); +- if (blockstate1.func_196958_f()) { ++ if (blockstate1.isAir(field_73092_a, field_180240_f)) { + this.field_73092_a.func_175715_c(this.field_73090_b.func_145782_y(), this.field_180240_f, -1); + this.field_73094_o = -1; + this.field_73088_d = false; +@@ -116,7 +116,15 @@ + double d1 = this.field_73090_b.func_226278_cu_() - ((double)p_225416_1_.func_177956_o() + 0.5D) + 1.5D; + double d2 = this.field_73090_b.func_226281_cx_() - ((double)p_225416_1_.func_177952_p() + 0.5D); + double d3 = d0 * d0 + d1 * d1 + d2 * d2; +- if (d3 > 36.0D) { ++ double dist = field_73090_b.func_110148_a(net.minecraft.entity.player.PlayerEntity.REACH_DISTANCE).func_111126_e() + 1; ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(field_73090_b, p_225416_1_, p_225416_3_); ++ if (event.isCanceled() || (!this.func_73083_d() && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY)) { // Restore block and te data ++ field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "mod canceled")); ++ field_73092_a.func_184138_a(p_225416_1_, field_73092_a.func_180495_p(p_225416_1_), field_73092_a.func_180495_p(p_225416_1_), 3); ++ return; ++ } ++ dist *= dist; ++ if (d3 > dist) { + this.field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, this.field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "too far")); + } else if (p_225416_1_.func_177956_o() >= p_225416_4_) { + this.field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, this.field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "too high")); +@@ -146,12 +154,13 @@ + this.field_73089_e = this.field_73100_i; + float f = 1.0F; + BlockState blockstate = this.field_73092_a.func_180495_p(p_225416_1_); +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(field_73092_a, p_225416_1_)) { ++ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) + blockstate.func_196942_a(this.field_73092_a, p_225416_1_, this.field_73090_b); + f = blockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_225416_1_); + } + +- if (!blockstate.func_196958_f() && f >= 1.0F) { ++ if (!blockstate.isAir(field_73092_a, p_225416_1_) && f >= 1.0F) { + this.func_229860_a_(p_225416_1_, p_225416_2_, "insta mine"); + } else { + if (this.field_73088_d) { +@@ -214,7 +223,8 @@ + + public boolean func_180237_b(BlockPos p_180237_1_) { + BlockState blockstate = this.field_73092_a.func_180495_p(p_180237_1_); +- if (!this.field_73090_b.func_184614_ca().func_77973_b().func_195938_a(blockstate, this.field_73092_a, p_180237_1_, this.field_73090_b)) { ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_); ++ if (exp == -1) { + return false; + } else { + TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_); +@@ -222,38 +232,53 @@ + if ((block instanceof CommandBlockBlock || block instanceof StructureBlock || block instanceof JigsawBlock) && !this.field_73090_b.func_195070_dx()) { + this.field_73092_a.func_184138_a(p_180237_1_, blockstate, blockstate, 3); + return false; ++ } else if (field_73090_b.func_184614_ca().onBlockStartBreak(p_180237_1_, field_73090_b)) { ++ return false; + } else if (this.field_73090_b.func_223729_a(this.field_73092_a, p_180237_1_, this.field_73091_c)) { + return false; + } else { +- block.func_176208_a(this.field_73092_a, p_180237_1_, blockstate, this.field_73090_b); +- boolean flag = this.field_73092_a.func_217377_a(p_180237_1_, false); +- if (flag) { +- block.func_176206_d(this.field_73092_a, p_180237_1_, blockstate); +- } +- + if (this.func_73083_d()) { ++ removeBlock(p_180237_1_, false); + return true; + } else { + ItemStack itemstack = this.field_73090_b.func_184614_ca(); + ItemStack itemstack1 = itemstack.func_77946_l(); +- boolean flag1 = this.field_73090_b.func_184823_b(blockstate); ++ ++ boolean flag1 = blockstate.canHarvestBlock(this.field_73092_a, p_180237_1_, this.field_73090_b); + itemstack.func_179548_a(this.field_73092_a, blockstate, p_180237_1_, this.field_73090_b); ++ if (itemstack.func_190926_b() && !itemstack1.func_190926_b()) ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, itemstack1, Hand.MAIN_HAND); ++ boolean flag = removeBlock(p_180237_1_, flag1); ++ + if (flag && flag1) { + block.func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, blockstate, tileentity, itemstack1); + } + ++ if (flag && exp > 0) ++ blockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); ++ + return true; + } + } + } + } + ++ private boolean removeBlock(BlockPos p_180235_1_, boolean canHarvest) { ++ BlockState state = this.field_73092_a.func_180495_p(p_180235_1_); ++ boolean removed = state.removedByPlayer(this.field_73092_a, p_180235_1_, this.field_73090_b, canHarvest, this.field_73092_a.func_204610_c(p_180235_1_)); ++ if (removed) ++ state.func_177230_c().func_176206_d(this.field_73092_a, p_180235_1_, state); ++ return removed; ++ } ++ + public ActionResultType func_187250_a(PlayerEntity p_187250_1_, World p_187250_2_, ItemStack p_187250_3_, Hand p_187250_4_) { + if (this.field_73091_c == GameType.SPECTATOR) { + return ActionResultType.PASS; + } else if (p_187250_1_.func_184811_cZ().func_185141_a(p_187250_3_.func_77973_b())) { + return ActionResultType.PASS; + } else { ++ ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_); ++ if (cancelResult != null) return cancelResult; + int i = p_187250_3_.func_190916_E(); + int j = p_187250_3_.func_77952_i(); + ActionResult actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_); +@@ -287,6 +312,8 @@ + public ActionResultType func_219441_a(PlayerEntity p_219441_1_, World p_219441_2_, ItemStack p_219441_3_, Hand p_219441_4_, BlockRayTraceResult p_219441_5_) { + BlockPos blockpos = p_219441_5_.func_216350_a(); + BlockState blockstate = p_219441_2_.func_180495_p(blockpos); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(p_219441_1_, p_219441_4_, blockpos, p_219441_5_.func_216354_b()); ++ if (event.isCanceled()) return event.getCancellationResult(); + if (this.field_73091_c == GameType.SPECTATOR) { + INamedContainerProvider inamedcontainerprovider = blockstate.func_215699_b(p_219441_2_, blockpos); + if (inamedcontainerprovider != null) { +@@ -296,9 +323,14 @@ + return ActionResultType.PASS; + } + } else { + ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_); + if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { + ActionResultType result = p_219441_3_.onItemUseFirst(itemusecontext); + if (result != ActionResultType.PASS) return result; + } + boolean flag = !p_219441_1_.func_184614_ca().func_190926_b() || !p_219441_1_.func_184592_cb().func_190926_b(); +- boolean flag1 = p_219441_1_.func_226563_dT_() && flag; +- if (!flag1) { ++ boolean flag1 = (p_219441_1_.func_226563_dT_() && flag) && !(p_219441_1_.func_184614_ca().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_) && p_219441_1_.func_184592_cb().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_)); ++ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1) { + ActionResultType actionresulttype = blockstate.func_227031_a_(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_); + if (actionresulttype.func_226246_a_()) { + return actionresulttype; +@@ -306,7 +338,7 @@ + } + + if (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b())) { +- ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_); ++ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return ActionResultType.PASS; + if (this.func_73083_d()) { + int i = p_219441_3_.func_190916_E(); + ActionResultType actionresulttype1 = p_219441_3_.func_196084_a(itemusecontext); diff --git a/patches_old/minecraft/net/minecraft/server/management/PlayerList.java.patch b/patches_old/minecraft/net/minecraft/server/management/PlayerList.java.patch new file mode 100644 index 000000000..993a5fb4f --- /dev/null +++ b/patches_old/minecraft/net/minecraft/server/management/PlayerList.java.patch @@ -0,0 +1,181 @@ +--- a/net/minecraft/server/management/PlayerList.java ++++ b/net/minecraft/server/management/PlayerList.java +@@ -94,6 +94,7 @@ + private GameType field_72410_m; + private boolean field_72407_n; + private int field_72408_o; ++ private final List playersView = java.util.Collections.unmodifiableList(field_72404_b); + + public PlayerList(MinecraftServer p_i50688_1_, int p_i50688_2_) { + this.field_72400_f = p_i50688_1_; +@@ -109,7 +110,15 @@ + String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName(); + playerprofilecache.func_152649_a(gameprofile); + CompoundNBT compoundnbt = this.func_72380_a(p_72355_2_); +- ServerWorld serverworld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); ++ ++ //Forge: Make sure the dimension hasn't been deleted, if so stick them in the overworld. ++ ServerWorld serverworld = p_72355_2_.field_71093_bK != null ? this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK) : null ; ++ if (serverworld == null) { ++ p_72355_2_.field_71093_bK = DimensionType.field_223227_a_; ++ serverworld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); ++ p_72355_2_.func_70107_b(serverworld.func_72912_H().func_76079_c(), serverworld.func_72912_H().func_76075_d(), serverworld.func_72912_H().func_76074_e()); ++ } ++ + p_72355_2_.func_70029_a(serverworld); + p_72355_2_.field_71134_c.func_73080_a((ServerWorld)p_72355_2_.field_70170_p); + String s1 = "local"; +@@ -121,6 +130,8 @@ + WorldInfo worldinfo = serverworld.func_72912_H(); + this.func_72381_a(p_72355_2_, (ServerPlayerEntity)null, serverworld); + ServerPlayNetHandler serverplaynethandler = new ServerPlayNetHandler(this.field_72400_f, p_72355_1_, p_72355_2_); ++ net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(p_72355_1_, "PLAY_TO_CLIENT"); ++ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(p_72355_1_, p_72355_2_); + GameRules gamerules = serverworld.func_82736_K(); + boolean flag = gamerules.func_223586_b(GameRules.field_226683_z_); + boolean flag1 = gamerules.func_223586_b(GameRules.field_223612_o); +@@ -145,7 +156,7 @@ + + this.func_148539_a(itextcomponent.func_211708_a(TextFormatting.YELLOW)); + serverplaynethandler.func_147364_a(p_72355_2_.func_226277_ct_(), p_72355_2_.func_226278_cu_(), p_72355_2_.func_226281_cx_(), p_72355_2_.field_70177_z, p_72355_2_.field_70125_A); +- this.field_72404_b.add(p_72355_2_); ++ this.addPlayer(p_72355_2_); + this.field_177454_f.put(p_72355_2_.func_110124_au(), p_72355_2_); + this.func_148540_a(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, p_72355_2_)); + +@@ -166,8 +177,9 @@ + + if (compoundnbt != null && compoundnbt.func_150297_b("RootVehicle", 10)) { + CompoundNBT compoundnbt1 = compoundnbt.func_74775_l("RootVehicle"); ++ final ServerWorld worldf = serverworld; + Entity entity1 = EntityType.func_220335_a(compoundnbt1.func_74775_l("Entity"), serverworld, (p_217885_1_) -> { +- return !serverworld.func_217470_d(p_217885_1_) ? null : p_217885_1_; ++ return !worldf.func_217470_d(p_217885_1_) ? null : p_217885_1_; + }); + if (entity1 != null) { + UUID uuid = compoundnbt1.func_186857_a("Attach"); +@@ -194,6 +206,7 @@ + } + + p_72355_2_.func_71116_b(); ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedIn( p_72355_2_ ); + } + + protected void func_96456_a(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) { +@@ -255,6 +268,7 @@ + compoundnbt1 = compoundnbt; + p_72380_1_.func_70020_e(compoundnbt); + field_148546_d.debug("loading single player"); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.field_72412_k, p_72380_1_.func_110124_au().toString()); + } else { + compoundnbt1 = this.field_72412_k.func_75752_b(p_72380_1_); + } +@@ -263,6 +277,7 @@ + } + + protected void func_72391_b(ServerPlayerEntity p_72391_1_) { ++ if (p_72391_1_.field_71135_a == null) return; + this.field_72412_k.func_75753_a(p_72391_1_); + ServerStatisticsManager serverstatisticsmanager = this.field_148547_k.get(p_72391_1_.func_110124_au()); + if (serverstatisticsmanager != null) { +@@ -277,6 +292,7 @@ + } + + public void func_72367_e(ServerPlayerEntity p_72367_1_) { ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedOut(p_72367_1_); + ServerWorld serverworld = p_72367_1_.func_71121_q(); + p_72367_1_.func_195066_a(Stats.field_75947_j); + this.func_72391_b(p_72367_1_); +@@ -298,7 +314,7 @@ + p_72367_1_.func_213319_R(); + serverworld.func_217434_e(p_72367_1_); + p_72367_1_.func_192039_O().func_192745_a(); +- this.field_72404_b.remove(p_72367_1_); ++ this.removePlayer(p_72367_1_); + this.field_72400_f.func_201300_aS().func_201382_b(p_72367_1_); + UUID uuid = p_72367_1_.func_110124_au(); + ServerPlayerEntity serverplayerentity = this.field_177454_f.get(uuid); +@@ -367,10 +383,18 @@ + } + + public ServerPlayerEntity func_72368_a(ServerPlayerEntity p_72368_1_, DimensionType p_72368_2_, boolean p_72368_3_) { +- this.field_72404_b.remove(p_72368_1_); +- p_72368_1_.func_71121_q().func_217434_e(p_72368_1_); +- BlockPos blockpos = p_72368_1_.func_180470_cg(); +- boolean flag = p_72368_1_.func_82245_bX(); ++ ServerWorld world = field_72400_f.func_71218_a(p_72368_2_); ++ if (world == null) ++ p_72368_2_ = p_72368_1_.getSpawnDimension(); ++ else if (!world.func_201675_m().func_76567_e()) ++ p_72368_2_ = world.func_201675_m().getRespawnDimension(p_72368_1_); ++ if (field_72400_f.func_71218_a(p_72368_2_) == null) ++ p_72368_2_ = DimensionType.field_223227_a_; ++ ++ this.removePlayer(p_72368_1_); ++ p_72368_1_.func_71121_q().removePlayer(p_72368_1_, true); // Forge: keep data until copyFrom called ++ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_); ++ boolean flag = p_72368_1_.isSpawnForced(p_72368_2_); + p_72368_1_.field_71093_bK = p_72368_2_; + PlayerInteractionManager playerinteractionmanager; + if (this.field_72400_f.func_71242_L()) { +@@ -382,6 +406,8 @@ + ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager); + serverplayerentity.field_71135_a = p_72368_1_.field_71135_a; + serverplayerentity.func_193104_a(p_72368_1_, p_72368_3_); ++ p_72368_1_.remove(false); // Forge: clone event had a chance to see old data, now discard it ++ serverplayerentity.field_71093_bK = p_72368_2_; + serverplayerentity.func_145769_d(p_72368_1_.func_145782_y()); + serverplayerentity.func_184819_a(p_72368_1_.func_184591_cq()); + +@@ -396,7 +422,7 @@ + if (optional.isPresent()) { + Vec3d vec3d = optional.get(); + serverplayerentity.func_70012_b(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 0.0F, 0.0F); +- serverplayerentity.func_226560_a_(blockpos, flag, false); ++ serverplayerentity.setSpawnPoint(blockpos, flag, false, p_72368_2_); + } else { + serverplayerentity.field_71135_a.func_147359_a(new SChangeGameStatePacket(0, 0.0F)); + } +@@ -407,6 +433,7 @@ + } + + WorldInfo worldinfo = serverplayerentity.field_70170_p.func_72912_H(); ++ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(serverplayerentity.field_71135_a.field_147371_a, serverplayerentity); + serverplayerentity.field_71135_a.func_147359_a(new SRespawnPacket(serverplayerentity.field_71093_bK, WorldInfo.func_227498_c_(worldinfo.func_76063_b()), worldinfo.func_76067_t(), serverplayerentity.field_71134_c.func_73081_b())); + BlockPos blockpos1 = serverworld.func_175694_M(); + serverplayerentity.field_71135_a.func_147364_a(serverplayerentity.func_226277_ct_(), serverplayerentity.func_226278_cu_(), serverplayerentity.func_226281_cx_(), serverplayerentity.field_70177_z, serverplayerentity.field_70125_A); +@@ -416,10 +443,11 @@ + this.func_72354_b(serverplayerentity, serverworld); + this.func_187243_f(serverplayerentity); + serverworld.func_217433_d(serverplayerentity); +- this.field_72404_b.add(serverplayerentity); ++ this.addPlayer(serverplayerentity); + this.field_177454_f.put(serverplayerentity.func_110124_au(), serverplayerentity); + serverplayerentity.func_71116_b(); + serverplayerentity.func_70606_j(serverplayerentity.func_110143_aJ()); ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent(serverplayerentity, p_72368_3_); + return serverplayerentity; + } + +@@ -739,7 +767,7 @@ + } + + public List func_181057_v() { +- return this.field_72404_b; ++ return this.playersView; //Unmodifiable view, we don't want people removing things without us knowing. + } + + @Nullable +@@ -769,4 +797,12 @@ + public boolean func_206257_x() { + return this.field_72407_n; + } ++ ++ public boolean addPlayer(ServerPlayerEntity player) { ++ return net.minecraftforge.common.DimensionManager.rebuildPlayerMap(this, this.field_72404_b.add(player)); ++ } ++ ++ public boolean removePlayer(ServerPlayerEntity player) { ++ return net.minecraftforge.common.DimensionManager.rebuildPlayerMap(this, this.field_72404_b.remove(player)); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/stats/StatType.java.patch b/patches_old/minecraft/net/minecraft/stats/StatType.java.patch new file mode 100644 index 000000000..a2c7f74f4 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/stats/StatType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/stats/StatType.java ++++ b/net/minecraft/stats/StatType.java +@@ -7,7 +7,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class StatType implements Iterable> { ++public class StatType extends net.minecraftforge.registries.ForgeRegistryEntry> implements Iterable> { + private final Registry field_199082_a; + private final Map> field_199083_b = new IdentityHashMap<>(); + diff --git a/patches_old/minecraft/net/minecraft/tags/BlockTags.java.patch b/patches_old/minecraft/net/minecraft/tags/BlockTags.java.patch new file mode 100644 index 000000000..c8762c1a6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tags/BlockTags.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/tags/BlockTags.java ++++ b/net/minecraft/tags/BlockTags.java +@@ -76,6 +76,10 @@ + return field_199899_c; + } + ++ public static int getGeneration() { ++ return field_199900_d; ++ } ++ + private static Tag func_199894_a(String p_199894_0_) { + return new BlockTags.Wrapper(new ResourceLocation(p_199894_0_)); + } diff --git a/patches/minecraft/net/minecraft/tags/FluidTags.java.patch b/patches_old/minecraft/net/minecraft/tags/FluidTags.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/tags/FluidTags.java.patch rename to patches_old/minecraft/net/minecraft/tags/FluidTags.java.patch diff --git a/patches_old/minecraft/net/minecraft/tags/ItemTags.java.patch b/patches_old/minecraft/net/minecraft/tags/ItemTags.java.patch new file mode 100644 index 000000000..2764b38c2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tags/ItemTags.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/tags/ItemTags.java ++++ b/net/minecraft/tags/ItemTags.java +@@ -62,6 +62,10 @@ + return field_199906_c; + } + ++ public static int getGeneration() { ++ return field_199907_d; ++ } ++ + private static Tag func_199901_a(String p_199901_0_) { + return new ItemTags.Wrapper(new ResourceLocation(p_199901_0_)); + } diff --git a/patches_old/minecraft/net/minecraft/tags/NetworkTagManager.java.patch b/patches_old/minecraft/net/minecraft/tags/NetworkTagManager.java.patch new file mode 100644 index 000000000..563dda411 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tags/NetworkTagManager.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/tags/NetworkTagManager.java ++++ b/net/minecraft/tags/NetworkTagManager.java +@@ -69,6 +69,7 @@ + ItemTags.func_199902_a(this.field_199720_b); + FluidTags.func_206953_a(this.field_205705_c); + EntityTypeTags.func_219759_a(this.field_215299_d); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this)); + }, p_215226_6_); + } + diff --git a/patches_old/minecraft/net/minecraft/tags/TagCollection.java.patch b/patches_old/minecraft/net/minecraft/tags/TagCollection.java.patch new file mode 100644 index 000000000..ca95d1454 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tags/TagCollection.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/tags/TagCollection.java ++++ b/net/minecraft/tags/TagCollection.java +@@ -154,4 +154,8 @@ + public Map> func_200039_c() { + return this.field_199921_d; + } ++ ++ public Function> getEntryLookup() { ++ return this.field_200040_e; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/tileentity/BannerPattern.java.patch b/patches_old/minecraft/net/minecraft/tileentity/BannerPattern.java.patch new file mode 100644 index 000000000..a2e4469c2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tileentity/BannerPattern.java.patch @@ -0,0 +1,26 @@ +--- a/net/minecraft/tileentity/BannerPattern.java ++++ b/net/minecraft/tileentity/BannerPattern.java +@@ -14,7 +14,7 @@ + import net.minecraftforge.api.distmarker.OnlyIn; + import org.apache.commons.lang3.tuple.Pair; + +-public enum BannerPattern { ++public enum BannerPattern implements net.minecraftforge.common.IExtensibleEnum { + BASE("base", "b"), + SQUARE_BOTTOM_LEFT("square_bottom_left", "bl", " ", " ", "# "), + SQUARE_BOTTOM_RIGHT("square_bottom_right", "br", " ", " ", " #"), +@@ -107,6 +107,14 @@ + return null; + } + ++ public static BannerPattern create(String enumName, String p_i47246_3_, String p_i47246_4_, ItemStack p_i47246_5_) { ++ throw new IllegalStateException("Enum not extended"); ++ } ++ ++ public static BannerPattern create(String enumName, String p_i47247_3_, String p_i47247_4_, String p_i47247_5_, String p_i47247_6_, String p_i47247_7_) { ++ throw new IllegalStateException("Enum not extended"); ++ } ++ + public static class Builder { + private final List> field_222478_a = Lists.newArrayList(); + diff --git a/patches_old/minecraft/net/minecraft/tileentity/BrewingStandTileEntity.java.patch b/patches_old/minecraft/net/minecraft/tileentity/BrewingStandTileEntity.java.patch new file mode 100644 index 000000000..1e2043135 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tileentity/BrewingStandTileEntity.java.patch @@ -0,0 +1,76 @@ +--- a/net/minecraft/tileentity/BrewingStandTileEntity.java ++++ b/net/minecraft/tileentity/BrewingStandTileEntity.java +@@ -146,6 +146,7 @@ + + private boolean func_145934_k() { + ItemStack itemstack = this.field_145945_j.get(3); ++ if (!itemstack.func_190926_b()) return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(field_145945_j, itemstack, field_145947_i); // divert to VanillaBrewingRegistry + if (itemstack.func_190926_b()) { + return false; + } else if (!PotionBrewing.func_185205_a(itemstack)) { +@@ -163,16 +164,16 @@ + } + + private void func_145940_l() { ++ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBrew(field_145945_j)) return; + ItemStack itemstack = this.field_145945_j.get(3); + +- for(int i = 0; i < 3; ++i) { +- this.field_145945_j.set(i, PotionBrewing.func_185212_d(itemstack, this.field_145945_j.get(i))); +- } ++ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, itemstack, field_145947_i); + + itemstack.func_190918_g(1); ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j); + BlockPos blockpos = this.func_174877_v(); +- if (itemstack.func_77973_b().func_77634_r()) { +- ItemStack itemstack1 = new ItemStack(itemstack.func_77973_b().func_77668_q()); ++ if (itemstack.hasContainerItem()) { ++ ItemStack itemstack1 = itemstack.getContainerItem(); + if (itemstack.func_190926_b()) { + itemstack = itemstack1; + } else if (!this.field_145850_b.field_72995_K) { +@@ -229,13 +230,13 @@ + + public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { + if (p_94041_1_ == 3) { +- return PotionBrewing.func_185205_a(p_94041_2_); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_94041_2_); + } else { + Item item = p_94041_2_.func_77973_b(); + if (p_94041_1_ == 4) { + return item == Items.field_151065_br; + } else { +- return (item == Items.field_151068_bn || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.field_151069_bo) && this.func_70301_a(p_94041_1_).func_190926_b(); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_94041_2_) && this.func_70301_a(p_94041_1_).func_190926_b(); + } + } + } +@@ -267,4 +268,27 @@ + protected Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_) { + return new BrewingStandContainer(p_213906_1_, p_213906_2_, this, this.field_213954_a); + } ++ ++ net.minecraftforge.common.util.LazyOptional[] 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/ConduitTileEntity.java.patch b/patches_old/minecraft/net/minecraft/tileentity/ConduitTileEntity.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/tileentity/ConduitTileEntity.java.patch rename to patches_old/minecraft/net/minecraft/tileentity/ConduitTileEntity.java.patch diff --git a/patches_old/minecraft/net/minecraft/tileentity/IChestLid.java.patch b/patches_old/minecraft/net/minecraft/tileentity/IChestLid.java.patch new file mode 100644 index 000000000..4664150e3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tileentity/IChestLid.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/tileentity/IChestLid.java ++++ b/net/minecraft/tileentity/IChestLid.java +@@ -3,7 +3,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-@OnlyIn(Dist.CLIENT) + public interface IChestLid { ++ @OnlyIn(Dist.CLIENT) + float func_195480_a(float p_195480_1_); + } diff --git a/patches_old/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch b/patches_old/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch new file mode 100644 index 000000000..f73a95fca --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch @@ -0,0 +1,25 @@ +--- a/net/minecraft/tileentity/LockableTileEntity.java ++++ b/net/minecraft/tileentity/LockableTileEntity.java +@@ -80,4 +80,22 @@ + } + + 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() { ++ return new net.minecraftforge.items.wrapper.InvWrapper(this); ++ } ++ ++ @javax.annotation.Nullable ++ 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(); ++ return super.getCapability(cap, side); ++ } ++ ++ @Override ++ public void func_145843_s() { ++ super.func_145843_s(); ++ itemHandler.invalidate(); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch b/patches_old/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch new file mode 100644 index 000000000..201050a88 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/tileentity/ShulkerBoxTileEntity.java ++++ b/net/minecraft/tileentity/ShulkerBoxTileEntity.java +@@ -280,6 +280,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_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch new file mode 100644 index 000000000..d8048f17b --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -0,0 +1,74 @@ +--- a/net/minecraft/tileentity/TileEntity.java ++++ b/net/minecraft/tileentity/TileEntity.java +@@ -16,7 +16,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-public abstract class TileEntity { ++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; + @Nullable +@@ -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_; ++ this.gatherCapabilities(); + } + + @Nullable +@@ -47,6 +50,8 @@ + + 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 CompoundNBT func_189515_b(CompoundNBT p_189515_1_) { +@@ -62,6 +67,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_218657_a("ForgeData", this.customTileData); ++ if (getCapabilities() != null) p_189516_1_.func_218657_a("ForgeCaps", serializeCaps()); + return p_189516_1_; + } + } +@@ -94,7 +101,7 @@ + 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); +- if (!this.field_195045_e.func_196958_f()) { ++ if (!this.field_195045_e.isAir(this.field_145850_b, this.field_174879_c)) { + this.field_145850_b.func_175666_e(this.field_174879_c, this.field_195045_e.func_177230_c()); + } + } +@@ -140,6 +147,8 @@ + + public void func_145843_s() { + this.field_145846_f = true; ++ this.invalidateCaps(); ++ requestModelDataUpdate(); + } + + public void func_145829_t() { +@@ -182,6 +191,13 @@ + return this.field_200663_e; + } + ++ @Override ++ public CompoundNBT getTileData() { ++ if (this.customTileData == null) ++ 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_old/minecraft/net/minecraft/tileentity/TileEntityType.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntityType.java.patch new file mode 100644 index 000000000..5083d1d95 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/tileentity/TileEntityType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/tileentity/TileEntityType.java ++++ b/net/minecraft/tileentity/TileEntityType.java +@@ -18,7 +18,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_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)); diff --git a/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch b/patches_old/minecraft/net/minecraft/util/ScreenShotHelper.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch rename to patches_old/minecraft/net/minecraft/util/ScreenShotHelper.java.patch diff --git a/patches_old/minecraft/net/minecraft/util/SharedConstants.java.patch b/patches_old/minecraft/net/minecraft/util/SharedConstants.java.patch new file mode 100644 index 000000000..e0b080dd5 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/util/SharedConstants.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/util/SharedConstants.java ++++ b/net/minecraft/util/SharedConstants.java +@@ -57,6 +57,7 @@ + } + + static { ++ if (System.getProperty("io.netty.leakDetection.level") == null) // Forge: allow level to be manually specified + ResourceLeakDetector.setLevel(field_184877_a); + CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES = false; + CommandSyntaxException.BUILT_IN_EXCEPTIONS = new TranslatableExceptionProvider(); diff --git a/patches_old/minecraft/net/minecraft/util/SoundEvent.java.patch b/patches_old/minecraft/net/minecraft/util/SoundEvent.java.patch new file mode 100644 index 000000000..0ee27eff1 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/util/SoundEvent.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/util/SoundEvent.java ++++ b/net/minecraft/util/SoundEvent.java +@@ -3,7 +3,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class SoundEvent { ++public class SoundEvent extends net.minecraftforge.registries.ForgeRegistryEntry { + private final ResourceLocation field_187506_b; + + public SoundEvent(ResourceLocation p_i46834_1_) { diff --git a/patches_old/minecraft/net/minecraft/util/SoundEvents.java.patch b/patches_old/minecraft/net/minecraft/util/SoundEvents.java.patch new file mode 100644 index 000000000..4dfb06a40 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/util/math/RayTraceResult.java.patch b/patches_old/minecraft/net/minecraft/util/math/RayTraceResult.java.patch new file mode 100644 index 000000000..508e4d06d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/util/math/RayTraceResult.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/util/math/RayTraceResult.java ++++ b/net/minecraft/util/math/RayTraceResult.java +@@ -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 Vec3d func_216347_e() { + return this.field_72307_f; + } diff --git a/patches_old/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch b/patches_old/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch new file mode 100644 index 000000000..6e95eb98c --- /dev/null +++ b/patches_old/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch @@ -0,0 +1,35 @@ +--- a/net/minecraft/util/math/shapes/EntitySelectionContext.java ++++ b/net/minecraft/util/math/shapes/EntitySelectionContext.java +@@ -18,6 +18,11 @@ + private final Item field_216382_d; + + protected EntitySelectionContext(boolean p_i51181_1_, double p_i51181_2_, Item p_i51181_4_) { ++ this(null, p_i51181_1_, p_i51181_2_, p_i51181_4_); ++ } ++ ++ protected EntitySelectionContext(@javax.annotation.Nullable Entity entityIn, boolean p_i51181_1_, double p_i51181_2_, Item p_i51181_4_) { ++ this.entity = entityIn; + this.field_227579_b_ = p_i51181_1_; + this.field_216381_c = p_i51181_2_; + this.field_216382_d = p_i51181_4_; +@@ -25,7 +30,7 @@ + + @Deprecated + protected EntitySelectionContext(Entity p_i51182_1_) { +- this(p_i51182_1_.func_226274_bn_(), p_i51182_1_.func_226278_cu_(), p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).func_184614_ca().func_77973_b() : Items.field_190931_a); ++ this(p_i51182_1_, p_i51182_1_.func_226274_bn_(), p_i51182_1_.func_226278_cu_(), p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).func_184614_ca().func_77973_b() : Items.field_190931_a); + } + + public boolean func_216375_a(Item p_216375_1_) { +@@ -39,4 +44,11 @@ + public boolean func_216378_a(VoxelShape p_216378_1_, BlockPos p_216378_2_, boolean p_216378_3_) { + return this.field_216381_c > (double)p_216378_2_.func_177956_o() + p_216378_1_.func_197758_c(Direction.Axis.Y) - (double)1.0E-5F; + } ++ ++ private final @javax.annotation.Nullable Entity entity; ++ ++ @Override ++ public @javax.annotation.Nullable Entity getEntity() { ++ return entity; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch b/patches_old/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch new file mode 100644 index 000000000..13cd00bf6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/util/math/shapes/ISelectionContext.java ++++ b/net/minecraft/util/math/shapes/ISelectionContext.java +@@ -4,7 +4,7 @@ + import net.minecraft.item.Item; + import net.minecraft.util.math.BlockPos; + +-public interface ISelectionContext { ++public interface ISelectionContext extends net.minecraftforge.common.extensions.IForgeSelectionContext { + static ISelectionContext func_216377_a() { + return EntitySelectionContext.field_216379_a; + } diff --git a/patches_old/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch b/patches_old/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch new file mode 100644 index 000000000..5c5ec295b --- /dev/null +++ b/patches_old/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch @@ -0,0 +1,43 @@ +--- a/net/minecraft/util/palette/PalettedContainer.java ++++ b/net/minecraft/util/palette/PalettedContainer.java +@@ -65,8 +65,11 @@ + } + + 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; + if (this.field_186024_e <= 4) { + this.field_186024_e = 4; + this.field_186022_c = new PaletteArray<>(this.field_205523_d, this.field_186024_e, this, this.field_205524_e); +@@ -75,6 +78,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_186022_c.func_186041_a(this.field_205526_g); +@@ -137,12 +142,16 @@ + this.func_210459_b(); + int i = p_186010_1_.readByte(); + if (this.field_186024_e != i) { +- this.func_186012_b(i); ++ this.setBits(i, true); //Forge, Force bit density to fix network issues, resize below if needed. + } + + this.field_186022_c.func_186038_a(p_186010_1_); + p_186010_1_.func_186873_b(this.field_186021_b.func_188143_a()); + this.func_210460_c(); ++ ++ int regSize = MathHelper.func_151241_e(this.field_205523_d.func_186804_a()); ++ if (this.field_186022_c == field_205521_b && this.field_186024_e != regSize) // Resize bits to fit registry. ++ this.onResize(regSize, field_205526_g); + } + + public void func_186009_b(PacketBuffer p_186009_1_) { diff --git a/patches_old/minecraft/net/minecraft/util/registry/Bootstrap.java.patch b/patches_old/minecraft/net/minecraft/util/registry/Bootstrap.java.patch new file mode 100644 index 000000000..652058f95 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/util/registry/Registry.java.patch b/patches_old/minecraft/net/minecraft/util/registry/Registry.java.patch new file mode 100644 index 000000000..4fc4abd43 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/util/registry/Registry.java.patch @@ -0,0 +1,182 @@ +--- a/net/minecraft/util/registry/Registry.java ++++ b/net/minecraft/util/registry/Registry.java +@@ -70,88 +70,90 @@ + 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 necessary 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", () -> { ++ @Deprecated public static final DefaultedRegistry field_212619_h = forgeDefaulted("fluid", Fluid.class, () -> { + 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", () -> { ++ @Deprecated public static final Registry> field_218377_o = forge("carver", WorldCarver.class, () -> { + return WorldCarver.field_222709_a; + }); +- public static final Registry> field_218378_p = func_222935_a("surface_builder", () -> { ++ @Deprecated public static final Registry> field_218378_p = forge("surface_builder", SurfaceBuilder.class, () -> { + return SurfaceBuilder.field_215396_G; + }); +- public static final Registry> field_218379_q = func_222935_a("feature", () -> { ++ @Deprecated public static final Registry> field_218379_q = forge("feature", Feature.class, () -> { + return Feature.field_202290_aj; + }); +- public static final Registry> field_218380_r = func_222935_a("decorator", () -> { ++ @Deprecated public static final Registry> field_218380_r = forge("decorator", Placement.class, () -> { + 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_229387_t_ = func_222935_a("block_state_provider_type", () -> { ++ @Deprecated public static final Registry> field_229387_t_ = forge("block_state_provider_type", BlockStateProviderType.class, () -> { + return BlockStateProviderType.field_227394_a_; + }); +- public static final Registry> field_229388_u_ = func_222935_a("block_placer_type", () -> { ++ @Deprecated public static final Registry> field_229388_u_ = forge("block_placer_type", BlockPlacerType.class, () -> { + return BlockPlacerType.field_227259_a_; + }); +- public static final Registry> field_229389_v_ = func_222935_a("foliage_placer_type", () -> { ++ @Deprecated public static final Registry> field_229389_v_ = forge("foliage_placer_type", FoliagePlacerType.class, () -> { + return FoliagePlacerType.field_227386_a_; + }); +- public static final Registry> field_229390_w_ = func_222935_a("tree_decorator_type", () -> { ++ @Deprecated public static final Registry> field_229390_w_ = forge("tree_decorator_type", TreeDecoratorType.class, () -> { + return TreeDecoratorType.field_227426_b_; + }); +- public static final Registry> field_212632_u = func_222935_a("particle_type", () -> { ++ @Deprecated public static final Registry> field_212632_u = forge("particle_type", ParticleType.class, () -> { + return ParticleTypes.field_197611_d; + }); +- public static final Registry> field_212625_n = func_222935_a("biome_source_type", () -> { ++ @Deprecated public static final Registry> field_212625_n = forge("biome_source_type", BiomeProviderType.class, () -> { + 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", () -> { ++ @Deprecated public static final Registry> field_212627_p = forge("chunk_generator_type", ChunkGeneratorType.class, () -> { + return ChunkGeneratorType.field_205489_f; + }); +- public static final Registry field_212622_k = func_222935_a("dimension_type", () -> { ++ @Deprecated public static final Registry field_212622_k = func_222939_a("dimension_type", net.minecraftforge.common.DimensionManager.getRegistry(), () -> { + return DimensionType.field_223227_a_; + }); +- public static final DefaultedRegistry field_212620_i = func_222933_a("motive", "kebab", () -> { ++ @Deprecated public static final DefaultedRegistry field_212620_i = forgeDefaulted("motive", PaintingType.class, () -> { + return PaintingType.field_200843_b; + }); + public static final Registry field_212623_l = func_222935_a("custom_stat", () -> { + return Stats.field_75953_u; + }); +- public static final DefaultedRegistry field_218360_A = func_222933_a("chunk_status", "empty", () -> { ++ @Deprecated public static final DefaultedRegistry field_218360_A = forgeDefaulted("chunk_status", ChunkStatus.class, () -> { + return ChunkStatus.field_223226_a_; + }); +- public static final Registry> field_218361_B = func_222935_a("structure_feature", () -> { +- return Structures.field_215143_a; +- }); ++ @Deprecated public static final Registry> field_218361_B = net.minecraftforge.registries.GameData.getStructureFeatures(); + public static final Registry field_218362_C = func_222935_a("structure_piece", () -> { + return IStructurePieceType.field_214782_c; + }); +@@ -164,37 +166,37 @@ + public static final Registry field_218365_F = func_222935_a("structure_pool_element", () -> { + return IJigsawDeserializer.field_214931_e; + }); +- public static final Registry> field_218366_G = func_222935_a("menu", () -> { ++ @Deprecated public static final Registry> field_218366_G = forge("menu", ContainerType.class, () -> { + return ContainerType.field_221514_h; + }); + public static final Registry> field_218367_H = func_222935_a("recipe_type", () -> { + return IRecipeType.field_222149_a; + }); +- public static final Registry> field_218368_I = func_222935_a("recipe_serializer", () -> { ++ @Deprecated public static final Registry> field_218368_I = forge("recipe_serializer", IRecipeSerializer.class, () -> { + return IRecipeSerializer.field_222158_b; + }); +- public static final Registry> field_212634_w = func_222935_a("stat_type", () -> { ++ @Deprecated public static final Registry> field_212634_w = forge("stat_type", StatType.class, () -> { + return Stats.field_75929_E; + }); + public static final DefaultedRegistry field_218369_K = func_222933_a("villager_type", "plains", () -> { + return IVillagerType.field_221175_c; + }); +- public static final DefaultedRegistry field_218370_L = func_222933_a("villager_profession", "none", () -> { ++ @Deprecated public static final DefaultedRegistry field_218370_L = forgeDefaulted("villager_profession", VillagerProfession.class, () -> { + return VillagerProfession.field_221151_a; + }); +- public static final DefaultedRegistry field_218371_M = func_222933_a("point_of_interest_type", "unemployed", () -> { ++ @Deprecated public static final DefaultedRegistry field_218371_M = forgeDefaulted("point_of_interest_type", PointOfInterestType.class, () -> { + return PointOfInterestType.field_221054_b; + }); +- public static final DefaultedRegistry> field_218372_N = func_222933_a("memory_module_type", "dummy", () -> { ++ @Deprecated public static final DefaultedRegistry> field_218372_N = forgeDefaulted("memory_module_type", MemoryModuleType.class, () -> { + return MemoryModuleType.field_220940_a; + }); +- public static final DefaultedRegistry> field_218373_O = func_222933_a("sensor_type", "dummy", () -> { ++ @Deprecated public static final DefaultedRegistry> field_218373_O = forgeDefaulted("sensor_type", SensorType.class, () -> { + return SensorType.field_220997_a; + }); +- public static final Registry field_218374_P = func_222935_a("schedule", () -> { ++ @Deprecated public static final Registry field_218374_P = forge("schedule", Schedule.class, () -> { + return Schedule.field_221383_a; + }); +- public static final Registry field_218375_Q = func_222935_a("activity", () -> { ++ @Deprecated public static final Registry field_218375_Q = forge("activity", Activity.class, () -> { + return Activity.field_221366_b; + }); + +@@ -246,6 +248,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_229397_0_) -> { + if (p_229397_0_.getValue().get() == null) { diff --git a/patches_old/minecraft/net/minecraft/util/text/LanguageMap.java.patch b/patches_old/minecraft/net/minecraft/util/text/LanguageMap.java.patch new file mode 100644 index 000000000..5f9fad508 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/util/text/LanguageMap.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/util/text/LanguageMap.java ++++ b/net/minecraft/util/text/LanguageMap.java +@@ -36,6 +36,7 @@ + this.field_74816_c.put(entry.getKey(), s); + } + ++ net.minecraftforge.fml.server.LanguageHook.captureLanguageMap(this.field_74816_c); + this.field_150511_e = Util.func_211177_b(); + } catch (JsonParseException | IOException ioexception) { + field_201045_a.error("Couldn't read strings from /assets/minecraft/lang/en_us.json", (Throwable)ioexception); diff --git a/patches_old/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch b/patches_old/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch new file mode 100644 index 000000000..38a1be77c --- /dev/null +++ b/patches_old/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/util/text/TranslationTextComponent.java ++++ b/net/minecraft/util/text/TranslationTextComponent.java +@@ -100,6 +100,10 @@ + } + } + ++ if (j == 0) { ++ // if we failed to match above, lets try the messageformat handler instead. ++ 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 StringTextComponent(String.format(p_150269_1_.substring(j))); + itextcomponent1.func_150256_b().func_150221_a(this.func_150256_b()); diff --git a/patches_old/minecraft/net/minecraft/village/PointOfInterestType.java.patch b/patches_old/minecraft/net/minecraft/village/PointOfInterestType.java.patch new file mode 100644 index 000000000..5a5b12d7b --- /dev/null +++ b/patches_old/minecraft/net/minecraft/village/PointOfInterestType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/village/PointOfInterestType.java ++++ b/net/minecraft/village/PointOfInterestType.java +@@ -19,7 +19,7 @@ + import net.minecraft.util.Util; + import net.minecraft.util.registry.Registry; + +-public class PointOfInterestType { ++public class PointOfInterestType extends net.minecraftforge.registries.ForgeRegistryEntry { + private static final Predicate field_221071_s = (p_221041_0_) -> { + return Registry.field_218370_L.func_201756_e().map(VillagerProfession::func_221149_b).collect(Collectors.toSet()).contains(p_221041_0_); + }; diff --git a/patches_old/minecraft/net/minecraft/village/VillageSiege.java.patch b/patches_old/minecraft/net/minecraft/village/VillageSiege.java.patch new file mode 100644 index 000000000..caa0c6a1d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/village/VillageSiege.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/village/VillageSiege.java ++++ b/net/minecraft/village/VillageSiege.java +@@ -74,7 +74,9 @@ + this.field_75532_g = blockpos.func_177958_n() + MathHelper.func_76141_d(MathHelper.func_76134_b(f) * 32.0F); + this.field_75538_h = blockpos.func_177956_o(); + this.field_75539_i = blockpos.func_177952_p() + MathHelper.func_76141_d(MathHelper.func_76126_a(f) * 32.0F); +- if (this.func_225476_a(p_75529_1_, new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)) != null) { ++ Vec3d siegeLocation = this.func_225476_a(p_75529_1_, new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)); ++ if (siegeLocation != null) { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.village.VillageSiegeEvent(this, p_75529_1_, playerentity, siegeLocation))) return false; + this.field_75534_e = 0; + this.field_75533_d = 20; + break; +@@ -94,7 +96,7 @@ + if (vec3d != null) { + ZombieEntity zombieentity; + try { +- zombieentity = new ZombieEntity(p_75530_1_); ++ zombieentity = EntityType.field_200725_aD.func_200721_a(p_75530_1_); //Forge: Direct Initialization is deprecated, use EntityType. + zombieentity.func_213386_a(p_75530_1_, p_75530_1_.func_175649_E(new BlockPos(zombieentity)), SpawnReason.EVENT, (ILivingEntityData)null, (CompoundNBT)null); + } catch (Exception exception) { + exception.printStackTrace(); diff --git a/patches_old/minecraft/net/minecraft/world/Explosion.java.patch b/patches_old/minecraft/net/minecraft/world/Explosion.java.patch new file mode 100644 index 000000000..8c6e8b342 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/Explosion.java.patch @@ -0,0 +1,73 @@ +--- a/net/minecraft/world/Explosion.java ++++ b/net/minecraft/world/Explosion.java +@@ -54,6 +54,7 @@ + private DamageSource field_199593_j; + private final List field_77281_g = Lists.newArrayList(); + 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_) { +@@ -76,6 +77,7 @@ + this.field_77286_a = p_i50007_10_; + this.field_222260_b = p_i50007_11_; + this.field_199593_j = DamageSource.func_94539_a(this); ++ this.position = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); + } + + public static float func_222259_a(Vec3d p_222259_0_, Entity p_222259_1_) { +@@ -135,8 +137,8 @@ + BlockPos blockpos = new BlockPos(d4, d6, d8); + BlockState blockstate = this.field_77287_j.func_180495_p(blockpos); + IFluidState ifluidstate = this.field_77287_j.func_204610_c(blockpos); +- if (!blockstate.func_196958_f() || !ifluidstate.func_206888_e()) { +- float f2 = Math.max(blockstate.func_177230_c().func_149638_a(), ifluidstate.func_210200_l()); ++ if (!blockstate.isAir(this.field_77287_j, blockpos) || !ifluidstate.func_206888_e()) { ++ float f2 = Math.max(blockstate.getExplosionResistance(this.field_77287_j, blockpos, field_77283_e, this), ifluidstate.getExplosionResistance(this.field_77287_j, blockpos, field_77283_e, this)); + if (this.field_77283_e != null) { + f2 = this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, blockstate, ifluidstate, f2); + } +@@ -166,6 +168,7 @@ + int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f3 - 1.0D); + int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f3 + 1.0D); + List list = this.field_77287_j.func_72839_b(this.field_77283_e, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.field_77287_j, this, list, f3); + Vec3d vec3d = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); + + for(int k2 = 0; k2 < list.size(); ++k2) { +@@ -224,11 +227,11 @@ + for(BlockPos blockpos : this.field_77281_g) { + BlockState blockstate = this.field_77287_j.func_180495_p(blockpos); + Block block = blockstate.func_177230_c(); +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(this.field_77287_j, blockpos)) { + BlockPos blockpos1 = blockpos.func_185334_h(); + this.field_77287_j.func_217381_Z().func_76320_a("explosion_blocks"); +- if (block.func_149659_a(this) && this.field_77287_j instanceof ServerWorld) { +- TileEntity tileentity = block.func_149716_u() ? this.field_77287_j.func_175625_s(blockpos) : null; ++ if (blockstate.canDropFromExplosion(this.field_77287_j, blockpos, this) && this.field_77287_j instanceof ServerWorld) { ++ TileEntity tileentity = blockstate.hasTileEntity() ? this.field_77287_j.func_175625_s(blockpos) : null; + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_77287_j)).func_216023_a(this.field_77287_j.field_73012_v).func_216015_a(LootParameters.field_216286_f, blockpos).func_216015_a(LootParameters.field_216289_i, ItemStack.field_190927_a).func_216021_b(LootParameters.field_216288_h, tileentity).func_216021_b(LootParameters.field_216281_a, this.field_77283_e); + if (this.field_222260_b == Explosion.Mode.DESTROY) { + lootcontext$builder.func_216015_a(LootParameters.field_216290_j, this.field_77280_f); +@@ -239,8 +242,7 @@ + }); + } + +- this.field_77287_j.func_180501_a(blockpos, Blocks.field_150350_a.func_176223_P(), 3); +- block.func_180652_a(this.field_77287_j, blockpos, this); ++ blockstate.onBlockExploded(this.field_77287_j, blockpos, this); + this.field_77287_j.func_217381_Z().func_76319_b(); + } + } +@@ -311,6 +313,10 @@ + return this.field_77281_g; + } + ++ public Vec3d getPosition() { ++ return this.position; ++ } ++ + public static enum Mode { + NONE, + BREAK, diff --git a/patches_old/minecraft/net/minecraft/world/IBlockReader.java.patch b/patches_old/minecraft/net/minecraft/world/IBlockReader.java.patch new file mode 100644 index 000000000..3d612f585 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/IBlockReader.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/IBlockReader.java ++++ b/net/minecraft/world/IBlockReader.java +@@ -23,7 +23,7 @@ + IFluidState func_204610_c(BlockPos p_204610_1_); + + default int func_217298_h(BlockPos p_217298_1_) { +- return this.func_180495_p(p_217298_1_).func_185906_d(); ++ return this.func_180495_p(p_217298_1_).getLightValue(this, p_217298_1_); + } + + default int func_201572_C() { diff --git a/patches/minecraft/net/minecraft/world/IWorld.java.patch b/patches_old/minecraft/net/minecraft/world/IWorld.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/IWorld.java.patch rename to patches_old/minecraft/net/minecraft/world/IWorld.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/IWorldReader.java.patch b/patches_old/minecraft/net/minecraft/world/IWorldReader.java.patch new file mode 100644 index 000000000..97515e7f6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/IWorldReader.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/world/IWorldReader.java ++++ b/net/minecraft/world/IWorldReader.java +@@ -57,7 +57,7 @@ + } + + default boolean func_175623_d(BlockPos p_175623_1_) { +- return this.func_180495_p(p_175623_1_).func_196958_f(); ++ return this.func_180495_p(p_175623_1_).isAir(this, p_175623_1_); + } + + default boolean func_175710_j(BlockPos p_175710_1_) { +@@ -148,6 +148,10 @@ + return this.func_217354_b(p_175667_1_.func_177958_n() >> 4, p_175667_1_.func_177952_p() >> 4); + } + ++ default boolean isAreaLoaded(BlockPos center, int range) { ++ return this.func_175707_a(center.func_177982_a(-range, -range, -range), center.func_177982_a(range, range, range)); ++ } ++ + @Deprecated + default boolean func_175707_a(BlockPos p_175707_1_, BlockPos p_175707_2_) { + return this.func_217344_a(p_175707_1_.func_177958_n(), p_175707_1_.func_177956_o(), p_175707_1_.func_177952_p(), p_175707_2_.func_177958_n(), p_175707_2_.func_177956_o(), p_175707_2_.func_177952_p()); diff --git a/patches_old/minecraft/net/minecraft/world/Teleporter.java.patch b/patches_old/minecraft/net/minecraft/world/Teleporter.java.patch new file mode 100644 index 000000000..56fdd3c84 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/Teleporter.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/Teleporter.java ++++ b/net/minecraft/world/Teleporter.java +@@ -23,7 +23,7 @@ + import net.minecraft.world.server.ServerWorld; + import net.minecraft.world.server.TicketType; + +-public class Teleporter { ++public class Teleporter implements net.minecraftforge.common.util.ITeleporter { + protected final ServerWorld field_85192_a; + protected final Random field_77187_a; + diff --git a/patches_old/minecraft/net/minecraft/world/TrackedEntity.java.patch b/patches_old/minecraft/net/minecraft/world/TrackedEntity.java.patch new file mode 100644 index 000000000..19359bd83 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/TrackedEntity.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/world/TrackedEntity.java ++++ b/net/minecraft/world/TrackedEntity.java +@@ -80,9 +80,8 @@ + if (this.field_219461_c instanceof ItemFrameEntity && this.field_219472_n % 10 == 0) { + ItemFrameEntity itemframeentity = (ItemFrameEntity)this.field_219461_c; + ItemStack itemstack = itemframeentity.func_82335_i(); +- if (itemstack.func_77973_b() instanceof FilledMapItem) { +- MapData mapdata = FilledMapItem.func_195950_a(itemstack, this.field_219460_b); +- ++ MapData mapdata = FilledMapItem.func_195950_a(itemstack, this.field_219460_b); ++ if (mapdata != null) { + for(ServerPlayerEntity serverplayerentity : this.field_219460_b.func_217369_A()) { + mapdata.func_76191_a(serverplayerentity, itemstack); + IPacket ipacket = ((FilledMapItem)itemstack.func_77973_b()).func_150911_c(itemstack, this.field_219460_b, serverplayerentity); +@@ -186,12 +185,14 @@ + public void func_219454_a(ServerPlayerEntity p_219454_1_) { + this.field_219461_c.func_184203_c(p_219454_1_); + p_219454_1_.func_152339_d(this.field_219461_c); ++ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(this.field_219461_c, p_219454_1_); + } + + public void func_219455_b(ServerPlayerEntity p_219455_1_) { + this.func_219452_a(p_219455_1_.field_71135_a::func_147359_a); + this.field_219461_c.func_184178_b(p_219455_1_); + p_219455_1_.func_184848_d(this.field_219461_c); ++ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(this.field_219461_c, p_219455_1_); + } + + public void func_219452_a(Consumer> p_219452_1_) { 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..9f20a1d3d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/World.java.patch @@ -0,0 +1,517 @@ +--- a/net/minecraft/world/World.java ++++ b/net/minecraft/world/World.java +@@ -62,13 +62,13 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-public abstract class World implements IWorld, AutoCloseable { ++public abstract class World extends net.minecraftforge.common.capabilities.CapabilityProvider implements IWorld, AutoCloseable, net.minecraftforge.common.extensions.IForgeWorld { + protected static final Logger field_195596_d = LogManager.getLogger(); + private static final Direction[] field_200007_a = Direction.values(); + public final List 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 Thread field_217407_c; + private int field_73008_k; + protected int field_73005_l = (new Random()).nextInt(); +@@ -86,8 +86,12 @@ + protected boolean field_147481_N; + private final WorldBorder field_175728_M; + private final BiomeManager field_226689_w_; ++ public boolean restoringBlockSnapshots = false; ++ public boolean captureBlockSnapshots = false; ++ public java.util.ArrayList capturedBlockSnapshots = new java.util.ArrayList(); + + 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_72984_F = p_i50005_4_; + this.field_72986_A = p_i50005_1_; + this.field_73011_w = p_i50005_2_.func_218270_a(this); +@@ -158,23 +162,51 @@ + } else { + Chunk chunk = this.func_175726_f(p_180501_1_); + Block block = p_180501_2_.func_177230_c(); ++ ++ p_180501_1_ = p_180501_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks ++ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; ++ if (this.captureBlockSnapshots && !this.field_72995_K) { ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_180501_1_, p_180501_3_); ++ this.capturedBlockSnapshots.add(blockSnapshot); ++ } ++ ++ BlockState old = func_180495_p(p_180501_1_); ++ int oldLight = old.getLightValue(this, p_180501_1_); ++ int oldOpacity = old.func_200016_a(this, p_180501_1_); ++ + BlockState blockstate = chunk.func_177436_a(p_180501_1_, p_180501_2_, (p_180501_3_ & 64) != 0); + if (blockstate == null) { ++ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); + return false; + } else { + BlockState blockstate1 = this.func_180495_p(p_180501_1_); +- if (blockstate1 != blockstate && (blockstate1.func_200016_a(this, p_180501_1_) != blockstate.func_200016_a(this, p_180501_1_) || blockstate1.func_185906_d() != blockstate.func_185906_d() || blockstate1.func_215691_g() || blockstate.func_215691_g())) { ++ if (blockstate1 != blockstate && (blockstate1.func_200016_a(this, p_180501_1_) != oldOpacity || blockstate1.getLightValue(this, p_180501_1_) != oldLight || blockstate1.func_215691_g() || blockstate.func_215691_g())) { + this.field_72984_F.func_76320_a("queueCheckLight"); + this.func_72863_F().func_212863_j_().func_215568_a(p_180501_1_); + this.field_72984_F.func_76319_b(); + } + ++ if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates ++ this.markAndNotifyBlock(p_180501_1_, chunk, blockstate, p_180501_2_, p_180501_3_); ++ } ++ return true; ++ } ++ } ++ } ++ ++ // Split off from original setBlockState(BlockPos, BlockState, int) method in order to directly send client and physic updates ++ public void markAndNotifyBlock(BlockPos p_180501_1_, @Nullable Chunk chunk, BlockState blockstate, BlockState p_180501_2_, int p_180501_3_) ++ { ++ Block block = p_180501_2_.func_177230_c(); ++ BlockState blockstate1 = func_180495_p(p_180501_1_); ++ { ++ { + if (blockstate1 == p_180501_2_) { + if (blockstate != blockstate1) { + this.func_225319_b(p_180501_1_, blockstate, blockstate1); + } + +- if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && (this.field_72995_K || chunk.func_217321_u() != null && chunk.func_217321_u().func_219065_a(ChunkHolder.LocationType.TICKING))) { ++ if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && (this.field_72995_K || chunk == null || chunk.func_217321_u() != null && chunk.func_217321_u().func_219065_a(ChunkHolder.LocationType.TICKING))) { + this.func_184138_a(p_180501_1_, blockstate, p_180501_2_, p_180501_3_); + } + +@@ -194,8 +226,6 @@ + + this.func_217393_a(p_180501_1_, blockstate, blockstate1); + } +- +- return true; + } + } + } +@@ -210,13 +240,13 @@ + + public boolean func_225521_a_(BlockPos p_225521_1_, boolean p_225521_2_, @Nullable Entity p_225521_3_) { + BlockState blockstate = this.func_180495_p(p_225521_1_); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(this, p_225521_1_)) { + return false; + } else { + IFluidState ifluidstate = this.func_204610_c(p_225521_1_); + this.func_217379_c(2001, p_225521_1_, Block.func_196246_j(blockstate)); + if (p_225521_2_) { +- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? this.func_175625_s(p_225521_1_) : null; ++ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_225521_1_) : null; + Block.func_220054_a(blockstate, this, p_225521_1_, tileentity, p_225521_3_, ItemStack.field_190927_a); + } + +@@ -241,6 +271,8 @@ + } + + public void func_195593_d(BlockPos p_195593_1_, Block p_195593_2_) { ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_195593_1_, this.func_180495_p(p_195593_1_), java.util.EnumSet.allOf(Direction.class), false).isCanceled()) ++ return; + this.func_190524_a(p_195593_1_.func_177976_e(), p_195593_2_, p_195593_1_); + this.func_190524_a(p_195593_1_.func_177974_f(), p_195593_2_, p_195593_1_); + this.func_190524_a(p_195593_1_.func_177977_b(), p_195593_2_, p_195593_1_); +@@ -250,6 +282,11 @@ + } + + public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, Direction p_175695_3_) { ++ java.util.EnumSet directions = java.util.EnumSet.allOf(Direction.class); ++ directions.remove(p_175695_3_); ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175695_1_, this.func_180495_p(p_175695_1_), directions, false).isCanceled()) ++ return; ++ + if (p_175695_3_ != Direction.WEST) { + this.func_190524_a(p_175695_1_.func_177976_e(), p_175695_2_, p_175695_1_); + } +@@ -287,9 +324,9 @@ + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block being updated"); + crashreportcategory.func_189529_a("Source block type", () -> { + try { +- return String.format("ID #%s (%s // %s)", Registry.field_212618_g.func_177774_c(p_190524_2_), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName()); ++ return String.format("ID #%s (%s // %s)", p_190524_2_.getRegistryName(), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName()); + } catch (Throwable var2) { +- return "ID #" + Registry.field_212618_g.func_177774_c(p_190524_2_); ++ return "ID #" + p_190524_2_.getRegistryName(); + } + }); + CrashReportCategory.func_175750_a(crashreportcategory, p_190524_1_, blockstate); +@@ -336,7 +373,7 @@ + } + + public boolean func_72935_r() { +- return this.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ && this.field_73008_k < 4; ++ return this.field_73011_w.isDaytime(); + } + + public boolean func_226690_K_() { +@@ -373,10 +410,12 @@ + } + + public boolean func_175700_a(TileEntity p_175700_1_) { ++ if (p_175700_1_.func_145831_w() != this) p_175700_1_.func_226984_a_(this, p_175700_1_.func_174877_v()); // Forge - set the world early as vanilla doesn't set it until next tick + if (this.field_147481_N) { + field_195596_d.error("Adding block entity while ticking: {} @ {}", () -> { + return Registry.field_212626_o.func_177774_c(p_175700_1_.func_200662_C()); + }, p_175700_1_::func_174877_v); ++ return field_147484_a.add(p_175700_1_); // Forge: wait to add new TE if we're currently processing existing ones + } + + boolean flag = this.field_147482_g.add(p_175700_1_); +@@ -384,6 +423,8 @@ + this.field_175730_i.add(p_175700_1_); + } + ++ p_175700_1_.onLoad(); ++ + if (this.field_72995_K) { + BlockPos blockpos = p_175700_1_.func_174877_v(); + BlockState blockstate = this.func_180495_p(blockpos); +@@ -395,6 +436,7 @@ + + public void func_147448_a(Collection p_147448_1_) { + if (this.field_147481_N) { ++ p_147448_1_.stream().filter(te -> te.func_145831_w() != this).forEach(te -> te.func_226984_a_(this, te.func_174877_v())); // Forge - set the world early as vanilla doesn't set it until next tick + this.field_147484_a.addAll(p_147448_1_); + } else { + for(TileEntity tileentity : p_147448_1_) { +@@ -407,13 +449,14 @@ + public void func_217391_K() { + IProfiler iprofiler = this.func_217381_Z(); + iprofiler.func_76320_a("blockEntities"); ++ this.field_147481_N = true;// Forge: Move above remove to prevent CMEs + if (!this.field_147483_b.isEmpty()) { ++ this.field_147483_b.forEach(e -> e.onChunkUnloaded()); + this.field_175730_i.removeAll(this.field_147483_b); + this.field_147482_g.removeAll(this.field_147483_b); + this.field_147483_b.clear(); + } + +- this.field_147481_N = true; + Iterator iterator = this.field_175730_i.iterator(); + + while(iterator.hasNext()) { +@@ -422,8 +465,9 @@ + BlockPos blockpos = tileentity.func_174877_v(); + if (this.field_73020_y.func_222866_a(blockpos) && this.func_175723_af().func_177746_a(blockpos)) { + try { ++ net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackStart(tileentity); + iprofiler.func_194340_a(() -> { +- return String.valueOf((Object)TileEntityType.func_200969_a(tileentity.func_200662_C())); ++ return String.valueOf(tileentity.func_200662_C().getRegistryName()); + }); + if (tileentity.func_200662_C().func_223045_a(this.func_180495_p(blockpos).func_177230_c())) { + ((ITickableTileEntity)tileentity).func_73660_a(); +@@ -436,8 +480,16 @@ + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Ticking block entity"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block entity being ticked"); + tileentity.func_145828_a(crashreportcategory); ++ if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringTileEntities.get()) { ++ LogManager.getLogger().fatal("{}", crashreport.func_71502_e()); ++ tileentity.func_145843_s(); ++ this.func_175713_t(tileentity.func_174877_v()); ++ } else + throw new ReportedException(crashreport); + } ++ finally { ++ net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackEnd(tileentity); ++ } + } + } + +@@ -445,7 +497,10 @@ + iterator.remove(); + this.field_147482_g.remove(tileentity); + if (this.func_175667_e(tileentity.func_174877_v())) { +- this.func_175726_f(tileentity.func_174877_v()).func_177425_e(tileentity.func_174877_v()); ++ //Forge: Bugfix: If we set the tile entity it immediately sets it in the chunk, so we could be desyned ++ Chunk chunk = this.func_175726_f(tileentity.func_174877_v()); ++ if (chunk.func_177424_a(tileentity.func_174877_v(), Chunk.CreateEntityType.CHECK) == tileentity) ++ chunk.func_177425_e(tileentity.func_174877_v()); + } + } + } +@@ -477,12 +532,15 @@ + + public void func_217390_a(Consumer p_217390_1_, Entity p_217390_2_) { + try { ++ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackStart(p_217390_2_); + p_217390_1_.accept(p_217390_2_); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Ticking entity"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Entity being ticked"); + p_217390_2_.func_85029_a(crashreportcategory); + throw new ReportedException(crashreport); ++ } finally { ++ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackEnd(p_217390_2_); + } + } + +@@ -499,7 +557,7 @@ + for(int l1 = k; l1 < l; ++l1) { + for(int i2 = i1; i2 < j1; ++i2) { + BlockState blockstate = this.func_180495_p(blockpos$pooledmutable.func_181079_c(k1, l1, i2)); +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(this, blockpos$pooledmutable)) { + boolean flag = true; + return flag; + } +@@ -523,8 +581,8 @@ + for(int k1 = i; k1 < j; ++k1) { + for(int l1 = k; l1 < l; ++l1) { + for(int i2 = i1; i2 < j1; ++i2) { +- Block block = this.func_180495_p(blockpos$pooledmutable.func_181079_c(k1, l1, i2)).func_177230_c(); +- if (block == Blocks.field_150480_ab || block == Blocks.field_150353_l) { ++ BlockState state = this.func_180495_p(blockpos$pooledmutable.func_181079_c(k1, l1, i2)); ++ if (state.isBurning(this, blockpos$pooledmutable)) { + boolean flag = true; + return flag; + } +@@ -594,6 +652,7 @@ + if (p_217401_2_ != null) { + explosion.func_199592_a(p_217401_2_); + } ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; + + explosion.func_77278_a(); + explosion.func_77279_a(true); +@@ -654,6 +713,7 @@ + + public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) { + if (!func_189509_E(p_175690_1_)) { ++ p_175690_1_ = p_175690_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks + if (p_175690_2_ != null && !p_175690_2_.func_145837_r()) { + if (this.field_147481_N) { + p_175690_2_.func_226984_a_(this, p_175690_1_); +@@ -669,7 +729,8 @@ + + this.field_147484_a.add(p_175690_2_); + } else { +- this.func_175726_f(p_175690_1_).func_177426_a(p_175690_1_, p_175690_2_); ++ Chunk chunk = this.func_175726_f(p_175690_1_); ++ if (chunk != null) chunk.func_177426_a(p_175690_1_, p_175690_2_); + this.func_175700_a(p_175690_2_); + } + } +@@ -682,6 +743,8 @@ + if (tileentity != null && this.field_147481_N) { + tileentity.func_145843_s(); + this.field_147484_a.remove(tileentity); ++ if (!(tileentity instanceof ITickableTileEntity)) //Forge: If they are not tickable they wont be removed in the update loop. ++ this.field_147482_g.remove(tileentity); + } else { + if (tileentity != null) { + this.field_147484_a.remove(tileentity); +@@ -691,7 +754,7 @@ + + this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); + } +- ++ this.func_175666_e(p_175713_1_, func_180495_p(p_175713_1_).func_177230_c()); //Notify neighbors of changes + } + + public boolean func_195588_v(BlockPos p_195588_1_) { +@@ -716,9 +779,14 @@ + + public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) { + this.func_72863_F().func_217203_a(p_72891_1_, p_72891_2_); ++ this.func_201675_m().setAllowedSpawnTypes(p_72891_1_, p_72891_2_); + } + + protected void func_72947_a() { ++ this.field_73011_w.calculateInitialWeather(); ++ } ++ ++ public void calculateInitialWeatherBody() { + if (this.field_72986_A.func_76059_o()) { + this.field_73004_o = 1.0F; + if (this.field_72986_A.func_76061_m()) { +@@ -740,10 +808,10 @@ + public List func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate p_175674_3_) { + this.func_217381_Z().func_230035_c_("getEntities"); + List list = Lists.newArrayList(); +- int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - 2.0D) / 16.0D); +- int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + 2.0D) / 16.0D); +- int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - 2.0D) / 16.0D); +- int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + 2.0D) / 16.0D); ++ int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + getMaxEntityRadius()) / 16.0D); ++ int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - getMaxEntityRadius()) / 16.0D); ++ int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + getMaxEntityRadius()) / 16.0D); + + for(int i1 = i; i1 <= j; ++i1) { + for(int j1 = k; j1 <= l; ++j1) { +@@ -759,10 +827,10 @@ + + public List func_217394_a(@Nullable EntityType p_217394_1_, AxisAlignedBB p_217394_2_, Predicate p_217394_3_) { + this.func_217381_Z().func_230035_c_("getEntities"); +- int i = MathHelper.func_76128_c((p_217394_2_.field_72340_a - 2.0D) / 16.0D); +- int j = MathHelper.func_76143_f((p_217394_2_.field_72336_d + 2.0D) / 16.0D); +- int k = MathHelper.func_76128_c((p_217394_2_.field_72339_c - 2.0D) / 16.0D); +- int l = MathHelper.func_76143_f((p_217394_2_.field_72334_f + 2.0D) / 16.0D); ++ int i = MathHelper.func_76128_c((p_217394_2_.field_72340_a - getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.func_76143_f((p_217394_2_.field_72336_d + getMaxEntityRadius()) / 16.0D); ++ int k = MathHelper.func_76128_c((p_217394_2_.field_72339_c - getMaxEntityRadius()) / 16.0D); ++ int l = MathHelper.func_76143_f((p_217394_2_.field_72334_f + getMaxEntityRadius()) / 16.0D); + List list = Lists.newArrayList(); + + for(int i1 = i; i1 < j; ++i1) { +@@ -779,10 +847,10 @@ + + public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate p_175647_3_) { + this.func_217381_Z().func_230035_c_("getEntities"); +- int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D); +- int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + 2.0D) / 16.0D); +- int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - 2.0D) / 16.0D); +- int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + 2.0D) / 16.0D); ++ int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + getMaxEntityRadius()) / 16.0D); ++ int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - getMaxEntityRadius()) / 16.0D); ++ int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + getMaxEntityRadius()) / 16.0D); + List list = Lists.newArrayList(); + AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); + +@@ -800,10 +868,10 @@ + + public List func_225316_b(Class p_225316_1_, AxisAlignedBB p_225316_2_, @Nullable Predicate p_225316_3_) { + this.func_217381_Z().func_230035_c_("getLoadedEntities"); +- int i = MathHelper.func_76128_c((p_225316_2_.field_72340_a - 2.0D) / 16.0D); +- int j = MathHelper.func_76143_f((p_225316_2_.field_72336_d + 2.0D) / 16.0D); +- int k = MathHelper.func_76128_c((p_225316_2_.field_72339_c - 2.0D) / 16.0D); +- int l = MathHelper.func_76143_f((p_225316_2_.field_72334_f + 2.0D) / 16.0D); ++ int i = MathHelper.func_76128_c((p_225316_2_.field_72340_a - getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.func_76143_f((p_225316_2_.field_72336_d + getMaxEntityRadius()) / 16.0D); ++ int k = MathHelper.func_76128_c((p_225316_2_.field_72339_c - getMaxEntityRadius()) / 16.0D); ++ int l = MathHelper.func_76143_f((p_225316_2_.field_72334_f + getMaxEntityRadius()) / 16.0D); + List list = Lists.newArrayList(); + AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); + +@@ -830,7 +898,8 @@ + } + + public int func_181545_F() { +- return 63; ++ // FORGE: Allow modded dimensions to customize this value via Dimension ++ return this.func_201675_m().getSeaLevel(); + } + + public World func_201672_e() { +@@ -878,7 +947,7 @@ + + public int func_175651_c(BlockPos p_175651_1_, Direction p_175651_2_) { + BlockState blockstate = this.func_180495_p(p_175651_1_); +- return blockstate.func_215686_e(this, p_175651_1_) ? this.func_175676_y(p_175651_1_) : blockstate.func_185911_a(this, p_175651_1_, p_175651_2_); ++ return blockstate.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : blockstate.func_185911_a(this, p_175651_1_, p_175651_2_); + } + + public boolean func_175640_z(BlockPos p_175640_1_) { +@@ -923,7 +992,7 @@ + } + + public long func_72905_C() { +- return this.field_72986_A.func_76063_b(); ++ return this.field_73011_w.getSeed(); + } + + public long func_82737_E() { +@@ -931,11 +1000,11 @@ + } + + public long func_72820_D() { +- return this.field_72986_A.func_76073_f(); ++ return this.field_73011_w.getWorldTime(); + } + + public void func_72877_b(long p_72877_1_) { +- this.field_72986_A.func_76068_b(p_72877_1_); ++ this.field_73011_w.setWorldTime(p_72877_1_); + } + + protected void func_217389_a() { +@@ -947,7 +1016,7 @@ + } + + public BlockPos func_175694_M() { +- BlockPos blockpos = new BlockPos(this.field_72986_A.func_76079_c(), this.field_72986_A.func_76075_d(), this.field_72986_A.func_76074_e()); ++ BlockPos blockpos = this.field_73011_w.getSpawnPoint(); + if (!this.func_175723_af().func_177746_a(blockpos)) { + blockpos = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(this.func_175723_af().func_177731_f(), 0.0D, this.func_175723_af().func_177721_g())); + } +@@ -956,10 +1025,14 @@ + } + + public void func_175652_B(BlockPos p_175652_1_) { +- this.field_72986_A.func_176143_a(p_175652_1_); ++ this.field_73011_w.setSpawnPoint(p_175652_1_); + } + + public boolean func_175660_a(PlayerEntity p_175660_1_, BlockPos p_175660_2_) { ++ return field_73011_w.canMineBlock(p_175660_1_, p_175660_2_); ++ } ++ ++ public boolean canMineBlockBody(PlayerEntity player, BlockPos pos) { + return true; + } + +@@ -1027,8 +1100,7 @@ + } + + public boolean func_180502_D(BlockPos p_180502_1_) { +- Biome biome = this.func_226691_t_(p_180502_1_); +- return biome.func_76736_e(); ++ return this.field_73011_w.isHighHumidity(p_180502_1_); + } + + @Nullable +@@ -1042,7 +1114,7 @@ + } + + public int func_72940_L() { +- return this.field_73011_w.func_177495_o() ? 128 : 256; ++ return this.field_73011_w.getActualHeight(); + } + + public CrashReportCategory func_72914_a(CrashReport p_72914_1_) { +@@ -1073,16 +1145,15 @@ + public abstract Scoreboard func_96441_U(); + + public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { +- for(Direction direction : Direction.Plane.HORIZONTAL) { ++ for(Direction direction : Direction.values()) { //Forge: TODO: change to VALUES once ATed + BlockPos blockpos = p_175666_1_.func_177972_a(direction); + if (this.func_175667_e(blockpos)) { + BlockState blockstate = this.func_180495_p(blockpos); +- if (blockstate.func_177230_c() == Blocks.field_196762_fd) { +- blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false); +- } else if (blockstate.func_215686_e(this, blockpos)) { ++ blockstate.onNeighborChange(this, blockpos, p_175666_1_); ++ if (blockstate.func_215686_e(this, blockpos)) { + blockpos = blockpos.func_177972_a(direction); + blockstate = this.func_180495_p(blockpos); +- if (blockstate.func_177230_c() == Blocks.field_196762_fd) { ++ if (blockstate.getWeakChanges(this, blockpos)) { + blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false); + } + } +@@ -1150,4 +1221,16 @@ + public BiomeManager func_225523_d_() { + return this.field_226689_w_; + } ++ ++ private double maxEntityRadius = 2.0D; ++ @Override ++ public double getMaxEntityRadius() { ++ return maxEntityRadius; ++ } ++ @Override ++ public double increaseMaxEntityRadius(double value) { ++ if (value > maxEntityRadius) ++ maxEntityRadius = value; ++ return maxEntityRadius; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches_old/minecraft/net/minecraft/world/WorldType.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/WorldType.java.patch rename to patches_old/minecraft/net/minecraft/world/WorldType.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/biome/Biome.java.patch b/patches_old/minecraft/net/minecraft/world/biome/Biome.java.patch new file mode 100644 index 000000000..c8999d71f --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/biome/Biome.java.patch @@ -0,0 +1,80 @@ +--- a/net/minecraft/world/biome/Biome.java ++++ b/net/minecraft/world/biome/Biome.java +@@ -54,7 +54,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 Set field_201870_ab = Sets.newHashSet(); + public static final ObjectIntIdentityMap field_185373_j = new ObjectIntIdentityMap<>(); +@@ -143,11 +143,11 @@ + } + + 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(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() { +@@ -196,7 +196,7 @@ + if (this.func_225486_c(p_201854_2_) >= 0.15F) { + return false; + } else { +- if (p_201854_2_.func_177956_o() >= 0 && p_201854_2_.func_177956_o() < 256 && p_201854_1_.func_226658_a_(LightType.BLOCK, p_201854_2_) < 10) { ++ if (p_201854_2_.func_177956_o() >= 0 && p_201854_2_.func_177956_o() < p_201854_1_.func_201675_m().getHeight() && p_201854_1_.func_226658_a_(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) { +@@ -221,7 +221,7 @@ + } else { + if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_226658_a_(LightType.BLOCK, p_201850_2_) < 10) { + 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; + } + } +@@ -375,6 +375,17 @@ + return this.field_185364_H; + } + ++ public Biome getRiver() { ++ if (this == Biomes.field_76774_n) return Biomes.field_76777_m; ++ if (this == Biomes.field_76789_p || this == Biomes.field_76788_q) return Biomes.field_76788_q; ++ return Biomes.field_76781_i; ++ } ++ ++ @Nullable ++ public Biome getHill(net.minecraft.world.gen.INoiseRandom rand) { ++ return null; ++ } ++ + public static class Builder { + @Nullable + private ConfiguredSurfaceBuilder field_205422_a; +@@ -526,6 +537,18 @@ + } + } + ++ public static class FlowerEntry extends WeightedRandom.Item { ++ private final BlockState state; ++ public FlowerEntry(BlockState state, int weight) { ++ super(weight); ++ this.state = state; ++ } ++ ++ public BlockState getState() { ++ return state; ++ } ++ } ++ + public static enum TempCategory { + OCEAN("ocean"), + COLD("cold"), diff --git a/patches_old/minecraft/net/minecraft/world/biome/Biomes.java.patch b/patches_old/minecraft/net/minecraft/world/biome/Biomes.java.patch new file mode 100644 index 000000000..59953600e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/biome/Biomes.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/world/biome/Biomes.java ++++ b/net/minecraft/world/biome/Biomes.java +@@ -4,8 +4,10 @@ + 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()); ++ @net.minecraftforge.registries.ObjectHolder("minecraft:ocean") + public static final Biome field_180279_ad = field_76771_b; + public static final Biome field_76772_c = func_222369_a(1, "plains", new PlainsBiome()); + public static final Biome field_76769_d = func_222369_a(2, "desert", new DesertBiome()); diff --git a/patches/minecraft/net/minecraft/world/biome/DefaultBiomeFeatures.java.patch b/patches_old/minecraft/net/minecraft/world/biome/DefaultBiomeFeatures.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/biome/DefaultBiomeFeatures.java.patch rename to patches_old/minecraft/net/minecraft/world/biome/DefaultBiomeFeatures.java.patch diff --git a/patches/minecraft/net/minecraft/world/biome/provider/BiomeProviderType.java.patch b/patches_old/minecraft/net/minecraft/world/biome/provider/BiomeProviderType.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/biome/provider/BiomeProviderType.java.patch rename to patches_old/minecraft/net/minecraft/world/biome/provider/BiomeProviderType.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches_old/minecraft/net/minecraft/world/border/WorldBorder.java.patch new file mode 100644 index 000000000..fb6822625 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/border/WorldBorder.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/world/border/WorldBorder.java ++++ b/net/minecraft/world/border/WorldBorder.java +@@ -134,6 +134,10 @@ + this.field_177758_a.add(p_177737_1_); + } + ++ public void removeListener(IBorderListener listener) { ++ this.field_177758_a.remove(listener); ++ } ++ + public void func_177725_a(int p_177725_1_) { + this.field_177762_h = p_177725_1_; + this.field_212674_i.func_212652_j(); diff --git a/patches_old/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/Chunk.java.patch new file mode 100644 index 000000000..5f586df5d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -0,0 +1,232 @@ +--- a/net/minecraft/world/chunk/Chunk.java ++++ b/net/minecraft/world/chunk/Chunk.java +@@ -58,7 +58,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-public class Chunk implements IChunk { ++public class Chunk extends net.minecraftforge.common.capabilities.CapabilityProvider implements IChunk, net.minecraftforge.common.extensions.IForgeChunk { + 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]; +@@ -91,6 +91,7 @@ + } + + public Chunk(World p_i225781_1_, ChunkPos p_i225781_2_, BiomeContainer p_i225781_3_, UpgradeData p_i225781_4_, ITickList p_i225781_5_, ITickList p_i225781_6_, long p_i225781_7_, @Nullable ChunkSection[] p_i225781_9_, @Nullable Consumer p_i225781_10_) { ++ super(Chunk.class); + this.field_76645_j = new ClassInheritanceMultiMap[16]; + this.field_76637_e = p_i225781_1_; + this.field_212816_F = p_i225781_2_; +@@ -118,7 +119,7 @@ + field_150817_t.warn("Could not set level chunk sections, array length is {} instead of {}", p_i225781_9_.length, this.field_76652_q.length); + } + } +- ++ this.gatherCapabilities(); + } + + public Chunk(World p_i49947_1_, ChunkPrimer p_i49947_2_) { +@@ -263,14 +264,14 @@ + + if (!this.field_76637_e.field_72995_K) { + blockstate.func_196947_b(this.field_76637_e, p_177436_1_, p_177436_2_, p_177436_3_); +- } else if (block1 != block && block1 instanceof ITileEntityProvider) { ++ } else if ((block1 != block || !p_177436_2_.hasTileEntity()) && blockstate.hasTileEntity()) { + this.field_76637_e.func_175713_t(p_177436_1_); + } + + if (chunksection.func_177485_a(i, j & 15, k).func_177230_c() != block) { + return null; + } else { +- if (block1 instanceof ITileEntityProvider) { ++ if (blockstate.hasTileEntity()) { + TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.CreateEntityType.CHECK); + if (tileentity != null) { + tileentity.func_145836_u(); +@@ -281,10 +282,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.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(); +@@ -320,11 +321,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_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_212816_F.field_77276_a; + p_76612_1_.field_70162_ai = k; + 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_) { +@@ -345,6 +348,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 int func_201576_a(Heightmap.Type p_201576_1_, int p_201576_2_, int p_201576_3_) { +@@ -355,7 +359,7 @@ + private TileEntity func_177422_i(BlockPos p_177422_1_) { + BlockState blockstate = this.func_180495_p(p_177422_1_); + Block block = blockstate.func_177230_c(); +- return !block.func_149716_u() ? null : ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e); ++ return !blockstate.hasTileEntity() ? null : blockstate.createTileEntity(this.field_76637_e); + } + + @Nullable +@@ -366,6 +370,10 @@ + @Nullable + 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) { + CompoundNBT compoundnbt = this.field_201618_i.remove(p_177424_1_); + if (compoundnbt != null) { +@@ -381,9 +389,6 @@ + tileentity = this.func_177422_i(p_177424_1_); + this.field_76637_e.func_175690_a(p_177424_1_, tileentity); + } +- } else if (tileentity.func_145837_r()) { +- this.field_150816_i.remove(p_177424_1_); +- return null; + } + + return tileentity; +@@ -398,7 +403,7 @@ + } + + public void func_177426_a(BlockPos p_177426_1_, TileEntity p_177426_2_) { +- if (this.func_180495_p(p_177426_1_).func_177230_c() instanceof ITileEntityProvider) { ++ if (this.func_180495_p(p_177426_1_).hasTileEntity()) { + p_177426_2_.func_226984_a_(this.field_76637_e, p_177426_1_); + p_177426_2_.func_145829_t(); + TileEntity tileentity = this.field_150816_i.put(p_177426_1_.func_185334_h(), p_177426_2_); +@@ -417,9 +422,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) { +@@ -454,8 +464,8 @@ + } + + 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); ++ int j = MathHelper.func_76128_c((p_177414_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); + +@@ -482,8 +492,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); + +@@ -498,8 +508,8 @@ + } + + public void func_177430_a(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, @Nullable Predicate p_177430_4_) { +- int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - 2.0D) / 16.0D); +- int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + 2.0D) / 16.0D); ++ int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - this.field_76637_e.getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.func_76128_c((p_177430_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); + +@@ -531,6 +541,11 @@ + }; + Sets.newHashSet(this.field_150816_i.keySet()).stream().filter(predicate).forEach(this.field_76637_e::func_175713_t); + ++ for (TileEntity tileEntity : field_150816_i.values()) { ++ tileEntity.func_145836_u(); ++ tileEntity.func_195044_w(); ++ } ++ + for(int i = 0; i < this.field_76652_q.length; ++i) { + ChunkSection chunksection = this.field_76652_q[i]; + if ((p_227073_4_ & 1 << i) == 0) { +@@ -594,7 +609,7 @@ + + public Stream func_217304_m() { + return StreamSupport.stream(BlockPos.func_191531_b(this.field_212816_F.func_180334_c(), 0, this.field_212816_F.func_180333_d(), this.field_212816_F.func_180332_e(), 255, this.field_212816_F.func_180330_f()).spliterator(), false).filter((p_217312_1_) -> { +- return this.func_180495_p(p_217312_1_).func_185906_d() != 0; ++ return this.func_180495_p(p_217312_1_).getLightValue(func_177412_p(), p_217312_1_) != 0; + }); + } + +@@ -699,9 +714,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); ++ 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_)); +@@ -790,4 +805,30 @@ + QUEUED, + CHECK; + } ++ ++ /** ++ * FOR INTERNAL USE ONLY ++ *

++ * Only public for use in {@link AnvilChunkLoader}. ++ */ ++ @java.lang.Deprecated ++ @javax.annotation.Nullable ++ public final CompoundNBT writeCapsToNBT() { ++ return this.serializeCaps(); ++ } ++ ++ /** ++ * FOR INTERNAL USE ONLY ++ *

++ * Only public for use in {@link AnvilChunkLoader}. ++ */ ++ @java.lang.Deprecated ++ public final void readCapsFromNBT(CompoundNBT tag) { ++ this.deserializeCaps(tag); ++ } ++ ++ @Override ++ public World getWorldForge() { ++ return func_177412_p(); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch new file mode 100644 index 000000000..e7ecbf746 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/world/chunk/ChunkPrimer.java ++++ b/net/minecraft/world/chunk/ChunkPrimer.java +@@ -136,13 +136,13 @@ + if (this.field_201661_i[j >> 4] == Chunk.field_186036_a && p_177436_2_.func_177230_c() == Blocks.field_150350_a) { + return p_177436_2_; + } else { +- if (p_177436_2_.func_185906_d() > 0) { ++ if (p_177436_2_.getLightValue(this, p_177436_1_) > 0) { + this.field_201663_k.add(new BlockPos((i & 15) + this.func_76632_l().func_180334_c(), j, (k & 15) + this.func_76632_l().func_180333_d())); + } + + ChunkSection chunksection = this.func_217332_a(j >> 4); + BlockState blockstate = chunksection.func_222629_a(i & 15, j & 15, k & 15, p_177436_2_); +- if (this.field_201658_f.func_209003_a(ChunkStatus.field_222613_i) && p_177436_2_ != blockstate && (p_177436_2_.func_200016_a(this, p_177436_1_) != blockstate.func_200016_a(this, p_177436_1_) || p_177436_2_.func_185906_d() != blockstate.func_185906_d() || p_177436_2_.func_215691_g() || blockstate.func_215691_g())) { ++ if (this.field_201658_f.func_209003_a(ChunkStatus.field_222613_i) && p_177436_2_ != blockstate && (p_177436_2_.func_200016_a(this, p_177436_1_) != blockstate.func_200016_a(this, p_177436_1_) || p_177436_2_.getLightValue(this, p_177436_1_) != blockstate.getLightValue(this, p_177436_1_) || p_177436_2_.func_215691_g() || blockstate.func_215691_g())) { + WorldLightManager worldlightmanager = this.func_217307_e(); + worldlightmanager.func_215568_a(p_177436_1_); + } diff --git a/patches_old/minecraft/net/minecraft/world/chunk/ChunkStatus.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/ChunkStatus.java.patch new file mode 100644 index 000000000..2517f3b45 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/chunk/ChunkStatus.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/chunk/ChunkStatus.java ++++ b/net/minecraft/world/chunk/ChunkStatus.java +@@ -23,7 +23,7 @@ + import net.minecraft.world.server.ServerWorld; + import net.minecraft.world.server.ServerWorldLightManager; + +-public class ChunkStatus { ++public class ChunkStatus extends net.minecraftforge.registries.ForgeRegistryEntry { + private static final EnumSet field_222618_n = EnumSet.of(Heightmap.Type.OCEAN_FLOOR_WG, Heightmap.Type.WORLD_SURFACE_WG); + private static final EnumSet field_222619_o = EnumSet.of(Heightmap.Type.OCEAN_FLOOR, Heightmap.Type.WORLD_SURFACE, Heightmap.Type.MOTION_BLOCKING, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES); + private static final ChunkStatus.ILoadingWorker field_223211_p = (p_222588_0_, p_222588_1_, p_222588_2_, p_222588_3_, p_222588_4_, p_222588_5_) -> { diff --git a/patches_old/minecraft/net/minecraft/world/chunk/IChunk.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/IChunk.java.patch new file mode 100644 index 000000000..d430dfe3d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/chunk/IChunk.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/world/chunk/IChunk.java ++++ b/net/minecraft/world/chunk/IChunk.java +@@ -151,4 +151,9 @@ + boolean func_217310_r(); + + void func_217305_b(boolean p_217305_1_); ++ ++ @Nullable ++ default net.minecraft.world.IWorld getWorldForge() { ++ return null; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch new file mode 100644 index 000000000..269b4f4e2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch @@ -0,0 +1,59 @@ +--- a/net/minecraft/world/chunk/storage/ChunkSerializer.java ++++ b/net/minecraft/world/chunk/storage/ChunkSerializer.java +@@ -131,6 +131,7 @@ + ichunk = new Chunk(p_222656_0_.func_201672_e(), p_222656_3_, biomecontainer, upgradedata, iticklist, iticklist1, k1, 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, chunkprimerticklist, chunkprimerticklist1); + chunkprimer.func_225548_a_(biomecontainer); +@@ -143,7 +144,7 @@ + + if (!flag && chunkprimer.func_201589_g().func_209003_a(ChunkStatus.field_222614_j)) { + for(BlockPos blockpos : BlockPos.func_191531_b(p_222656_3_.func_180334_c(), 0, p_222656_3_.func_180333_d(), p_222656_3_.func_180332_e(), 255, p_222656_3_.func_180330_f())) { +- if (ichunk.func_180495_p(blockpos).func_185906_d() != 0) { ++ if (ichunk.func_180495_p(blockpos).getLightValue(ichunk, blockpos) != 0) { + chunkprimer.func_201637_h(blockpos); + } + } +@@ -182,6 +183,7 @@ + } + + if (chunkstatus$type == ChunkStatus.Type.LEVELCHUNK) { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Load(ichunk, compoundnbt, chunkstatus$type)); + return new ChunkPrimerWrapper((Chunk)ichunk); + } else { + ChunkPrimer chunkprimer1 = (ChunkPrimer)ichunk; +@@ -215,6 +217,8 @@ + chunkprimer1.func_205767_a(generationstage$carving, BitSet.valueOf(compoundnbt5.func_74770_j(s1))); + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Load(ichunk, compoundnbt, chunkstatus$type)); ++ + return chunkprimer1; + } + } +@@ -294,12 +298,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()); diff --git a/patches_old/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch new file mode 100644 index 000000000..aa33bb3bd --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -0,0 +1,102 @@ +--- a/net/minecraft/world/chunk/storage/RegionFile.java ++++ b/net/minecraft/world/chunk/storage/RegionFile.java +@@ -33,6 +33,7 @@ + private final IntBuffer field_76716_d; + private final IntBuffer field_227127_h_; + private final RegionBitmap field_227128_i_ = new RegionBitmap(); ++ private final Path filePath; + + public RegionFile(File p_i225784_1_, File p_i225784_2_) throws IOException { + this(p_i225784_1_.toPath(), p_i225784_2_.toPath(), RegionFileVersion.field_227159_b_); +@@ -40,6 +41,7 @@ + + public RegionFile(Path p_i225785_1_, Path p_i225785_2_, RegionFileVersion p_i225785_3_) throws IOException { + this.field_227125_e_ = p_i225785_3_; ++ this.filePath = p_i225785_1_; + if (!Files.isDirectory(p_i225785_2_)) { + throw new IllegalArgumentException("Expected directory, got " + p_i225785_2_.toAbsolutePath()); + } else { +@@ -62,6 +64,8 @@ + if (k != 0) { + int l = func_227142_b_(k); + int i1 = func_227131_a_(k); ++ if (i1 == 255) ++ i1 = forgeGetRealLength(j, l); + this.field_227128_i_.func_227120_a_(l, i1); + } + } +@@ -70,6 +74,66 @@ + } + } + ++ private int forgeGetRealLength(int index, int offset) throws IOException { ++ int chunkX = index & 31; ++ int chunkZ = (index >> 5) & 31; ++ ++ ByteBuffer header = ByteBuffer.allocate(5); ++ this.field_76719_c.read(header, offset * 4096); ++ ((Buffer)header).flip(); ++ ++ if (header.remaining() < 5) { ++ field_227122_a_.error("Chunk {},{} in {} header is truncated: expected 5 but read {}", chunkX, chunkZ, this.filePath.getFileName(), header.remaining()); ++ return 255; ++ } ++ ++ return (header.getInt() + 4) / 4096 + 1; ++ } ++ ++ /** ++ * In 1.14, Forge added support for large chunks by allowing it to overflow the 255 section limit. ++ * Deferring the section size to the 'length' header in front of the chunk data. ++ * In 1.15, Mojang solved this issue by adding an external '.mcc' file for large chunks. ++ * Here, we attempt to detect and extract these large chunks from Forge's format to Vanilla's ++ */ ++ public RegionFile extractLargeChunks(ChunkPos pos) throws IOException { ++ ChunkPos regionBase = new ChunkPos(pos.func_222241_h() * 32, pos.func_222242_i() * 32); ++ for (int index = 0; index < 1024; index++) { ++ int offset = this.field_76716_d.get(index); ++ if (func_227131_a_(offset) != 255) //If it's not 255, then it's not possible to be a oversized chunk. Move on. ++ continue; ++ offset = func_227142_b_(offset); ++ ++ ChunkPos chunk = new ChunkPos(regionBase.field_77276_a + (index & 31), regionBase.field_77275_b + ((index >> 5) & 31)); ++ ++ ByteBuffer header = ByteBuffer.allocate(5); ++ this.field_76719_c.read(header, offset * 4096); ++ ((Buffer)header).flip(); ++ ++ if (header.remaining() < 5) { ++ field_227122_a_.error("Chunk {} in {} header is truncated: expected 5 but read {}", chunk, this.filePath.getFileName(), header.remaining()); ++ continue; ++ } ++ ++ int length = header.getInt(); ++ byte version = header.get(); ++ int sectors = (length + 4) / 4096 + 1; ++ if (sectors <= 255 || func_227130_a_(version)) ++ continue; //Not over sized, or already external ++ ++ ByteBuffer data = ByteBuffer.allocate(length + 4); ++ this.field_76719_c.read(data, offset * 4096); ++ ((Buffer)data).flip(); ++ ++ if (data.remaining() < length + 4) { ++ field_227122_a_.error("Chunk {} in {} is truncated: expected {} but read {}", chunk, this.filePath.getFileName(), length + 4, data.remaining()); ++ continue; ++ } ++ func_227135_a_(chunk, data); //Save the chunk data, it'll be spit out to an external file. ++ } ++ return this; ++ } ++ + private Path func_227145_e_(ChunkPos p_227145_1_) { + String s = "c." + p_227145_1_.field_77276_a + "." + p_227145_1_.field_77275_b + ".mcc"; + return this.field_227124_d_.resolve(s); +@@ -225,6 +289,7 @@ + int j = this.field_76716_d.get(i); + int k = func_227142_b_(j); + int l = func_227131_a_(j); ++ if (l == 255) l = forgeGetRealLength(i, k); //Forge: Old Forge fix, get real length, so we can free if needed + int i1 = p_227135_2_.remaining(); + int j1 = func_227144_c_(i1); + int k1; diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java.patch rename to patches_old/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java.patch diff --git a/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch b/patches_old/minecraft/net/minecraft/world/dimension/Dimension.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch rename to patches_old/minecraft/net/minecraft/world/dimension/Dimension.java.patch diff --git a/patches/minecraft/net/minecraft/world/dimension/DimensionType.java.patch b/patches_old/minecraft/net/minecraft/world/dimension/DimensionType.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/dimension/DimensionType.java.patch rename to patches_old/minecraft/net/minecraft/world/dimension/DimensionType.java.patch diff --git a/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch b/patches_old/minecraft/net/minecraft/world/dimension/EndDimension.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch rename to patches_old/minecraft/net/minecraft/world/dimension/EndDimension.java.patch diff --git a/patches/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch b/patches_old/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch rename to patches_old/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch diff --git a/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch b/patches_old/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch rename to patches_old/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/end/DragonFightManager.java.patch b/patches_old/minecraft/net/minecraft/world/end/DragonFightManager.java.patch new file mode 100644 index 000000000..e53ba433b --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/end/DragonFightManager.java.patch @@ -0,0 +1,50 @@ +--- a/net/minecraft/world/end/DragonFightManager.java ++++ b/net/minecraft/world/end/DragonFightManager.java +@@ -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"); ++ this.field_186120_n = !p_i46669_2_.func_74767_n("LegacyScanPerformed"); // Forge: fix MC-105080 + if (p_i46669_2_.func_74767_n("IsRespawning")) { + this.field_186122_p = DragonSpawnState.START; + } +@@ -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())); + } + + 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 @@ + + 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)); + } +@@ -492,6 +494,13 @@ + endercrystalentity.func_184516_a((BlockPos)null); + } + } ++ } + ++ public void addPlayer(ServerPlayerEntity player) { ++ this.field_186109_c.func_186760_a(player); + } ++ ++ public void removePlayer(ServerPlayerEntity player) { ++ this.field_186109_c.func_186761_b(player); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch b/patches_old/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkGeneratorType.java.patch b/patches_old/minecraft/net/minecraft/world/gen/ChunkGeneratorType.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/ChunkGeneratorType.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/ChunkGeneratorType.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/gen/IWorldGenerationBaseReader.java.patch b/patches_old/minecraft/net/minecraft/world/gen/IWorldGenerationBaseReader.java.patch new file mode 100644 index 000000000..36577a381 --- /dev/null +++ b/patches_old/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_old/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch b/patches_old/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch new file mode 100644 index 000000000..b9ce49b05 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/world/gen/NoiseChunkGenerator.java ++++ b/net/minecraft/world/gen/NoiseChunkGenerator.java +@@ -378,8 +378,8 @@ + } + + if (blockstate != field_222562_i) { +- if (blockstate.func_185906_d() != 0) { +- blockpos$mutable.func_181079_c(j3, j2, i4); ++ blockpos$mutable.func_181079_c(j3, j2, i4); ++ if (blockstate.getLightValue(chunkprimer, blockpos$mutable) != 0) { + chunkprimer.func_201637_h(blockpos$mutable); + } + diff --git a/patches_old/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch b/patches_old/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch new file mode 100644 index 000000000..024973d21 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch @@ -0,0 +1,62 @@ +--- a/net/minecraft/world/gen/WorldGenRegion.java ++++ b/net/minecraft/world/gen/WorldGenRegion.java +@@ -164,11 +164,11 @@ + + public boolean func_225521_a_(BlockPos p_225521_1_, boolean p_225521_2_, @Nullable Entity p_225521_3_) { + BlockState blockstate = this.func_180495_p(p_225521_1_); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(this, p_225521_1_)) { + return false; + } else { + if (p_225521_2_) { +- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? this.func_175625_s(p_225521_1_) : null; ++ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_225521_1_) : null; + Block.func_220054_a(blockstate, this.field_201689_f, p_225521_1_, tileentity, p_225521_3_, ItemStack.field_190927_a); + } + +@@ -186,12 +186,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(compoundnbt); + } +@@ -202,7 +202,7 @@ + } + } + +- if (ichunk.func_180495_p(p_175625_1_).func_177230_c() instanceof ITileEntityProvider) { ++ if (ichunk.func_180495_p(p_175625_1_).hasTileEntity()) { + field_208303_a.warn("Tried to access a block entity before it was created. {}", (Object)p_175625_1_); + } + +@@ -218,9 +218,9 @@ + } + + Block block = p_180501_2_.func_177230_c(); +- if (block.func_149716_u()) { ++ if (p_180501_2_.hasTileEntity()) { + if (ichunk.func_201589_g().func_202129_d() == ChunkStatus.Type.LEVELCHUNK) { +- 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 { + CompoundNBT compoundnbt = new CompoundNBT(); + compoundnbt.func_74768_a("x", p_180501_1_.func_177958_n()); +@@ -229,7 +229,7 @@ + compoundnbt.func_74778_a("id", "DUMMY"); + ichunk.func_201591_a(compoundnbt); + } +- } 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_old/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch b/patches_old/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch new file mode 100644 index 000000000..3b7663ee3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/blockplacer/BlockPlacerType.java ++++ b/net/minecraft/world/gen/blockplacer/BlockPlacerType.java +@@ -4,7 +4,7 @@ + import java.util.function.Function; + import net.minecraft.util.registry.Registry; + +-public class BlockPlacerType

{ ++public class BlockPlacerType

extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final BlockPlacerType field_227259_a_ = func_227264_a_("simple_block_placer", SimpleBlockPlacer::new); + public static final BlockPlacerType field_227260_b_ = func_227264_a_("double_plant_placer", DoublePlantBlockPlacer::new); + public static final BlockPlacerType field_227261_c_ = func_227264_a_("column_placer", ColumnBlockPlacer::new); diff --git a/patches_old/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch b/patches_old/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch new file mode 100644 index 000000000..0a4da6d68 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java ++++ b/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java +@@ -4,7 +4,7 @@ + import java.util.function.Function; + import net.minecraft.util.registry.Registry; + +-public class BlockStateProviderType

{ ++public class BlockStateProviderType

extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final BlockStateProviderType field_227394_a_ = func_227400_a_("simple_state_provider", SimpleBlockStateProvider::new); + public static final BlockStateProviderType field_227395_b_ = func_227400_a_("weighted_state_provider", WeightedBlockStateProvider::new); + public static final BlockStateProviderType field_227396_c_ = func_227400_a_("plain_flower_provider", PlainFlowerBlockStateProvider::new); diff --git a/patches_old/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch b/patches_old/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch new file mode 100644 index 000000000..bdaef4183 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/carver/WorldCarver.java ++++ b/net/minecraft/world/gen/carver/WorldCarver.java +@@ -22,7 +22,7 @@ + import net.minecraft.world.chunk.IChunk; + import net.minecraft.world.gen.feature.ProbabilityConfig; + +-public abstract class WorldCarver { ++public abstract class WorldCarver extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final WorldCarver field_222709_a = func_222699_a("cave", new CaveWorldCarver(ProbabilityConfig::func_214645_a, 256)); + public static final WorldCarver field_222710_b = func_222699_a("hell_cave", new NetherCaveWorldCarver(ProbabilityConfig::func_214645_a)); + public static final WorldCarver field_222711_c = func_222699_a("canyon", new CanyonWorldCarver(ProbabilityConfig::func_214645_a)); diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch new file mode 100644 index 000000000..c2e5bd6b8 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java ++++ b/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java +@@ -20,7 +20,7 @@ + protected void func_227210_a_(IWorld p_227210_1_, Random p_227210_2_, BlockPos p_227210_3_, BigMushroomFeatureConfig p_227210_4_, int p_227210_5_, BlockPos.Mutable p_227210_6_) { + for(int i = 0; i < p_227210_5_; ++i) { + p_227210_6_.func_189533_g(p_227210_3_).func_189534_c(Direction.UP, i); +- if (!p_227210_1_.func_180495_p(p_227210_6_).func_200015_d(p_227210_1_, p_227210_6_)) { ++ if (p_227210_1_.func_180495_p(p_227210_6_).canBeReplacedByLogs(p_227210_1_, p_227210_6_)) { + this.func_202278_a(p_227210_1_, p_227210_6_, p_227210_4_.field_227273_b_.func_225574_a_(p_227210_2_, p_227210_3_)); + } + } +@@ -38,7 +38,7 @@ + + protected boolean func_227209_a_(IWorld p_227209_1_, BlockPos p_227209_2_, int p_227209_3_, BlockPos.Mutable p_227209_4_, BigMushroomFeatureConfig p_227209_5_) { + int i = p_227209_2_.func_177956_o(); +- if (i >= 1 && i + p_227209_3_ + 1 < 256) { ++ if (i >= 1 && i + p_227209_3_ + 1 < p_227209_1_.getMaxHeight()) { + Block block = p_227209_1_.func_180495_p(p_227209_2_.func_177977_b()).func_177230_c(); + if (!func_227250_b_(block)) { + return false; +@@ -49,7 +49,7 @@ + for(int l = -k; l <= k; ++l) { + for(int i1 = -k; i1 <= k; ++i1) { + BlockState blockstate = p_227209_1_.func_180495_p(p_227209_4_.func_189533_g(p_227209_2_).func_196234_d(l, j, i1)); +- if (!blockstate.func_196958_f() && !blockstate.func_203425_a(BlockTags.field_206952_E)) { ++ if (!blockstate.isAir(p_227209_1_, p_227209_4_) && !blockstate.func_203425_a(BlockTags.field_206952_E)) { + return false; + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/AbstractSmallTreeFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/AbstractSmallTreeFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/AbstractSmallTreeFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/AbstractSmallTreeFeature.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/AcaciaFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/AcaciaFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/AcaciaFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/AcaciaFeature.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch new file mode 100644 index 000000000..790cce939 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch @@ -0,0 +1,58 @@ +--- a/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java ++++ b/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java +@@ -17,6 +17,7 @@ + public final List field_227370_o_; + public final int field_227371_p_; + public transient boolean field_227372_q_; ++ protected net.minecraftforge.common.IPlantable sapling = (net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196674_t; + + protected BaseTreeFeatureConfig(BlockStateProvider p_i225842_1_, BlockStateProvider p_i225842_2_, List p_i225842_3_, int p_i225842_4_) { + this.field_227368_m_ = p_i225842_1_; +@@ -37,6 +38,15 @@ + return new Dynamic<>(p_214634_1_, p_214634_1_.createMap(builder.build())); + } + ++ protected BaseTreeFeatureConfig setSapling(net.minecraftforge.common.IPlantable value) { ++ this.sapling = value; ++ return this; ++ } ++ ++ public net.minecraftforge.common.IPlantable getSapling() { ++ return this.sapling; ++ } ++ + public static BaseTreeFeatureConfig func_227376_b_(Dynamic p_227376_0_) { + BlockStateProviderType blockstateprovidertype = Registry.field_229387_t_.func_82594_a(new ResourceLocation(p_227376_0_.get("trunk_provider").get("type").asString().orElseThrow(RuntimeException::new))); + BlockStateProviderType blockstateprovidertype1 = Registry.field_229387_t_.func_82594_a(new ResourceLocation(p_227376_0_.get("leaves_provider").get("type").asString().orElseThrow(RuntimeException::new))); +@@ -45,11 +55,16 @@ + }), p_227376_0_.get("base_height").asInt(0)); + } + ++ public static BaseTreeFeatureConfig deserializeJungle(Dynamic data) { ++ return func_227376_b_(data).setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196678_w); ++ } ++ + public static class Builder { + public final BlockStateProvider field_227377_a_; + public final BlockStateProvider field_227378_b_; + private List field_227379_c_ = Lists.newArrayList(); + private int field_227380_d_ = 0; ++ protected net.minecraftforge.common.IPlantable sapling = (net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196674_t; + + public Builder(BlockStateProvider p_i225843_1_, BlockStateProvider p_i225843_2_) { + this.field_227377_a_ = p_i225843_1_; +@@ -61,8 +76,13 @@ + return this; + } + ++ public BaseTreeFeatureConfig.Builder setSapling(net.minecraftforge.common.IPlantable value) { ++ this.sapling = value; ++ return this; ++ } ++ + public BaseTreeFeatureConfig func_225568_b_() { +- return new BaseTreeFeatureConfig(this.field_227377_a_, this.field_227378_b_, this.field_227379_c_, this.field_227380_d_); ++ return new BaseTreeFeatureConfig(this.field_227377_a_, this.field_227378_b_, this.field_227379_c_, this.field_227380_d_).setSapling(sapling); + } + } + } diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch new file mode 100644 index 000000000..3da0500fd --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java ++++ b/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java +@@ -25,7 +25,7 @@ + boolean flag5 = flag2 || flag3; + if (!flag4 || !flag5) { + p_225564_5_.func_189533_g(p_225564_3_).func_196234_d(j, p_225564_4_, k); +- if (!p_225564_1_.func_180495_p(p_225564_5_).func_200015_d(p_225564_1_, p_225564_5_)) { ++ if (p_225564_1_.func_180495_p(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) { + boolean flag6 = flag || flag5 && j == 1 - i; + boolean flag7 = flag1 || flag5 && j == i - 1; + boolean flag8 = flag2 || flag4 && k == 1 - i; diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch new file mode 100644 index 000000000..24a938f0d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/feature/BigRedMushroomFeature.java ++++ b/net/minecraft/world/gen/feature/BigRedMushroomFeature.java +@@ -27,7 +27,7 @@ + boolean flag5 = flag2 || flag3; + if (i >= p_225564_4_ || flag4 != flag5) { + p_225564_5_.func_189533_g(p_225564_3_).func_196234_d(l, i, i1); +- if (!p_225564_1_.func_180495_p(p_225564_5_).func_200015_d(p_225564_1_, p_225564_5_)) { ++ if (p_225564_1_.func_180495_p(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) { + this.func_202278_a(p_225564_1_, p_225564_5_, p_225564_6_.field_227272_a_.func_225574_a_(p_225564_2_, p_225564_3_).func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(i >= p_225564_4_ - 1)).func_206870_a(HugeMushroomBlock.field_196464_y, Boolean.valueOf(l < -k)).func_206870_a(HugeMushroomBlock.field_196461_b, Boolean.valueOf(l > k)).func_206870_a(HugeMushroomBlock.field_196459_a, Boolean.valueOf(i1 < -k)).func_206870_a(HugeMushroomBlock.field_196463_c, Boolean.valueOf(i1 > k))); + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/Feature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/Feature.java.patch new file mode 100644 index 000000000..10fb17c5c --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/Feature.java.patch @@ -0,0 +1,52 @@ +--- a/net/minecraft/world/gen/feature/Feature.java ++++ b/net/minecraft/world/gen/feature/Feature.java +@@ -43,7 +43,7 @@ + import net.minecraft.world.gen.feature.structure.WoodlandMansionStructure; + import net.minecraft.world.gen.placement.CountConfig; + +-public abstract class Feature { ++public abstract class Feature extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final Structure field_214536_b = func_214468_a("pillager_outpost", new PillagerOutpostStructure(NoFeatureConfig::func_214639_a)); + public static final Structure field_202329_g = func_214468_a("mineshaft", new MineshaftStructure(MineshaftConfig::func_214638_a)); + public static final Structure field_202330_h = func_214468_a("woodland_mansion", new WoodlandMansionStructure(NoFeatureConfig::func_214639_a)); +@@ -61,12 +61,12 @@ + public static final Structure field_214550_p = func_214468_a("village", new VillageStructure(VillageConfig::func_214679_a)); + public static final Feature field_227245_q_ = func_214468_a("no_op", new NoOpFeature(NoFeatureConfig::func_214639_a)); + public static final Feature field_202301_A = func_214468_a("normal_tree", new TreeFeature(TreeFeatureConfig::func_227338_a_)); +- public static final Feature field_227246_s_ = func_214468_a("acacia_tree", new AcaciaFeature(TreeFeatureConfig::func_227338_a_)); ++ public static final Feature field_227246_s_ = func_214468_a("acacia_tree", new AcaciaFeature(TreeFeatureConfig::deserializeAcacia)); + public static final Feature field_202339_q = func_214468_a("fancy_tree", new FancyTreeFeature(TreeFeatureConfig::func_227338_a_)); +- public static final Feature field_202342_t = func_214468_a("jungle_ground_bush", new ShrubFeature(BaseTreeFeatureConfig::func_227376_b_)); +- public static final Feature field_214551_w = func_214468_a("dark_oak_tree", new DarkOakTreeFeature(HugeTreeFeatureConfig::func_227277_a_)); +- public static final Feature field_202302_B = func_214468_a("mega_jungle_tree", new MegaJungleFeature(HugeTreeFeatureConfig::func_227277_a_)); +- public static final Feature field_202304_D = func_214468_a("mega_spruce_tree", new MegaPineTree(HugeTreeFeatureConfig::func_227277_a_)); ++ public static final Feature field_202342_t = func_214468_a("jungle_ground_bush", new ShrubFeature(BaseTreeFeatureConfig::deserializeJungle)); ++ public static final Feature field_214551_w = func_214468_a("dark_oak_tree", new DarkOakTreeFeature(HugeTreeFeatureConfig::deserializeDarkOak)); ++ public static final Feature field_202302_B = func_214468_a("mega_jungle_tree", new MegaJungleFeature(HugeTreeFeatureConfig::deserializeJungle)); ++ public static final Feature field_202304_D = func_214468_a("mega_spruce_tree", new MegaPineTree(HugeTreeFeatureConfig::deserializeSpruce)); + public static final FlowersFeature field_227247_y_ = func_214468_a("flower", new DefaultFlowersFeature(BlockClusterFeatureConfig::func_227300_a_)); + public static final Feature field_227248_z_ = func_214468_a("random_patch", new RandomPatchFeature(BlockClusterFeatureConfig::func_227300_a_)); + public static final Feature field_227244_A_ = func_214468_a("block_pile", new BlockPileFeature(BlockStateProvidingFeatureConfig::func_227269_a_)); +@@ -109,7 +109,8 @@ + public static final Feature field_202293_am = func_214468_a("random_boolean_selector", new TwoFeatureChoiceFeature(TwoFeatureChoiceConfig::func_227287_a_)); + public static final Feature field_214483_aK = func_214468_a("decorated", new DecoratedFeature(DecoratedFeatureConfig::func_214688_a)); + public static final Feature field_214484_aL = func_214468_a("decorated_flower", new DecoratedFlowerFeature(DecoratedFeatureConfig::func_214688_a)); +- public static final BiMap> field_202300_at = Util.func_200696_a(HashBiMap.create(), (p_205170_0_) -> { ++ public static final BiMap> field_202300_at = Util.func_200696_a(net.minecraftforge.registries.GameData.getStructureMap(), (p_205170_0_) -> { ++ if (true) return; // Forge: This is now a slave map to the feature registry, leave this code here to reduce patch size + p_205170_0_.put("Pillager_Outpost".toLowerCase(Locale.ROOT), field_214536_b); + p_205170_0_.put("Mineshaft".toLowerCase(Locale.ROOT), field_202329_g); + p_205170_0_.put("Mansion".toLowerCase(Locale.ROOT), field_202330_h); +@@ -160,10 +161,10 @@ + } + + protected static boolean func_227249_a_(Block p_227249_0_) { +- return p_227249_0_ == Blocks.field_150348_b || p_227249_0_ == Blocks.field_196650_c || p_227249_0_ == Blocks.field_196654_e || p_227249_0_ == Blocks.field_196656_g; ++ return net.minecraftforge.common.Tags.Blocks.STONE.func_199685_a_(p_227249_0_); + } + + protected static boolean func_227250_b_(Block p_227250_0_) { +- return p_227250_0_ == Blocks.field_150346_d || p_227250_0_ == Blocks.field_196658_i || p_227250_0_ == Blocks.field_196661_l || p_227250_0_ == Blocks.field_196660_k || p_227250_0_ == Blocks.field_150391_bh; ++ return net.minecraftforge.common.Tags.Blocks.DIRT.func_199685_a_(p_227250_0_); + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/FlowersFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/FlowersFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/FlowersFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/FlowersFeature.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch new file mode 100644 index 000000000..d156b86a5 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch @@ -0,0 +1,28 @@ +--- a/net/minecraft/world/gen/feature/IceSpikeFeature.java ++++ b/net/minecraft/world/gen/feature/IceSpikeFeature.java +@@ -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))) { + 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() || func_227250_b_(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)) || func_227250_b_(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) { + 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() || func_227250_b_(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)) || func_227250_b_(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()); + } + } +@@ -78,7 +78,7 @@ + while(blockpos.func_177956_o() > 50) { + BlockState blockstate1 = p_212245_1_.func_180495_p(blockpos); + Block block1 = blockstate1.func_177230_c(); +- if (!blockstate1.func_196958_f() && !func_227250_b_(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { ++ if (!blockstate1.isAir(p_212245_1_, blockpos) && !func_227250_b_(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/MegaJungleFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/OreFeatureConfig.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/OreFeatureConfig.java.patch new file mode 100644 index 000000000..633959e63 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/OreFeatureConfig.java.patch @@ -0,0 +1,27 @@ +--- a/net/minecraft/world/gen/feature/OreFeatureConfig.java ++++ b/net/minecraft/world/gen/feature/OreFeatureConfig.java +@@ -34,7 +34,7 @@ + return new OreFeatureConfig(orefeatureconfig$fillerblocktype, blockstate, i); + } + +- public static enum FillerBlockType { ++ public static enum FillerBlockType implements net.minecraftforge.common.IExtensibleEnum { + NATURAL_STONE("natural_stone", (p_214739_0_) -> { + if (p_214739_0_ == null) { + return false; +@@ -67,5 +67,15 @@ + public Predicate func_214738_b() { + return this.field_214743_e; + } ++ ++ public static FillerBlockType create(String enumName, String p_i50618_3_, Predicate p_i50618_4_) { ++ throw new IllegalStateException("Enum not extended"); ++ } ++ ++ @Override ++ @Deprecated ++ public void init() { ++ field_214741_c.put(func_214737_a(), this); ++ } + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/TreeFeatureConfig.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/TreeFeatureConfig.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/TreeFeatureConfig.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/TreeFeatureConfig.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch new file mode 100644 index 000000000..fb7478745 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch @@ -0,0 +1,27 @@ +--- a/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java ++++ b/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java +@@ -72,7 +72,7 @@ + return this.field_214953_e.size(); + } + +- public static enum PlacementBehaviour { ++ public static enum PlacementBehaviour implements net.minecraftforge.common.IExtensibleEnum { + TERRAIN_MATCHING("terrain_matching", ImmutableList.of(new GravityStructureProcessor(Heightmap.Type.WORLD_SURFACE_WG, -1))), + RIGID("rigid", ImmutableList.of()); + +@@ -98,5 +98,15 @@ + public ImmutableList func_214937_b() { + return this.field_214941_e; + } ++ ++ public static PlacementBehaviour create(String enumName, String p_i50487_3_, ImmutableList p_i50487_4_) { ++ throw new IllegalStateException("Enum not extended"); ++ } ++ ++ @Override ++ @Deprecated ++ public void init() { ++ field_214939_c.put(func_214936_a(), this); ++ } + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch new file mode 100644 index 000000000..4dab4c2d6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/feature/structure/MineshaftPieces.java ++++ b/net/minecraft/world/gen/feature/structure/MineshaftPieces.java +@@ -207,7 +207,7 @@ + + protected boolean func_186167_a(IWorld p_186167_1_, MutableBoundingBox p_186167_2_, Random p_186167_3_, int p_186167_4_, int p_186167_5_, int p_186167_6_, ResourceLocation p_186167_7_) { + BlockPos blockpos = new BlockPos(this.func_74865_a(p_186167_4_, p_186167_6_), this.func_74862_a(p_186167_5_), this.func_74873_b(p_186167_4_, p_186167_6_)); +- if (p_186167_2_.func_175898_b(blockpos) && p_186167_1_.func_180495_p(blockpos).func_196958_f() && !p_186167_1_.func_180495_p(blockpos.func_177977_b()).func_196958_f()) { ++ if (p_186167_2_.func_175898_b(blockpos) && p_186167_1_.func_180495_p(blockpos).isAir(p_186167_1_, blockpos) && !p_186167_1_.func_180495_p(blockpos.func_177977_b()).isAir(p_186167_1_, blockpos.func_177977_b())) { + BlockState blockstate = Blocks.field_150448_aq.func_176223_P().func_206870_a(RailBlock.field_176565_b, p_186167_3_.nextBoolean() ? RailShape.NORTH_SOUTH : RailShape.EAST_WEST); + this.func_175811_a(p_186167_1_, blockstate, p_186167_4_, p_186167_5_, p_186167_6_, p_186167_2_); + ChestMinecartEntity chestminecartentity = new ChestMinecartEntity(p_186167_1_.func_201672_e(), (double)((float)blockpos.func_177958_n() + 0.5F), (double)((float)blockpos.func_177956_o() + 0.5F), (double)((float)blockpos.func_177952_p() + 0.5F)); diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch new file mode 100644 index 000000000..25ded3773 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/world/gen/feature/structure/StructurePiece.java ++++ b/net/minecraft/world/gen/feature/structure/StructurePiece.java +@@ -56,6 +56,9 @@ + } + + 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"); ++ } + 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_old/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch new file mode 100644 index 000000000..007d1d630 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/world/gen/feature/structure/StructureStart.java ++++ b/net/minecraft/world/gen/feature/structure/StructureStart.java +@@ -77,6 +77,9 @@ + public CompoundNBT func_143021_a(int p_143021_1_, int p_143021_2_) { + CompoundNBT compoundnbt = new CompoundNBT(); + if (this.func_75069_d()) { ++ 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"); ++ } + compoundnbt.func_74778_a("id", Registry.field_218361_B.func_177774_c(this.func_214627_k()).toString()); + compoundnbt.func_74768_a("ChunkX", p_143021_1_); + compoundnbt.func_74768_a("ChunkZ", p_143021_2_); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/Structures.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/structure/Structures.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/structure/Structures.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/structure/Structures.java.patch diff --git a/patches/minecraft/net/minecraft/world/gen/feature/template/StructureProcessor.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/template/StructureProcessor.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/feature/template/StructureProcessor.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/template/StructureProcessor.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch new file mode 100644 index 000000000..8e8af4b8f --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch @@ -0,0 +1,98 @@ +--- a/net/minecraft/world/gen/feature/template/Template.java ++++ b/net/minecraft/world/gen/feature/template/Template.java +@@ -152,6 +152,11 @@ + return func_207669_a(p_186266_1_, p_186266_0_.func_186212_b(), p_186266_0_.func_186215_c(), p_186266_0_.func_207664_d()); + } + ++ // FORGE: Add overload accepting Vec3d ++ public static Vec3d transformedVec3d(PlacementSettings p_186266_0_, Vec3d p_186266_1_) { ++ return func_207667_a(p_186266_1_, p_186266_0_.func_186212_b(), p_186266_0_.func_186215_c(), p_186266_0_.func_207664_d()); ++ } ++ + public void func_186260_a(IWorld p_186260_1_, BlockPos p_186260_2_, PlacementSettings p_186260_3_) { + p_186260_3_.func_186224_i(); + this.func_186253_b(p_186260_1_, p_186260_2_, p_186260_3_); +@@ -177,7 +182,7 @@ + int i1 = Integer.MIN_VALUE; + int j1 = Integer.MIN_VALUE; + +- for(Template.BlockInfo template$blockinfo : func_215387_a(p_189962_1_, p_189962_2_, p_189962_3_, list)) { ++ for(Template.BlockInfo template$blockinfo : processBlockInfos(this, p_189962_1_, p_189962_2_, p_189962_3_, list)) { + BlockPos blockpos = template$blockinfo.field_186242_a; + if (mutableboundingbox == null || mutableboundingbox.func_175898_b(blockpos)) { + IFluidState ifluidstate = p_189962_3_.func_204763_l() ? p_189962_1_.func_204610_c(blockpos) : null; +@@ -288,7 +293,7 @@ + } + + if (!p_189962_3_.func_186221_e()) { +- this.func_207668_a(p_189962_1_, p_189962_2_, p_189962_3_.func_186212_b(), p_189962_3_.func_186215_c(), p_189962_3_.func_207664_d(), mutableboundingbox); ++ this.addEntitiesToWorld(p_189962_1_, p_189962_2_, p_189962_3_, p_189962_3_.func_186212_b(), p_189962_3_.func_186215_c(), p_189962_3_.func_207664_d(), p_189962_3_.func_186213_g()); + } + + return true; +@@ -317,14 +322,19 @@ + }); + } + ++ @Deprecated // FORGE: Add template parameter + public static List func_215387_a(IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List p_215387_3_) { ++ return processBlockInfos(null, p_215387_0_, p_215387_1_, p_215387_2_, p_215387_3_); ++ } ++ ++ public static List processBlockInfos(@Nullable Template template, IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List p_215387_3_) { + List list = Lists.newArrayList(); + + for(Template.BlockInfo template$blockinfo : p_215387_3_) { + BlockPos blockpos = func_186266_a(p_215387_2_, template$blockinfo.field_186242_a).func_177971_a(p_215387_1_); + Template.BlockInfo template$blockinfo1 = new Template.BlockInfo(blockpos, template$blockinfo.field_186243_b, template$blockinfo.field_186244_c); + +- for(Iterator iterator = p_215387_2_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().func_215194_a(p_215387_0_, p_215387_1_, template$blockinfo, template$blockinfo1, p_215387_2_)) { ++ for(Iterator iterator = p_215387_2_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().process(p_215387_0_, p_215387_1_, template$blockinfo, template$blockinfo1, p_215387_2_, template)) { + ; + } + +@@ -336,13 +346,42 @@ + return list; + } + ++ // FORGE: Add processing for entities ++ public static List processEntityInfos(@Nullable Template template, IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List p_215387_3_) { ++ List list = Lists.newArrayList(); ++ ++ for(Template.EntityInfo entityInfo : p_215387_3_) { ++ Vec3d pos = transformedVec3d(p_215387_2_, entityInfo.field_186247_a).func_178787_e(new Vec3d(p_215387_1_)); ++ BlockPos blockpos = func_186266_a(p_215387_2_, entityInfo.field_186248_b).func_177971_a(p_215387_1_); ++ Template.EntityInfo info = new Template.EntityInfo(pos, blockpos, entityInfo.field_186249_c); ++ ++ for (StructureProcessor proc : p_215387_2_.func_215221_j()) { ++ info = proc.processEntity(p_215387_0_, p_215387_1_, entityInfo, info, p_215387_2_, template); ++ if (info == null) ++ break; ++ } ++ ++ if (info != null) ++ list.add(info); ++ } ++ ++ return list; ++ } ++ ++ @Deprecated // FORGE: Add PlacementSettings parameter (below) to pass to entity processors + private void func_207668_a(IWorld p_207668_1_, BlockPos p_207668_2_, Mirror p_207668_3_, Rotation p_207668_4_, BlockPos p_207668_5_, @Nullable MutableBoundingBox p_207668_6_) { +- for(Template.EntityInfo template$entityinfo : this.field_186271_b) { ++ addEntitiesToWorld(p_207668_1_, p_207668_2_, new PlacementSettings().func_186214_a(p_207668_3_).func_186220_a(p_207668_4_).func_207665_a(p_207668_5_).func_186223_a(p_207668_6_), p_207668_3_, p_207668_4_, p_207668_2_, p_207668_6_); ++ } ++ ++ private void addEntitiesToWorld(IWorld p_207668_1_, BlockPos p_207668_2_, PlacementSettings placementIn, Mirror p_207668_3_, Rotation p_207668_4_, BlockPos p_207668_5_, @Nullable MutableBoundingBox p_207668_6_) { ++ for(Template.EntityInfo template$entityinfo : processEntityInfos(this, p_207668_1_, p_207668_2_, placementIn, this.field_186271_b)) { + BlockPos blockpos = func_207669_a(template$entityinfo.field_186248_b, p_207668_3_, p_207668_4_, p_207668_5_).func_177971_a(p_207668_2_); ++ blockpos = template$entityinfo.field_186248_b; // FORGE: Position will have already been transformed by processEntityInfos + if (p_207668_6_ == null || p_207668_6_.func_175898_b(blockpos)) { + CompoundNBT compoundnbt = template$entityinfo.field_186249_c; + Vec3d vec3d = func_207667_a(template$entityinfo.field_186247_a, p_207668_3_, p_207668_4_, p_207668_5_); +- Vec3d vec3d1 = vec3d.func_72441_c((double)p_207668_2_.func_177958_n(), (double)p_207668_2_.func_177956_o(), (double)p_207668_2_.func_177952_p()); ++ vec3d = vec3d.func_72441_c((double)p_207668_2_.func_177958_n(), (double)p_207668_2_.func_177956_o(), (double)p_207668_2_.func_177952_p()); ++ Vec3d vec3d1 = template$entityinfo.field_186247_a; // FORGE: Position will have already been transformed by processEntityInfos + ListNBT listnbt = new ListNBT(); + listnbt.add(DoubleNBT.func_229684_a_(vec3d1.field_72450_a)); + listnbt.add(DoubleNBT.func_229684_a_(vec3d1.field_72448_b)); diff --git a/patches_old/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch b/patches_old/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch new file mode 100644 index 000000000..9a9f7fec2 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java ++++ b/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java +@@ -4,7 +4,7 @@ + import java.util.function.Function; + import net.minecraft.util.registry.Registry; + +-public class FoliagePlacerType

{ ++public class FoliagePlacerType

extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final FoliagePlacerType field_227386_a_ = func_227392_a_("blob_foliage_placer", BlobFoliagePlacer::new); + public static final FoliagePlacerType field_227387_b_ = func_227392_a_("spruce_foliage_placer", SpruceFoliagePlacer::new); + public static final FoliagePlacerType field_227388_c_ = func_227392_a_("pine_foliage_placer", PineFoliagePlacer::new); diff --git a/patches_old/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch b/patches_old/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch new file mode 100644 index 000000000..eb589b5eb --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch @@ -0,0 +1,81 @@ +--- a/net/minecraft/world/gen/layer/BiomeLayer.java ++++ b/net/minecraft/world/gen/layer/BiomeLayer.java +@@ -23,17 +23,33 @@ + private static final int field_202740_n = Registry.field_212624_m.func_148757_b(Biomes.field_76780_h); + private static final int field_202741_o = Registry.field_212624_m.func_148757_b(Biomes.field_76768_g); + private static final int field_202742_p = Registry.field_212624_m.func_148757_b(Biomes.field_150584_S); +- private static final int[] field_202743_q = new int[]{field_202728_b, field_202730_d, field_202729_c, field_202740_n, field_202736_j, field_202741_o}; +- private static final int[] field_202744_r = new int[]{field_202728_b, field_202728_b, field_202728_b, field_202739_m, field_202739_m, field_202736_j}; +- private static final int[] field_202745_s = new int[]{field_202730_d, field_202738_l, field_202729_c, field_202736_j, field_202727_a, field_202740_n}; +- private static final int[] field_202746_t = new int[]{field_202730_d, field_202729_c, field_202741_o, field_202736_j}; +- private static final int[] field_202747_u = new int[]{field_202731_e, field_202731_e, field_202731_e, field_202742_p}; + private final int field_227472_v_; +- private int[] field_151623_c = field_202744_r; ++ @SuppressWarnings("unchecked") ++ private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; + + public BiomeLayer(WorldType p_i225882_1_, int p_i225882_2_) { ++ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) { ++ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); ++ int idx = type.ordinal(); ++ ++ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); ++ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); ++ } ++ ++ int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal(); ++ ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76769_d, 30)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_150588_X, 20)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76772_c, 10)); ++ + if (p_i225882_1_ == WorldType.field_77136_e) { +- this.field_151623_c = field_202743_q; ++ biomes[desertIdx].clear(); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76769_d, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76767_f, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76770_e, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76780_h, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76772_c, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76768_g, 10)); + this.field_227472_v_ = -1; + } else { + this.field_227472_v_ = p_i225882_2_; +@@ -54,21 +70,21 @@ + return p_202726_1_.func_202696_a(3) == 0 ? field_202733_g : field_202734_h; + } + +- return this.field_151623_c[p_202726_1_.func_202696_a(this.field_151623_c.length)]; ++ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT, p_202726_1_).biome); + case 2: + if (i > 0) { + return field_202732_f; + } + +- return field_202745_s[p_202726_1_.func_202696_a(field_202745_s.length)]; ++ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM, p_202726_1_).biome); + case 3: + if (i > 0) { + return field_202737_k; + } + +- return field_202746_t[p_202726_1_.func_202696_a(field_202746_t.length)]; ++ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL, p_202726_1_).biome); + case 4: +- return field_202747_u[p_202726_1_.func_202696_a(field_202747_u.length)]; ++ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY, p_202726_1_).biome); + default: + return field_202735_i; + } +@@ -77,4 +93,11 @@ + } + } + } ++ ++ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) { ++ java.util.List biomeList = biomes[type.ordinal()]; ++ int totalWeight = net.minecraft.util.WeightedRandom.func_76272_a(biomeList); ++ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?context.func_202696_a(totalWeight):context.func_202696_a(totalWeight / 10) * 10; ++ return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.func_180166_a(biomeList, weight); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/world/gen/layer/HillsLayer.java.patch b/patches_old/minecraft/net/minecraft/world/gen/layer/HillsLayer.java.patch new file mode 100644 index 000000000..1eda51a99 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/layer/HillsLayer.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/world/gen/layer/HillsLayer.java ++++ b/net/minecraft/world/gen/layer/HillsLayer.java +@@ -59,7 +59,10 @@ + + if (p_215723_1_.func_202696_a(3) == 0 || k == 0) { + int l = i; +- if (i == field_202799_f) { ++ Biome biome = Registry.field_212624_m.func_148745_a(i); ++ Biome hill = biome == null ? null : biome.getHill(p_215723_1_); ++ if (hill != null) l = Registry.field_212624_m.func_148757_b(hill); ++ else if (i == field_202799_f) { + l = field_202800_g; + } else if (i == field_202803_j) { + l = field_202804_k; diff --git a/patches/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch b/patches_old/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/gen/layer/MixRiverLayer.java.patch b/patches_old/minecraft/net/minecraft/world/gen/layer/MixRiverLayer.java.patch new file mode 100644 index 000000000..922fa6b45 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/layer/MixRiverLayer.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/world/gen/layer/MixRiverLayer.java ++++ b/net/minecraft/world/gen/layer/MixRiverLayer.java +@@ -22,11 +22,7 @@ + if (LayerUtil.func_202827_a(i)) { + return i; + } else if (j == field_202725_h) { +- if (i == field_202721_d) { +- return field_202720_c; +- } else { +- return i != field_202722_e && i != field_202723_f ? j & 255 : field_202723_f; +- } ++ return Registry.field_212624_m.func_148757_b(Registry.field_212624_m.func_148745_a(i).getRiver()); + } else { + return i; + } diff --git a/patches_old/minecraft/net/minecraft/world/gen/placement/Placement.java.patch b/patches_old/minecraft/net/minecraft/world/gen/placement/Placement.java.patch new file mode 100644 index 000000000..edab9e71e --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/placement/Placement.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/placement/Placement.java ++++ b/net/minecraft/world/gen/placement/Placement.java +@@ -14,7 +14,7 @@ + import net.minecraft.world.gen.feature.Feature; + import net.minecraft.world.gen.feature.IFeatureConfig; + +-public abstract class Placement { ++public abstract class Placement extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final Placement field_215022_h = func_214999_a("nope", new Passthrough(NoPlacementConfig::func_214735_a)); + public static final Placement field_215015_a = func_214999_a("count_heightmap", new AtSurface(FrequencyConfig::func_214721_a)); + public static final Placement field_215016_b = func_214999_a("count_top_solid", new TopSolid(FrequencyConfig::func_214721_a)); diff --git a/patches_old/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch b/patches_old/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch new file mode 100644 index 000000000..ffdafae25 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java ++++ b/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java +@@ -9,7 +9,7 @@ + import net.minecraft.world.biome.Biome; + import net.minecraft.world.chunk.IChunk; + +-public abstract class SurfaceBuilder { ++public abstract class SurfaceBuilder extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final BlockState field_215409_f = Blocks.field_150350_a.func_176223_P(); + public static final BlockState field_215410_g = Blocks.field_150346_d.func_176223_P(); + public static final BlockState field_215411_h = Blocks.field_196658_i.func_176223_P(); diff --git a/patches_old/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch b/patches_old/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch new file mode 100644 index 000000000..c74c4f65f --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java ++++ b/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java +@@ -4,7 +4,7 @@ + import java.util.function.Function; + import net.minecraft.util.registry.Registry; + +-public class TreeDecoratorType

{ ++public class TreeDecoratorType

extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final TreeDecoratorType field_227425_a_ = func_227432_a_("trunk_vine", TrunkVineTreeDecorator::new); + public static final TreeDecoratorType field_227426_b_ = func_227432_a_("leave_vine", LeaveVineTreeDecorator::new); + public static final TreeDecoratorType field_227427_c_ = func_227432_a_("cocoa", CocoaTreeDecorator::new); diff --git a/patches_old/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch b/patches_old/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch new file mode 100644 index 000000000..d3d59883b --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/world/lighting/BlockLightEngine.java ++++ b/net/minecraft/world/lighting/BlockLightEngine.java +@@ -117,4 +117,11 @@ + this.field_215627_c.func_215532_c(); + this.func_215469_a(Long.MAX_VALUE, p_215623_1_.func_218275_a(), 15 - p_215623_2_, true); + } ++ ++ // FORGE START ++ ++ @Override ++ public int queuedUpdateSize() { ++ return field_215627_c.queuedUpdateSize(); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch b/patches_old/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch new file mode 100644 index 000000000..d368dd39b --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/world/lighting/LevelBasedGraph.java ++++ b/net/minecraft/world/lighting/LevelBasedGraph.java +@@ -228,4 +228,10 @@ + protected abstract void func_215476_a(long p_215476_1_, int p_215476_3_); + + protected abstract int func_215480_b(long p_215480_1_, long p_215480_3_, int p_215480_5_); ++ ++ // FORGE START ++ ++ protected int queuedUpdateSize() { ++ return field_215488_c.size(); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/world/lighting/LightEngine.java.patch b/patches_old/minecraft/net/minecraft/world/lighting/LightEngine.java.patch new file mode 100644 index 000000000..48a8ddd6b --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/lighting/LightEngine.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/lighting/LightEngine.java ++++ b/net/minecraft/world/lighting/LightEngine.java +@@ -215,4 +215,8 @@ + long i = SectionPos.func_218169_f(SectionPos.func_218166_b(p_223129_1_.field_77276_a, 0, p_223129_1_.field_77275_b)); + this.field_215627_c.func_223113_c(i, p_223129_2_); + } ++ ++ // FORGE START ++ ++ public abstract int queuedUpdateSize(); + } diff --git a/patches_old/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch b/patches_old/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch new file mode 100644 index 000000000..225b637dd --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/world/lighting/SkyLightEngine.java ++++ b/net/minecraft/world/lighting/SkyLightEngine.java +@@ -229,4 +229,11 @@ + public String func_215614_b(long p_215614_1_) { + return super.func_215614_b(p_215614_1_) + (this.field_215627_c.func_215549_m(p_215614_1_) ? "*" : ""); + } ++ ++ // FORGE START ++ ++ @Override ++ public int queuedUpdateSize() { ++ return 0; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/world/server/ChunkHolder.java.patch b/patches_old/minecraft/net/minecraft/world/server/ChunkHolder.java.patch new file mode 100644 index 000000000..c0e084527 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/server/ChunkHolder.java.patch @@ -0,0 +1,53 @@ +--- a/net/minecraft/world/server/ChunkHolder.java ++++ b/net/minecraft/world/server/ChunkHolder.java +@@ -136,7 +136,7 @@ + Chunk chunk = this.func_219298_c(); + if (chunk != null) { + this.field_219322_q |= 1 << (p_219279_2_ >> 4); +- if (this.field_219321_p < 64) { ++ { //Forge; Cache everything, so always run + short short1 = (short)(p_219279_1_ << 12 | p_219279_3_ << 8 | p_219279_2_); + + for(int i = 0; i < this.field_219321_p; ++i) { +@@ -145,6 +145,8 @@ + } + } + ++ if (this.field_219321_p == this.field_219320_o.length) ++ this.field_219320_o = java.util.Arrays.copyOf(this.field_219320_o, this.field_219320_o.length << 1); + this.field_219320_o[this.field_219321_p++] = short1; + } + +@@ -167,7 +169,7 @@ + public void func_219274_a(Chunk p_219274_1_) { + if (this.field_219321_p != 0 || this.field_219325_t != 0 || this.field_219324_s != 0) { + World world = p_219274_1_.func_177412_p(); +- if (this.field_219321_p == 64) { ++ if (this.field_219321_p >= net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get()) { + this.field_219323_r = -1; + } + +@@ -190,20 +192,19 @@ + int k = (this.field_219320_o[0] >> 8 & 15) + this.field_219319_n.field_77275_b * 16; + BlockPos blockpos = new BlockPos(l, j1, k); + this.func_219293_a(new SChangeBlockPacket(world, blockpos), false); +- if (world.func_180495_p(blockpos).func_177230_c().func_149716_u()) { ++ if (world.func_180495_p(blockpos).hasTileEntity()) { + this.func_219305_a(world, blockpos); + } +- } else if (this.field_219321_p == 64) { ++ } else if (this.field_219321_p >= net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get()) { + this.func_219293_a(new SChunkDataPacket(p_219274_1_, this.field_219322_q), false); + } else if (this.field_219321_p != 0) { + this.func_219293_a(new SMultiBlockChangePacket(this.field_219321_p, this.field_219320_o, p_219274_1_), false); +- + for(int i1 = 0; i1 < this.field_219321_p; ++i1) { + int k1 = (this.field_219320_o[i1] >> 12 & 15) + this.field_219319_n.field_77276_a * 16; + int l1 = this.field_219320_o[i1] & 255; + int i2 = (this.field_219320_o[i1] >> 8 & 15) + this.field_219319_n.field_77275_b * 16; + BlockPos blockpos1 = new BlockPos(k1, l1, i2); +- if (world.func_180495_p(blockpos1).func_177230_c().func_149716_u()) { ++ if (world.func_180495_p(blockpos1).hasTileEntity()) { + this.func_219305_a(world, blockpos1); + } + } diff --git a/patches/minecraft/net/minecraft/world/server/ServerMultiWorld.java.patch b/patches_old/minecraft/net/minecraft/world/server/ServerMultiWorld.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/server/ServerMultiWorld.java.patch rename to patches_old/minecraft/net/minecraft/world/server/ServerMultiWorld.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/server/ServerWorld.java.patch b/patches_old/minecraft/net/minecraft/world/server/ServerWorld.java.patch new file mode 100644 index 000000000..b56797eb3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/server/ServerWorld.java.patch @@ -0,0 +1,324 @@ +--- a/net/minecraft/world/server/ServerWorld.java ++++ b/net/minecraft/world/server/ServerWorld.java +@@ -137,7 +137,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-public class ServerWorld extends World { ++public class ServerWorld extends World implements net.minecraftforge.common.extensions.IForgeWorldServer { + private static final Logger field_147491_a = LogManager.getLogger(); + private final List field_217497_w = Lists.newArrayList(); + private final Int2ObjectMap field_217498_x = new Int2ObjectLinkedOpenHashMap<>(); +@@ -163,10 +163,13 @@ + private boolean field_211159_Q; + @Nullable + private final WanderingTraderSpawner field_217496_L; ++ /** Stores the recently processed (lighting) chunks */ ++ protected java.util.Set doneChunks = Sets.newHashSet(); ++ private net.minecraftforge.common.util.WorldCapabilityData capabilityData; + + public ServerWorld(MinecraftServer p_i50703_1_, Executor p_i50703_2_, SaveHandler p_i50703_3_, WorldInfo p_i50703_4_, DimensionType p_i50703_5_, IProfiler p_i50703_6_, IChunkStatusListener p_i50703_7_) { + super(p_i50703_4_, p_i50703_5_, (p_217442_4_, p_217442_5_) -> { +- return new ServerChunkProvider((ServerWorld)p_217442_4_, p_i50703_3_.func_75765_b(), p_i50703_3_.func_197718_i(), p_i50703_3_.func_186340_h(), p_i50703_2_, p_217442_5_.func_186060_c(), p_i50703_1_.func_184103_al().func_72395_o(), p_i50703_7_, () -> { ++ return new ServerChunkProvider((ServerWorld)p_217442_4_, p_i50703_3_.func_75765_b(), p_i50703_3_.func_197718_i(), p_i50703_3_.func_186340_h(), p_i50703_2_, p_217442_4_.func_175624_G().createChunkGenerator(p_217442_4_), p_i50703_1_.func_184103_al().func_72395_o(), p_i50703_7_, () -> { + return p_i50703_1_.func_71218_a(DimensionType.field_223227_a_).func_217481_x(); + }); + }, p_i50703_6_, false); +@@ -184,6 +187,7 @@ + } + + this.field_217496_L = this.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ ? new WanderingTraderSpawner(this) : null; ++ this.initCapabilities(); + } + + public Biome func_225604_a_(int p_225604_1_, int p_225604_2_, int p_225604_3_) { +@@ -197,6 +201,7 @@ + this.func_175723_af().func_212673_r(); + iprofiler.func_219895_b("weather"); + boolean flag = this.func_72896_J(); ++ this.field_73011_w.updateWeather(() -> { + if (this.field_73011_w.func_191066_m()) { + if (this.func_82736_K().func_223586_b(GameRules.field_223617_t)) { + int i = this.field_72986_A.func_176133_A(); +@@ -258,6 +263,7 @@ + + this.field_73004_o = MathHelper.func_76131_a(this.field_73004_o, 0.0F, 1.0F); + } ++ }); //Forge: End weatherTick delegate + + if (this.field_73003_n != this.field_73004_o) { + this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(7, this.field_73004_o), this.field_73011_w.func_186058_p()); +@@ -267,15 +273,19 @@ + this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(8, this.field_73017_q), this.field_73011_w.func_186058_p()); + } + ++ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, ++ * rather than to all players on the server. This is what causes the client-side rain, as the ++ * client believes that it has started raining locally, rather than in another dimension. ++ */ + if (flag != this.func_72896_J()) { + if (flag) { +- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(2, 0.0F)); ++ this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(2, 0.0F), this.field_73011_w.func_186058_p()); + } else { +- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(1, 0.0F)); ++ this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(1, 0.0F), this.field_73011_w.func_186058_p()); + } + +- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(7, this.field_73004_o)); +- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(8, this.field_73017_q)); ++ this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(7, this.field_73004_o), this.field_73011_w.func_186058_p()); ++ this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(8, this.field_73017_q), this.field_73011_w.func_186058_p()); + } + + if (this.func_72912_H().func_76093_s() && this.func_175659_aa() != Difficulty.HARD) { +@@ -287,8 +297,8 @@ + })) { + this.field_73068_P = false; + if (this.func_82736_K().func_223586_b(GameRules.field_223607_j)) { +- long l = this.field_72986_A.func_76073_f() + 24000L; +- this.func_72877_b(l - l % 24000L); ++ long l = this.func_72820_D() + 24000L; ++ this.func_72877_b(net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, l - l % 24000L, this.func_72820_D())); + } + + this.func_229856_ab_(); +@@ -330,6 +340,7 @@ + Entity entity = this.field_217497_w.get(i1); + this.func_217390_a((p_229858_0_) -> { + ++p_229858_0_.field_70173_aa; ++ if (p_229858_0_.canUpdate()) + p_229858_0_.func_70071_h_(); + }, entity); + if (entity.field_70128_L) { +@@ -395,7 +406,7 @@ + if (entity2.field_70128_L) { + this.func_217454_n(entity2); + objectiterator.remove(); +- this.func_217484_g(entity2); ++ this.removeEntityComplete(entity2, entity2 instanceof ServerPlayerEntity); //Forge: Keep cap data until revive. Every other entity removes directly. + } + + iprofiler.func_76319_b(); +@@ -418,7 +429,7 @@ + int j = chunkpos.func_180333_d(); + IProfiler iprofiler = this.func_217381_Z(); + iprofiler.func_76320_a("thunder"); +- if (flag && this.func_72911_I() && this.field_73012_v.nextInt(100000) == 0) { ++ if (this.field_73011_w.canDoLightning(p_217441_1_) && flag && this.func_72911_I() && this.field_73012_v.nextInt(100000) == 0) { + BlockPos blockpos = this.func_175736_a(this.func_217383_a(i, 0, j, 15)); + if (this.func_175727_C(blockpos)) { + DifficultyInstance difficultyinstance = this.func_175649_E(blockpos); +@@ -436,10 +447,11 @@ + } + + iprofiler.func_219895_b("iceandsnow"); +- if (this.field_73012_v.nextInt(16) == 0) { ++ if (this.field_73011_w.canDoRainSnowIce(p_217441_1_) && this.field_73012_v.nextInt(16) == 0) { + BlockPos blockpos2 = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, this.func_217383_a(i, 0, j, 15)); + BlockPos blockpos3 = blockpos2.func_177977_b(); + Biome biome = this.func_226691_t_(blockpos2); ++ if (this.isAreaLoaded(blockpos2, 1)) // Forge: check area to avoid loading neighbors in unloaded chunks + if (biome.func_201848_a(this, blockpos3)) { + this.func_175656_a(blockpos3, Blocks.field_150432_aD.func_176223_P()); + } +@@ -526,10 +538,7 @@ + } + + private void func_73051_P() { +- this.field_72986_A.func_76080_g(0); +- this.field_72986_A.func_76084_b(false); +- this.field_72986_A.func_76090_f(0); +- this.field_72986_A.func_76069_a(false); ++ this.field_73011_w.resetRainAndThunder(); + } + + @OnlyIn(Dist.CLIENT) +@@ -542,7 +551,7 @@ + int j = this.field_72986_A.func_76074_e(); + int k = 0; + +- while(this.func_184141_c(new BlockPos(i, 0, j)).func_196958_f()) { ++ while(this.func_184141_c(new BlockPos(i, 0, j)).isAir(this, new BlockPos(i, 0, j))) { + i += this.field_73012_v.nextInt(8) - this.field_73012_v.nextInt(8); + j += this.field_73012_v.nextInt(8) - this.field_73012_v.nextInt(8); + ++k; +@@ -584,8 +593,9 @@ + ++p_217479_1_.field_70173_aa; + IProfiler iprofiler = this.func_217381_Z(); + iprofiler.func_194340_a(() -> { +- return Registry.field_212629_r.func_177774_c(p_217479_1_.func_200600_R()).toString(); ++ return p_217479_1_.func_200600_R().getRegistryName() == null ? p_217479_1_.func_200600_R().toString() : p_217479_1_.func_200600_R().getRegistryName().toString(); + }); ++ if (p_217479_1_.canUpdate()) + iprofiler.func_230035_c_("tickNonPassenger"); + p_217479_1_.func_70071_h_(); + iprofiler.func_76319_b(); +@@ -652,6 +662,11 @@ + } + + public boolean func_175660_a(PlayerEntity p_175660_1_, BlockPos p_175660_2_) { ++ return super.func_175660_a(p_175660_1_, p_175660_2_); ++ } ++ ++ @Override ++ public boolean canMineBlockBody(PlayerEntity p_175660_1_, BlockPos p_175660_2_) { + return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_); + } + +@@ -661,6 +676,7 @@ + } else if (this.field_72986_A.func_76067_t() == WorldType.field_180272_g) { + this.field_72986_A.func_176143_a(BlockPos.field_177992_a.func_177984_a()); + } else { ++ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; + BiomeProvider biomeprovider = this.func_72863_F().func_201711_g().func_202090_b(); + List list = biomeprovider.func_76932_a(); + Random random = new Random(this.func_72905_C()); +@@ -734,6 +750,7 @@ + p_217445_1_.func_200209_c(new TranslationTextComponent("menu.savingChunks")); + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); + serverchunkprovider.func_217210_a(p_217445_2_); + } + } +@@ -809,7 +826,7 @@ + } + } + +- EntityClassification entityclassification = entity.func_200600_R().func_220339_d(); ++ EntityClassification entityclassification = entity.getClassification(true); + if (entityclassification != EntityClassification.MISC && this.func_72863_F().func_223435_b(entity)) { + object2intmap.mergeInt(entityclassification, 1, Integer::sum); + } +@@ -851,6 +868,7 @@ + } + + private void func_217448_f(ServerPlayerEntity p_217448_1_) { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_217448_1_, this))) return; + Entity entity = this.field_175741_N.get(p_217448_1_.func_110124_au()); + if (entity != null) { + field_147491_a.warn("Force-added player with duplicate UUID {}", (Object)p_217448_1_.func_110124_au().toString()); +@@ -875,6 +893,7 @@ + } else if (this.func_217478_l(p_72838_1_)) { + return false; + } else { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this))) return false; + IChunk ichunk = this.func_217353_a(MathHelper.func_76128_c(p_72838_1_.func_226277_ct_() / 16.0D), MathHelper.func_76128_c(p_72838_1_.func_226281_cx_() / 16.0D), ChunkStatus.field_222617_m, p_72838_1_.field_98038_p); + if (!(ichunk instanceof Chunk)) { + return false; +@@ -890,6 +909,7 @@ + if (this.func_217478_l(p_217440_1_)) { + return false; + } else { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_217440_1_, this))) return false; + this.func_217465_m(p_217440_1_); + return true; + } +@@ -925,12 +945,17 @@ + + } + ++ @Deprecated //Forge: Use removeEntityComplete(entity,boolean) + public void func_217484_g(Entity p_217484_1_) { ++ removeEntityComplete(p_217484_1_, false); ++ } ++ public void removeEntityComplete(Entity p_217484_1_, boolean keepData) { + if (p_217484_1_ instanceof EnderDragonEntity) { + for(EnderDragonPartEntity enderdragonpartentity : ((EnderDragonEntity)p_217484_1_).func_213404_dT()) { +- enderdragonpartentity.func_70106_y(); ++ enderdragonpartentity.remove(keepData); + } + } ++ p_217484_1_.remove(keepData); + + this.field_175741_N.remove(p_217484_1_.func_110124_au()); + this.func_72863_F().func_217226_b(p_217484_1_); +@@ -944,6 +969,7 @@ + this.field_217495_I.remove(((MobEntity)p_217484_1_).func_70661_as()); + } + ++ p_217484_1_.onRemovedFromWorld(); + } + + private void func_217465_m(Entity p_217465_1_) { +@@ -964,15 +990,19 @@ + } + } + ++ p_217465_1_.onAddedToWorld(); + } + + public void func_217467_h(Entity p_217467_1_) { ++ removeEntity(p_217467_1_, false); ++ } ++ public void removeEntity(Entity p_217467_1_, boolean keepData) { + if (this.field_217492_a) { + throw (IllegalStateException)Util.func_229757_c_(new IllegalStateException("Removing entity while ticking!")); + } else { + this.func_217454_n(p_217467_1_); + this.field_217498_x.remove(p_217467_1_.func_145782_y()); +- this.func_217484_g(p_217467_1_); ++ this.removeEntityComplete(p_217467_1_, keepData); + } + } + +@@ -985,8 +1015,11 @@ + } + + public void func_217434_e(ServerPlayerEntity p_217434_1_) { +- p_217434_1_.func_70106_y(); +- this.func_217467_h(p_217434_1_); ++ removePlayer(p_217434_1_, false); ++ } ++ public void removePlayer(ServerPlayerEntity p_217434_1_, boolean keepData) { ++ p_217434_1_.remove(keepData); ++ this.removeEntity(p_217434_1_, keepData); + this.func_72854_c(); + } + +@@ -1010,10 +1043,20 @@ + } + + public void func_184148_a(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_); ++ if (event.isCanceled() || event.getSound() == null) return; ++ p_184148_8_ = event.getSound(); ++ p_184148_9_ = event.getCategory(); ++ p_184148_10_ = event.getVolume(); + this.field_73061_a.func_184103_al().func_148543_a(p_184148_1_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_ > 1.0F ? (double)(16.0F * p_184148_10_) : 16.0D, this.field_73011_w.func_186058_p(), new SPlaySoundEffectPacket(p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_)); + } + + public void func_217384_a(@Nullable PlayerEntity p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundCategory p_217384_4_, float p_217384_5_, float p_217384_6_) { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_217384_1_, p_217384_3_, p_217384_4_, p_217384_5_, p_217384_6_); ++ if (event.isCanceled() || event.getSound() == null) return; ++ p_217384_3_ = event.getSound(); ++ p_217384_4_ = event.getCategory(); ++ p_217384_5_ = event.getVolume(); + this.field_73061_a.func_184103_al().func_148543_a(p_217384_1_, p_217384_2_.func_226277_ct_(), p_217384_2_.func_226278_cu_(), p_217384_2_.func_226281_cx_(), p_217384_5_ > 1.0F ? (double)(16.0F * p_217384_5_) : 16.0D, this.field_73011_w.func_186058_p(), new SSpawnMovingSoundEffectPacket(p_217384_3_, p_217384_4_, p_217384_2_, p_217384_5_, p_217384_6_)); + } + +@@ -1049,6 +1092,7 @@ + + public Explosion func_217401_a(@Nullable Entity p_217401_1_, @Nullable DamageSource p_217401_2_, double p_217401_3_, double p_217401_5_, double p_217401_7_, float p_217401_9_, boolean p_217401_10_, Explosion.Mode p_217401_11_) { + Explosion explosion = new Explosion(this, p_217401_1_, p_217401_3_, p_217401_5_, p_217401_7_, p_217401_9_, p_217401_10_, p_217401_11_); ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; + if (p_217401_2_ != null) { + explosion.func_199592_a(p_217401_2_); + } +@@ -1377,4 +1421,15 @@ + return p_229854_1_.func_175898_b(p_229855_1_.func_180328_a()); + }); + } ++ ++ protected void initCapabilities() { ++ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities(); ++ this.gatherCapabilities(parent); ++ capabilityData = this.func_217481_x().func_215752_a(() -> new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities()), net.minecraftforge.common.util.WorldCapabilityData.ID); ++ capabilityData.setCapabilities(field_73011_w, getCapabilities()); ++ } ++ ++ public java.util.stream.Stream getEntities() { ++ return field_217498_x.values().stream(); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch b/patches_old/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch new file mode 100644 index 000000000..b47f9db64 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch @@ -0,0 +1,26 @@ +--- a/net/minecraft/world/spawner/AbstractSpawner.java ++++ b/net/minecraft/world/spawner/AbstractSpawner.java +@@ -128,11 +128,12 @@ + entity.func_70012_b(entity.func_226277_ct_(), entity.func_226278_cu_(), entity.func_226281_cx_(), world.field_73012_v.nextFloat() * 360.0F, 0.0F); + if (entity instanceof MobEntity) { + MobEntity mobentity = (MobEntity)entity; +- if (!mobentity.func_213380_a(world, SpawnReason.SPAWNER) || !mobentity.func_205019_a(world)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(mobentity, world, (float)entity.func_226277_ct_(), (float)entity.func_226278_cu_(), (float)entity.func_226281_cx_(), this)) { + continue; + } + + if (this.field_98282_f.func_185277_b().func_186856_d() == 1 && this.field_98282_f.func_185277_b().func_150297_b("id", 8)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, world, (float)entity.func_226277_ct_(), (float)entity.func_226278_cu_(), (float)entity.func_226281_cx_(), this, SpawnReason.SPAWNER)) + ((MobEntity)entity).func_213386_a(world, world.func_175649_E(new BlockPos(entity)), SpawnReason.SPAWNER, (ILivingEntityData)null, (CompoundNBT)null); + } + } +@@ -285,4 +286,9 @@ + public double func_177223_e() { + return this.field_98284_d; + } ++ ++ @Nullable ++ public Entity getSpawnerEntity() { ++ return null; ++ } + } diff --git a/patches_old/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch b/patches_old/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch new file mode 100644 index 000000000..4cba4b399 --- /dev/null +++ b/patches_old/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 +@@ -87,7 +87,7 @@ + } + + if (biome$spawnlistentry == null) { +- biome$spawnlistentry = func_222264_a(chunkgenerator, p_226701_0_, p_226701_1_.field_73012_v, blockpos$mutable); ++ biome$spawnlistentry = getSpawnList(chunkgenerator, p_226701_0_, p_226701_1_.field_73012_v, blockpos$mutable, p_226701_1_); + if (biome$spawnlistentry == null) { + break label123; + } +@@ -100,7 +100,7 @@ + } + + EntityType entitytype = biome$spawnlistentry.field_200702_b; +- if (!entitytype.func_200720_b() || !func_222261_a(chunkgenerator, p_226701_0_, biome$spawnlistentry, blockpos$mutable)) { ++ if (!entitytype.func_200720_b() || !getSpawnList(chunkgenerator, p_226701_0_, biome$spawnlistentry, blockpos$mutable, p_226701_1_)) { + break label115; + } + +@@ -123,15 +123,17 @@ + } + + mobentity.func_70012_b((double)f, (double)k, (double)f1, p_226701_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); +- if (d0 > 16384.0D && mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_226701_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_226701_1_)) { ++ int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_226701_1_, f, k, f1, null, SpawnReason.NATURAL); ++ if (canSpawn == -1 || (canSpawn == 0 && (d0 > 16384.0D && mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_226701_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_226701_1_)))) { + break label115; + } + ++ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, p_226701_1_, f, k, f1, null, SpawnReason.NATURAL)) + ilivingentitydata = mobentity.func_213386_a(p_226701_1_, p_226701_1_.func_175649_E(new BlockPos(mobentity)), SpawnReason.NATURAL, ilivingentitydata, (CompoundNBT)null); + ++i; + ++j2; + p_226701_1_.func_217376_c(mobentity); +- if (i >= mobentity.func_70641_bl()) { ++ if (i >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(mobentity)) { + return; + } + +@@ -154,13 +156,15 @@ + } + + @Nullable +- private static Biome.SpawnListEntry func_222264_a(ChunkGenerator p_222264_0_, EntityClassification p_222264_1_, Random p_222264_2_, BlockPos p_222264_3_) { ++ private static Biome.SpawnListEntry getSpawnList(ChunkGenerator p_222264_0_, EntityClassification p_222264_1_, Random p_222264_2_, BlockPos p_222264_3_, World world) { + List 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_); + } + +@@ -189,6 +193,13 @@ + if (p_209382_0_ == EntitySpawnPlacementRegistry.PlacementType.NO_RESTRICTIONS) { + return true; + } else if (p_209382_3_ != null && p_209382_1_.func_175723_af().func_177746_a(p_209382_2_)) { ++ return p_209382_0_.canSpawnAt(p_209382_1_, p_209382_2_, p_209382_3_); ++ } ++ return false; ++ } ++ ++ public static boolean canSpawnAtBody(EntitySpawnPlacementRegistry.PlacementType p_209382_0_, IWorldReader p_209382_1_, BlockPos p_209382_2_, @Nullable EntityType p_209382_3_) { ++ { + BlockState blockstate = p_209382_1_.func_180495_p(p_209382_2_); + IFluidState ifluidstate = p_209382_1_.func_204610_c(p_209382_2_); + BlockPos blockpos = p_209382_2_.func_177984_a(); +@@ -199,14 +210,12 @@ + case ON_GROUND: + default: + BlockState blockstate1 = p_209382_1_.func_180495_p(blockpos1); +- if (!blockstate1.func_215688_a(p_209382_1_, blockpos1, p_209382_3_)) { ++ if (!blockstate1.canCreatureSpawn(p_209382_1_, blockpos1, p_209382_0_, p_209382_3_)) { + return false; + } else { + return func_222266_a(p_209382_1_, p_209382_2_, blockstate, ifluidstate) && func_222266_a(p_209382_1_, blockpos, p_209382_1_.func_180495_p(blockpos), p_209382_1_.func_204610_c(blockpos)); + } + } +- } else { +- return false; + } + } + +@@ -249,6 +258,7 @@ + entity.func_70012_b(d0, (double)blockpos.func_177956_o(), d1, p_77191_4_.nextFloat() * 360.0F, 0.0F); + if (entity instanceof MobEntity) { + MobEntity mobentity = (MobEntity)entity; ++ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_77191_0_, d0, blockpos.func_177956_o(), d1, null, SpawnReason.CHUNK_GENERATION) == -1) continue; + if (mobentity.func_213380_a(p_77191_0_, SpawnReason.CHUNK_GENERATION) && mobentity.func_205019_a(p_77191_0_)) { + ilivingentitydata = mobentity.func_213386_a(p_77191_0_, p_77191_0_.func_175649_E(new BlockPos(mobentity)), SpawnReason.CHUNK_GENERATION, ilivingentitydata, (CompoundNBT)null); + p_77191_0_.func_217376_c(mobentity); diff --git a/patches/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch b/patches_old/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches_old/minecraft/net/minecraft/world/storage/MapData.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/MapData.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/MapData.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/storage/MapDecoration.java.patch b/patches_old/minecraft/net/minecraft/world/storage/MapDecoration.java.patch new file mode 100644 index 000000000..7c83ba1b8 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/storage/MapDecoration.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/world/storage/MapDecoration.java ++++ b/net/minecraft/world/storage/MapDecoration.java +@@ -83,6 +83,16 @@ + return i; + } + ++ /** ++ * Renders this decoration, useful for custom sprite sheets. ++ * @param index The index of this icon in the MapData's list. Used by vanilla to offset the Z-coordinate to prevent Z-fighting ++ * @return false to run vanilla logic for this decoration, true to skip it ++ */ ++ @OnlyIn(Dist.CLIENT) ++ public boolean render(int index) { ++ return false; ++ } ++ + public static enum Type { + PLAYER(false), + FRAME(true), diff --git a/patches_old/minecraft/net/minecraft/world/storage/SaveFormat.java.patch b/patches_old/minecraft/net/minecraft/world/storage/SaveFormat.java.patch new file mode 100644 index 000000000..b5aad3d86 --- /dev/null +++ b/patches_old/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/SaveHandler.java.patch b/patches_old/minecraft/net/minecraft/world/storage/SaveHandler.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/SaveHandler.java.patch diff --git a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches_old/minecraft/net/minecraft/world/storage/WorldInfo.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/WorldInfo.java.patch diff --git a/patches_old/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch b/patches_old/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch new file mode 100644 index 000000000..0e8ce906d --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch @@ -0,0 +1,26 @@ +--- a/net/minecraft/world/storage/WorldSavedData.java ++++ b/net/minecraft/world/storage/WorldSavedData.java +@@ -9,7 +9,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-public abstract class WorldSavedData { ++public abstract class WorldSavedData implements net.minecraftforge.common.util.INBTSerializable { + private static final Logger field_215159_a = LogManager.getLogger(); + private final String field_76190_i; + private boolean field_76189_a; +@@ -53,4 +53,14 @@ + this.func_76186_a(false); + } + } ++ ++ @Override ++ public void deserializeNBT(CompoundNBT nbt) { ++ func_76184_a(nbt); ++ } ++ ++ @Override ++ public CompoundNBT serializeNBT() { ++ return func_189551_b(new CompoundNBT()); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootParameterSets.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootParameterSets.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/loot/LootParameterSets.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/loot/LootParameterSets.java.patch diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch diff --git a/patches/minecraft/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java.patch diff --git a/patches/minecraft/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java.patch diff --git a/patches/minecraft/net/minecraft/world/storage/loot/functions/Smelt.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/functions/Smelt.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/world/storage/loot/functions/Smelt.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/loot/functions/Smelt.java.patch diff --git a/src/main/java/net/minecraftforge/client/CloudRenderer.java b/src/main/java/net/minecraftforge/client/CloudRenderer.java deleted file mode 100644 index 46e2132ac..000000000 --- a/src/main/java/net/minecraftforge/client/CloudRenderer.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.client; - -import javax.annotation.Nonnull; -import java.nio.ByteBuffer; -import java.util.function.Predicate; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL13; -import org.lwjgl.opengl.GL31; - -import com.mojang.blaze3d.platform.GLX; -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GLAllocation; -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; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; -import net.minecraftforge.common.ForgeConfig; -import net.minecraftforge.resource.IResourceType; -import net.minecraftforge.resource.ISelectiveResourceReloadListener; -import net.minecraftforge.resource.VanillaResourceType; - -/* TODO: reimplement using the new rendering system? or remove? -public class CloudRenderer implements ISelectiveResourceReloadListener -{ - // Shared constants. - private static final float PX_SIZE = 1 / 256F; - - // Building constants. - private static final VertexFormat FORMAT = DefaultVertexFormats.POSITION_TEX_COLOR; - private static final int TOP_SECTIONS = 12; // Number of slices a top face will span. - private static final int HEIGHT = 4; - private static final float INSET = 0.001F; - private static final float ALPHA = 0.8F; - - // Debug - private static final boolean WIREFRAME = false; - - // Instance fields - private final Minecraft mc = Minecraft.getInstance(); - private final ResourceLocation texture = new ResourceLocation("textures/environment/clouds.png"); - - private VertexBuffer vbo; - private CloudOption cloudMode = CloudOption.OFF; - private int renderDistance = -1; - - private DynamicTexture COLOR_TEX = null; - - private int texW; - private int texH; - - public CloudRenderer() - { - // Resource manager should always be reloadable. - ((IReloadableResourceManager) mc.getResourceManager()).addReloadListener(this); - } - - private int getScale() - { - return cloudMode == CloudOption.FANCY ? 12 : 8; - } - - private float ceilToScale(float value) - { - float scale = getScale(); - return MathHelper.ceil(value / scale) * scale; - } - - private void vertices(BufferBuilder buffer) - { - boolean fancy = cloudMode == CloudOption.FANCY; // Defines whether to hide all but the bottom. - - float scale = getScale(); - float CULL_DIST = 2 * scale; - - float bCol = fancy ? 0.7F : 1F; - - float sectEnd = ceilToScale((renderDistance * 2) * 16); - float sectStart = -sectEnd; - - float sectStep = ceilToScale(sectEnd * 2 / TOP_SECTIONS); - float sectPx = PX_SIZE / scale; - - buffer.begin(GL11.GL_QUADS, FORMAT); - - float sectX0 = sectStart; - float sectX1 = sectX0; - - while (sectX1 < sectEnd) - { - sectX1 += sectStep; - - if (sectX1 > sectEnd) - sectX1 = sectEnd; - - float sectZ0 = sectStart; - float sectZ1 = sectZ0; - - while (sectZ1 < sectEnd) - { - sectZ1 += sectStep; - - if (sectZ1 > sectEnd) - sectZ1 = sectEnd; - - float u0 = sectX0 * sectPx; - float u1 = sectX1 * sectPx; - float v0 = sectZ0 * sectPx; - float v1 = sectZ1 * sectPx; - - // Bottom - buffer.pos(sectX0, 0, sectZ0).tex(u0, v0).color(bCol, bCol, bCol, ALPHA).endVertex(); - buffer.pos(sectX1, 0, sectZ0).tex(u1, v0).color(bCol, bCol, bCol, ALPHA).endVertex(); - buffer.pos(sectX1, 0, sectZ1).tex(u1, v1).color(bCol, bCol, bCol, ALPHA).endVertex(); - buffer.pos(sectX0, 0, sectZ1).tex(u0, v1).color(bCol, bCol, bCol, ALPHA).endVertex(); - - if (fancy) - { - // Top - buffer.pos(sectX0, HEIGHT, sectZ0).tex(u0, v0).color(1, 1, 1, ALPHA).endVertex(); - buffer.pos(sectX0, HEIGHT, sectZ1).tex(u0, v1).color(1, 1, 1, ALPHA).endVertex(); - buffer.pos(sectX1, HEIGHT, sectZ1).tex(u1, v1).color(1, 1, 1, ALPHA).endVertex(); - buffer.pos(sectX1, HEIGHT, sectZ0).tex(u1, v0).color(1, 1, 1, ALPHA).endVertex(); - - float slice; - float sliceCoord0; - float sliceCoord1; - - for (slice = sectX0; slice < sectX1;) - { - sliceCoord0 = slice * sectPx; - sliceCoord1 = sliceCoord0 + PX_SIZE; - - // X sides - if (slice > -CULL_DIST) - { - slice += INSET; - buffer.pos(slice, 0, sectZ1).tex(sliceCoord0, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - buffer.pos(slice, HEIGHT, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - buffer.pos(slice, HEIGHT, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - buffer.pos(slice, 0, sectZ0).tex(sliceCoord0, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - slice -= INSET; - } - - slice += scale; - - if (slice <= CULL_DIST) - { - slice -= INSET; - buffer.pos(slice, 0, sectZ0).tex(sliceCoord0, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - buffer.pos(slice, HEIGHT, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - buffer.pos(slice, HEIGHT, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - buffer.pos(slice, 0, sectZ1).tex(sliceCoord0, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - slice += INSET; - } - } - - for (slice = sectZ0; slice < sectZ1;) - { - sliceCoord0 = slice * sectPx; - sliceCoord1 = sliceCoord0 + PX_SIZE; - - // Z sides - if (slice > -CULL_DIST) - { - slice += INSET; - buffer.pos(sectX0, 0, slice).tex(u0, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - buffer.pos(sectX0, HEIGHT, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - buffer.pos(sectX1, HEIGHT, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - buffer.pos(sectX1, 0, slice).tex(u1, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - slice -= INSET; - } - - slice += scale; - - if (slice <= CULL_DIST) - { - slice -= INSET; - buffer.pos(sectX1, 0, slice).tex(u1, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - buffer.pos(sectX1, HEIGHT, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - buffer.pos(sectX0, HEIGHT, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - buffer.pos(sectX0, 0, slice).tex(u0, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - slice += INSET; - } - } - } - - sectZ0 = sectZ1; - } - - sectX0 = sectX1; - } - } - - private void dispose() - { - if (vbo != null) - { - vbo.deleteGlBuffers(); - vbo = null; - } - } - - private void build() - { - Tessellator tess = Tessellator.getInstance(); - BufferBuilder buffer = tess.getBuffer(); - - vbo = new VertexBuffer(FORMAT); - - vertices(buffer); - - buffer.finishDrawing(); - buffer.reset(); - vbo.bufferData(buffer.getByteBuffer()); - } - - private int fullCoord(double coord, int scale) - { // Corrects misalignment of UV offset when on negative coords. - return ((int) coord / scale) - (coord < 0 ? 1 : 0); - } - - private boolean isBuilt() - { - return vbo != null; - } - - public void checkSettings() - { - boolean newEnabled = ForgeConfig.CLIENT.forgeCloudsEnabled.get() - && mc.gameSettings.getCloudOption() != CloudOption.OFF - && mc.world != null - && mc.world.dimension.isSurfaceWorld(); - - if (isBuilt() - && (!newEnabled - || mc.gameSettings.getCloudOption() != cloudMode - || mc.gameSettings.renderDistanceChunks != renderDistance)) - { - dispose(); - } - - cloudMode = mc.gameSettings.getCloudOption(); - renderDistance = mc.gameSettings.renderDistanceChunks; - - if (newEnabled && !isBuilt()) - { - build(); - } - } - - public boolean render(int cloudTicks, float partialTicks) - { - if (!isBuilt()) - return false; - - Entity entity = mc.getRenderViewEntity(); - - double totalOffset = cloudTicks + partialTicks; - - double x = entity.prevPosX + (entity.getPosX() - entity.prevPosX) * partialTicks - + totalOffset * 0.03; - double y = mc.world.dimension.getCloudHeight() - - (entity.lastTickPosY + (entity.getPosY() - entity.lastTickPosY) * partialTicks) - + 0.33; - double z = entity.prevPosZ + (entity.getPosZ() - entity.prevPosZ) * partialTicks; - - int scale = getScale(); - - if (cloudMode == CloudOption.FANCY) - z += 0.33 * scale; - - // Integer UVs to translate the texture matrix by. - int offU = fullCoord(x, scale); - int offV = fullCoord(z, scale); - - RenderSystem.pushMatrix(); - - // Translate by the remainder after the UV offset. - RenderSystem.translated((offU * scale) - x, y, (offV * scale) - z); - - // Modulo to prevent texture samples becoming inaccurate at extreme offsets. - offU = offU % texW; - offV = offV % texH; - - // Translate the texture. - RenderSystem.matrixMode(GL11.GL_TEXTURE); - RenderSystem.translatef(offU * PX_SIZE, offV * PX_SIZE, 0); - RenderSystem.matrixMode(GL11.GL_MODELVIEW); - - RenderSystem.disableCull(); - - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - - // Color multiplier. - Vec3d color = mc.world.getCloudColour(partialTicks); - float r = (float) color.x; - float g = (float) color.y; - float b = (float) color.z; - - if (COLOR_TEX == null) - COLOR_TEX = new DynamicTexture(1, 1, false); - - // Apply a color multiplier through a texture upload if shaders aren't supported. - COLOR_TEX.getTextureData().setPixelRGBA(0, 0, 255 << 24 - | ((int) (r * 255)) << 16 - | ((int) (g * 255)) << 8 - | (int) (b * 255)); - COLOR_TEX.updateDynamicTexture(); - - RenderSystem.activeTexture(GL13.GL_TEXTURE1); - RenderSystem.bindTexture(COLOR_TEX.getGlTextureId()); - RenderSystem.enableTexture(); - - // Bind the clouds texture last so the shader's sampler2D is correct. - RenderSystem.activeTexture(GL13.GL_TEXTURE0); - mc.textureManager.bindTexture(texture); - - ByteBuffer buffer = Tessellator.getInstance().getBuffer().getByteBuffer(); - - // Set up pointers for the display list/VBO. - vbo.bindBuffer(); - - int stride = FORMAT.getSize(); - RenderSystem.vertexPointer(3, GL11.GL_FLOAT, stride, 0); - RenderSystem.enableClientState(GL11.GL_VERTEX_ARRAY); - RenderSystem.texCoordPointer(2, GL11.GL_FLOAT, stride, 12); - RenderSystem.enableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - RenderSystem.colorPointer(4, GL11.GL_UNSIGNED_BYTE, stride, 20); - RenderSystem.enableClientState(GL11.GL_COLOR_ARRAY); - - // Depth pass to prevent insides rendering from the outside. - RenderSystem.colorMask(false, false, false, false); - vbo.drawArrays(GL11.GL_QUADS); - - // Full render. - RenderSystem.colorMask(true, true, true, true); - - // Wireframe for debug. - if (WIREFRAME) - { - RenderSystem.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); - RenderSystem.lineWidth(2.0F); - RenderSystem.disableTexture(); - RenderSystem.depthMask(false); - RenderSystem.disableFog(); - vbo.drawArrays(GL11.GL_QUADS); - RenderSystem.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); - RenderSystem.depthMask(true); - RenderSystem.enableTexture(); - RenderSystem.enableFog(); - } - - vbo.drawArrays(GL11.GL_QUADS); - VertexBuffer.unbindBuffer(); // Unbind buffer and disable pointers. - - buffer.limit(0); - for (int i = 0; i < FORMAT.getElements().size(); i++) - FORMAT.getElements().get(i).getUsage().postDraw(FORMAT, i, FORMAT.getSize(), buffer); - buffer.position(0); - - // Disable our coloring. - RenderSystem.activeTexture(GL13.GL_TEXTURE1); - RenderSystem.disableTexture(); - RenderSystem.activeTexture(GL13.GL_TEXTURE0); - - // Reset texture matrix. - RenderSystem.matrixMode(GL11.GL_TEXTURE); - RenderSystem.loadIdentity(); - RenderSystem.matrixMode(GL11.GL_MODELVIEW); - - RenderSystem.disableBlend(); - RenderSystem.enableCull(); - - RenderSystem.popMatrix(); - - return true; - } - - private void reloadTextures() - { - if (mc.textureManager != null) - { - mc.textureManager.bindTexture(texture); - texW = GlStateManager.func_227692_c_(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); - texH = GlStateManager.func_227692_c_(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT); - } - } - - @Override - public void onResourceManagerReload(@Nonnull IResourceManager resourceManager, @Nonnull Predicate resourcePredicate) - { - if (resourcePredicate.test(VanillaResourceType.TEXTURES)) - { - reloadTextures(); - } - } - - private static CloudRenderer cloudRenderer; - private static CloudRenderer getCloudRenderer() - { - if (cloudRenderer == null) - cloudRenderer = new CloudRenderer(); - return cloudRenderer; - } - - public static void updateCloudSettings() - { - getCloudRenderer().checkSettings(); - } - - public static boolean renderClouds(int cloudTicks, float partialTicks, ClientWorld world, Minecraft client) - { - IRenderHandler renderer = world.dimension.getCloudRenderer(); - if (renderer != null) - { - renderer.render(cloudTicks, partialTicks, world, client); - return true; - } - return getCloudRenderer().render(cloudTicks, partialTicks); - } - -} -*/ diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 9733c5273..707922e63 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -52,7 +52,16 @@ import java.util.stream.Stream; import javax.annotation.Nonnull; import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.model.*; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.fluid.FluidState; +import net.minecraft.util.math.vector.Matrix3f; +import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.math.vector.TransformationMatrix; +import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.IBlockDisplayReader; import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.fml.loading.progress.StartupMessageManager; @@ -82,13 +91,6 @@ import net.minecraft.client.renderer.FogRenderer.FogType; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.client.renderer.entity.model.BipedModel; -import net.minecraft.client.renderer.model.BakedQuad; -import net.minecraft.client.renderer.model.BlockFaceUV; -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.ItemCameraTransforms; -import net.minecraft.client.renderer.model.ItemTransformVec3f; -import net.minecraft.client.renderer.model.Material; -import net.minecraft.client.renderer.model.ModelManager; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.texture.NativeImage; import net.minecraft.client.renderer.texture.OverlayTexture; @@ -102,7 +104,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.IFluidState; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.RecipeManager; @@ -116,7 +117,6 @@ import net.minecraft.util.math.EntityRayTraceResult; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.ILightReader; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraftforge.client.event.ColorHandlerEvent; @@ -174,12 +174,6 @@ public class ForgeHooksClient return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent(context, info, target, partialTicks, matrix, buffers)); } - @Deprecated // TODO: Remove in 1.16 - public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks) - { - MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, mat, partialTicks)); - } - public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks, Matrix4f projectionMatrix, long finishTimeNano) { MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, mat, partialTicks, projectionMatrix, finishTimeNano)); @@ -280,10 +274,11 @@ public class ForgeHooksClient GameSettings settings = Minecraft.getInstance().gameSettings; int[] ranges = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34 }; int distance = 0; - if (settings.fancyGraphics && ranges.length > 0) - { - distance = ranges[MathHelper.clamp(settings.renderDistanceChunks, 0, ranges.length-1)]; - } + //TODO, GraphicsFanciness changed, and is getSkyBlendColour used still? +// if (settings.fancyGraphics && ranges.length > 0) +// { +// distance = ranges[MathHelper.clamp(settings.renderDistanceChunks, 0, ranges.length-1)]; +// } int r = 0; int g = 0; @@ -320,16 +315,16 @@ public class ForgeHooksClient //RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance); } - public static void renderMainMenu(MainMenuScreen gui, FontRenderer font, int width, int height) + public static void renderMainMenu(MainMenuScreen gui, MatrixStack mStack, FontRenderer font, int width, int height) { VersionChecker.Status status = ForgeVersion.getStatus(); if (status == BETA || status == BETA_OUTDATED) { // render a warning at the top of the screen, - String line = I18n.format("forge.update.beta.1", TextFormatting.RED, TextFormatting.RESET); - gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (0 * (font.FONT_HEIGHT + 1)), -1); - line = I18n.format("forge.update.beta.2"); - gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (1 * (font.FONT_HEIGHT + 1)), -1); + ITextComponent line = new TranslationTextComponent("forge.update.beta.1", TextFormatting.RED, TextFormatting.RESET); + gui.func_238472_a_(mStack, font, line, (width - font.func_238414_a_(line)) / 2, 4 + (0 * (font.FONT_HEIGHT + 1)), -1); + line = new TranslationTextComponent("forge.update.beta.2"); + gui.func_238472_a_(mStack, font, line, (width - font.func_238414_a_(line)) / 2, 4 + (1 * (font.FONT_HEIGHT + 1)), -1); } String line = null; @@ -362,11 +357,11 @@ public class ForgeHooksClient return worldRenderPass; } - public static void drawScreen(Screen screen, int mouseX, int mouseY, float partialTicks) + public static void drawScreen(Screen screen, MatrixStack mStack, 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)); + if (!MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Pre(screen, mStack, mouseX, mouseY, partialTicks))) + screen.func_230430_a_(mStack, mouseX, mouseY, partialTicks); + MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Post(screen, mStack, mouseX, mouseY, partialTicks)); } public static float getFogDensity(FogType type, ActiveRenderInfo info, float partial, float density) @@ -394,11 +389,11 @@ public class ForgeHooksClient modelLoader.onPostBakeEvent(modelRegistry); } - private static final net.minecraft.client.renderer.Matrix4f flipX; - private static final net.minecraft.client.renderer.Matrix3f flipXNormal; + private static final Matrix4f flipX; + private static final Matrix3f flipXNormal; static { flipX = Matrix4f.makeScale(-1,1,1); - flipXNormal = new net.minecraft.client.renderer.Matrix3f(flipX); + flipXNormal = new Matrix3f(flipX); } public static IBakedModel handleCameraTransforms(MatrixStack matrixStack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery) @@ -410,8 +405,8 @@ public class ForgeHooksClient if (!stack.clear()) { // Apply the transformation to the real matrix stack, flipping for left hand - net.minecraft.client.renderer.Matrix4f tMat = stack.getLast().getMatrix(); - net.minecraft.client.renderer.Matrix3f nMat = stack.getLast().getNormal(); + Matrix4f tMat = stack.getLast().getMatrix(); + Matrix3f nMat = stack.getLast().getNormal(); if (leftHandHackery) { tMat.multiplyBackward(flipX); @@ -532,7 +527,7 @@ public class ForgeHooksClient }*/ @SuppressWarnings("deprecation") - public static TextureAtlasSprite[] getFluidSprites(ILightReader world, BlockPos pos, IFluidState fluidStateIn) + public static TextureAtlasSprite[] getFluidSprites(IBlockDisplayReader world, BlockPos pos, FluidState fluidStateIn) { ResourceLocation overlayTexture = fluidStateIn.getFluid().getAttributes().getOverlayTexture(); return new TextureAtlasSprite[] { @@ -542,14 +537,14 @@ public class ForgeHooksClient }; } - public static void gatherFluidTextures(Set textures) + public static void gatherFluidTextures(Set textures) { ForgeRegistries.FLUIDS.getValues().stream() .flatMap(ForgeHooksClient::getFluidMaterials) .forEach(textures::add); } - public static Stream getFluidMaterials(Fluid fluid) + public static Stream getFluidMaterials(Fluid fluid) { return fluid.getAttributes().getTextures() .filter(Objects::nonNull) @@ -557,9 +552,9 @@ public class ForgeHooksClient } @SuppressWarnings("deprecation") - public static Material getBlockMaterial(ResourceLocation loc) + public static RenderMaterial getBlockMaterial(ResourceLocation loc) { - return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, loc); + return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, loc); } /** @@ -631,17 +626,17 @@ public class ForgeHooksClient return from.getItem().shouldCauseReequipAnimation(from, to, changed); } - public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MainWindow res, ClientBossInfo bossInfo, int x, int y, int increment) + public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MatrixStack mStack, MainWindow res, ClientBossInfo bossInfo, int x, int y, int increment) { - RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), + RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(mStack, new RenderGameOverlayEvent(mStack, Animation.getPartialTickTime(), res), BOSSINFO, bossInfo, x, y, increment); MinecraftForge.EVENT_BUS.post(evt); return evt; } - public static void bossBarRenderPost(MainWindow res) + public static void bossBarRenderPost(MatrixStack mStack, MainWindow res) { - MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO)); + MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(mStack, new RenderGameOverlayEvent(mStack, Animation.getPartialTickTime(), res), BOSSINFO)); } public static ScreenshotEvent onScreenshot(NativeImage image, File screenshotFile) diff --git a/src/main/java/net/minecraftforge/client/event/GuiContainerEvent.java b/src/main/java/net/minecraftforge/client/event/GuiContainerEvent.java index de2ef74ee..dc40f653c 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiContainerEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiContainerEvent.java @@ -19,6 +19,7 @@ package net.minecraftforge.client.event; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraftforge.eventbus.api.Event; @@ -48,6 +49,7 @@ public class GuiContainerEvent extends Event */ public static class DrawForeground extends GuiContainerEvent { + private final MatrixStack mStack; private final int mouseX; private final int mouseY; @@ -55,16 +57,23 @@ public class GuiContainerEvent extends Event * Called directly after the GuiContainer has drawn any foreground elements. * * @param guiContainer The container. + * @param mStack The MatrixStack. * @param mouseX The current X position of the players mouse. * @param mouseY The current Y position of the players mouse. */ - public DrawForeground(ContainerScreen guiContainer, int mouseX, int mouseY) + public DrawForeground(ContainerScreen guiContainer, MatrixStack mStack, int mouseX, int mouseY) { super(guiContainer); + this.mStack = mStack; this.mouseX = mouseX; this.mouseY = mouseY; } + public MatrixStack getMatrixStack() + { + return mStack; + } + public int getMouseX() { return mouseX; @@ -82,6 +91,7 @@ public class GuiContainerEvent extends Event */ public static class DrawBackground extends GuiContainerEvent { + private final MatrixStack mStack; private final int mouseX; private final int mouseY; @@ -89,16 +99,23 @@ public class GuiContainerEvent extends Event * Called directly after the GuiContainer has drawn any background elements. * * @param guiContainer The container. + * @param mStack The MatrixStack. * @param mouseX The current X position of the players mouse. * @param mouseY The current Y position of the players mouse. */ - public DrawBackground(ContainerScreen guiContainer, int mouseX, int mouseY) + public DrawBackground(ContainerScreen guiContainer, MatrixStack mStack, int mouseX, int mouseY) { super(guiContainer); + this.mStack = mStack; this.mouseX = mouseX; this.mouseY = mouseY; } + public MatrixStack getMatrixStack() + { + return mStack; + } + public int getMouseX() { return mouseX; diff --git a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java index 34facf58d..c865a688f 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.List; import java.util.function.Consumer; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.IGuiEventListener; import net.minecraftforge.api.distmarker.Dist; @@ -127,18 +128,28 @@ public class GuiScreenEvent extends Event public static class DrawScreenEvent extends GuiScreenEvent { + private final MatrixStack mStack; private final int mouseX; private final int mouseY; private final float renderPartialTicks; - public DrawScreenEvent(Screen gui, int mouseX, int mouseY, float renderPartialTicks) + public DrawScreenEvent(Screen gui, MatrixStack mStack, int mouseX, int mouseY, float renderPartialTicks) { super(gui); + this.mStack = mStack; this.mouseX = mouseX; this.mouseY = mouseY; this.renderPartialTicks = renderPartialTicks; } + /** + * The MatrixStack to render with. + */ + public MatrixStack getMatrixStack() + { + return mStack; + } + /** * The x coordinate of the mouse pointer on the screen. */ @@ -170,9 +181,9 @@ public class GuiScreenEvent extends Event @Cancelable public static class Pre extends DrawScreenEvent { - public Pre(Screen gui, int mouseX, int mouseY, float renderPartialTicks) + public Pre(Screen gui, MatrixStack mStack, int mouseX, int mouseY, float renderPartialTicks) { - super(gui, mouseX, mouseY, renderPartialTicks); + super(gui, mStack, mouseX, mouseY, renderPartialTicks); } } @@ -181,9 +192,9 @@ public class GuiScreenEvent extends Event */ public static class Post extends DrawScreenEvent { - public Post(Screen gui, int mouseX, int mouseY, float renderPartialTicks) + public Post(Screen gui, MatrixStack mStack, int mouseX, int mouseY, float renderPartialTicks) { - super(gui, mouseX, mouseY, renderPartialTicks); + super(gui, mStack, mouseX, mouseY, renderPartialTicks); } } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java index dd600bb41..a28dce285 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java @@ -21,6 +21,7 @@ package net.minecraftforge.client.event; import java.util.ArrayList; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; import net.minecraft.client.MainWindow; @@ -70,19 +71,22 @@ public class RenderGameOverlayEvent extends Event VIGNETTE } + private final MatrixStack mStack; private final float partialTicks; private final MainWindow window; private final ElementType type; - public RenderGameOverlayEvent(float partialTicks, MainWindow window) + public RenderGameOverlayEvent(MatrixStack mStack, float partialTicks, MainWindow window) { + this.mStack = mStack; this.partialTicks = partialTicks; this.window = window; this.type = null; } - private RenderGameOverlayEvent(RenderGameOverlayEvent parent, ElementType type) + private RenderGameOverlayEvent(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type) { + this.mStack = mStack; this.partialTicks = parent.getPartialTicks(); this.window = parent.getWindow(); this.type = type; @@ -90,17 +94,17 @@ public class RenderGameOverlayEvent extends Event public static class Pre extends RenderGameOverlayEvent { - public Pre(RenderGameOverlayEvent parent, ElementType type) + public Pre(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type) { - super(parent, type); + super(mStack, parent, type); } } public static class Post extends RenderGameOverlayEvent { - public Post(RenderGameOverlayEvent parent, ElementType type) + public Post(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type) { - super(parent, type); + super(mStack, parent, type); } @Override public boolean isCancelable(){ return false; } } @@ -111,9 +115,9 @@ public class RenderGameOverlayEvent extends Event private final int x; private final int y; private int increment; - public BossInfo(RenderGameOverlayEvent parent, ElementType type, ClientBossInfo bossInfo, int x, int y, int increment) + public BossInfo(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type, ClientBossInfo bossInfo, int x, int y, int increment) { - super(parent, type); + super(mStack, parent, type); this.bossInfo = bossInfo; this.x = x; this.y = y; @@ -166,9 +170,9 @@ public class RenderGameOverlayEvent extends Event { private final ArrayList left; private final ArrayList right; - public Text(RenderGameOverlayEvent parent, ArrayList left, ArrayList right) + public Text(MatrixStack mStack, RenderGameOverlayEvent parent, ArrayList left, ArrayList right) { - super(parent, ElementType.TEXT); + super(mStack, parent, ElementType.TEXT); this.left = left; this.right = right; } @@ -189,9 +193,9 @@ public class RenderGameOverlayEvent extends Event private int posX; private int posY; - public Chat(RenderGameOverlayEvent parent, int posX, int posY) + public Chat(MatrixStack mStack, RenderGameOverlayEvent parent, int posX, int posY) { - super(parent, ElementType.CHAT); + super(mStack, parent, ElementType.CHAT); this.setPosX(posX); this.setPosY(posY); } diff --git a/src/main/java/net/minecraftforge/client/event/RenderNameplateEvent.java b/src/main/java/net/minecraftforge/client/event/RenderNameplateEvent.java index ac20c02d1..f209482d8 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderNameplateEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderNameplateEvent.java @@ -19,12 +19,11 @@ package net.minecraftforge.client.event; -import javax.annotation.Nullable; - import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.entity.Entity; +import net.minecraft.util.text.ITextComponent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.eventbus.api.Event; @@ -53,20 +52,14 @@ import net.minecraftforge.eventbus.api.Event; public class RenderNameplateEvent extends EntityEvent { - private String nameplateContent; - private final String originalContent; + private ITextComponent nameplateContent; + private final ITextComponent originalContent; private final EntityRenderer entityRenderer; private final MatrixStack matrixStack; private final IRenderTypeBuffer renderTypeBuffer; private final int packedLight; - @Deprecated //TODO 1.16: upon removal, also remove @Nullable on getEntityRenderer(), and update its javadoc - public RenderNameplateEvent(Entity entity, String content, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer) - { - this(entity, content, null, matrixStack, renderTypeBuffer, 0); - } - - public RenderNameplateEvent(Entity entity, String content, EntityRenderer entityRenderer, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int packedLight) + public RenderNameplateEvent(Entity entity, ITextComponent content, EntityRenderer entityRenderer, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int packedLight) { super(entity); this.originalContent = content; @@ -80,7 +73,7 @@ public class RenderNameplateEvent extends EntityEvent /** * Sets the content that is to be rendered on the name plate/tag */ - public void setContent(String contents) + public void setContent(ITextComponent contents) { this.nameplateContent = contents; } @@ -88,7 +81,7 @@ public class RenderNameplateEvent extends EntityEvent /** * The content being rendered on the name plate/tag */ - public String getContent() + public ITextComponent getContent() { return this.nameplateContent; } @@ -96,7 +89,7 @@ public class RenderNameplateEvent extends EntityEvent /** * The original content being rendered on the name plate/tag */ - public String getOriginalContent() + public ITextComponent getOriginalContent() { return this.originalContent; } @@ -104,7 +97,6 @@ public class RenderNameplateEvent extends EntityEvent /** * The entity renderer that renders the name plate/tag, if it was provided */ - @Nullable public EntityRenderer getEntityRenderer() { return this.entityRenderer; diff --git a/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java b/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java index a4b37c345..2adad87bc 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java @@ -26,6 +26,7 @@ import javax.annotation.Nonnull; import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.ItemStack; +import net.minecraft.util.text.ITextProperties; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; @@ -46,12 +47,12 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api { @Nonnull protected final ItemStack stack; - protected final List lines; + protected final List lines; protected int x; protected int y; protected FontRenderer fr; - public RenderTooltipEvent(@Nonnull ItemStack stack, @Nonnull List lines, int x, int y, @Nonnull FontRenderer fr) + public RenderTooltipEvent(@Nonnull ItemStack stack, @Nonnull List lines, int x, int y, @Nonnull FontRenderer fr) { this.stack = stack; this.lines = Collections.unmodifiableList(lines); // Leave editing to ItemTooltipEvent @@ -75,7 +76,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api * @return An unmodifiable list of strings. Use {@link ItemTooltipEvent} to modify tooltip text. */ @Nonnull - public List getLines() + public List getLines() { return lines; } @@ -117,7 +118,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api private int screenHeight; private int maxWidth; - public Pre(@Nonnull ItemStack stack, @Nonnull List lines, int x, int y, int screenWidth, int screenHeight, int maxWidth, @Nonnull FontRenderer fr) + public Pre(@Nonnull ItemStack stack, @Nonnull List lines, int x, int y, int screenWidth, int screenHeight, int maxWidth, @Nonnull FontRenderer fr) { super(stack, lines, x, y, fr); this.screenWidth = screenWidth; @@ -200,7 +201,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api private final int width; private final int height; - public Post(@Nonnull ItemStack stack, @Nonnull List textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height) + public Post(@Nonnull ItemStack stack, @Nonnull List textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height) { super(stack, textLines, x, y, fr); this.width = width; @@ -229,7 +230,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api */ public static class PostBackground extends Post { - public PostBackground(@Nonnull ItemStack stack, @Nonnull List textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height) + public PostBackground(@Nonnull ItemStack stack, @Nonnull List textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height) { super(stack, textLines, x, y, fr, width, height); } } @@ -238,7 +239,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api */ public static class PostText extends Post { - public PostText(@Nonnull ItemStack stack, @Nonnull List textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height) + public PostText(@Nonnull ItemStack stack, @Nonnull List textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height) { super(stack, textLines, x, y, fr, width, height); } } @@ -254,7 +255,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api private int borderStart; private int borderEnd; - public Color(@Nonnull ItemStack stack, @Nonnull List textLines, int x, int y, @Nonnull FontRenderer fr, int background, int borderStart, + public Color(@Nonnull ItemStack stack, @Nonnull List textLines, int x, int y, @Nonnull FontRenderer fr, int background, int borderStart, int borderEnd) { super(stack, textLines, x, y, fr); diff --git a/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java b/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java index dacef4b65..46aac49fb 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java @@ -21,8 +21,8 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.matrix.MatrixStack; -import net.minecraft.client.renderer.Matrix4f; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.util.math.vector.Matrix4f; public class RenderWorldLastEvent extends net.minecraftforge.eventbus.api.Event { @@ -32,16 +32,6 @@ public class RenderWorldLastEvent extends net.minecraftforge.eventbus.api.Event private final Matrix4f projectionMatrix; private final long finishTimeNano; - @Deprecated // TODO: Remove in 1.16 - public RenderWorldLastEvent(WorldRenderer context, MatrixStack mat, float partialTicks) - { - this.context = context; - this.mat = mat; - this.partialTicks = partialTicks; - this.projectionMatrix = null; - this.finishTimeNano = 0; - } - public RenderWorldLastEvent(WorldRenderer context, MatrixStack mat, float partialTicks, Matrix4f projectionMatrix, long finishTimeNano) { this.context = context; diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java b/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java index a6cd022d3..f08d75b73 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java @@ -34,7 +34,7 @@ import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; import net.minecraftforge.client.model.data.IModelData; public interface IForgeBakedModel @@ -66,7 +66,7 @@ public interface IForgeBakedModel return net.minecraftforge.client.ForgeHooksClient.handlePerspective(getBakedModel(), cameraTransformType, mat); } - default @Nonnull IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) + default @Nonnull IModelData getModelData(@Nonnull IBlockDisplayReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) { return tileData; } diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeModelTransform.java b/src/main/java/net/minecraftforge/client/extensions/IForgeModelTransform.java index af24e3599..ada53b00c 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeModelTransform.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeModelTransform.java @@ -19,7 +19,7 @@ package net.minecraftforge.client.extensions; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; /** * An {@code IModelState} is a function from model part to a transformation that should be applied diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeTransformationMatrix.java b/src/main/java/net/minecraftforge/client/extensions/IForgeTransformationMatrix.java index 2d5436dba..0865a58ec 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeTransformationMatrix.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeTransformationMatrix.java @@ -20,8 +20,8 @@ package net.minecraftforge.client.extensions; import com.mojang.blaze3d.matrix.MatrixStack; -import net.minecraft.client.renderer.*; import net.minecraft.util.Direction; +import net.minecraft.util.math.vector.*; /* * Replacement interface for ModelRotation to allow custom transformations of vanilla models. diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeVertexBuilder.java b/src/main/java/net/minecraftforge/client/extensions/IForgeVertexBuilder.java index 164db6e3a..982c291c9 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeVertexBuilder.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeVertexBuilder.java @@ -23,13 +23,9 @@ import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.client.renderer.LightTexture; -import net.minecraft.client.renderer.Matrix3f; -import net.minecraft.client.renderer.Matrix4f; -import net.minecraft.client.renderer.Vector3f; -import net.minecraft.client.renderer.Vector4f; import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.math.Vec3i; +import net.minecraft.util.math.vector.*; import net.minecraftforge.client.model.pipeline.LightUtil; import org.lwjgl.system.MemoryStack; @@ -60,7 +56,7 @@ public interface IForgeVertexBuilder // Copy of addQuad with alpha support default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean readExistingColor) { int[] aint = bakedQuad.getVertexData(); - Vec3i faceNormal = bakedQuad.getFace().getDirectionVec(); + Vector3i faceNormal = bakedQuad.getFace().getDirectionVec(); Vector3f normal = new Vector3f((float)faceNormal.getX(), (float)faceNormal.getY(), (float)faceNormal.getZ()); Matrix4f matrix4f = matrixEntry.getMatrix(); normal.transform(matrixEntry.getNormal()); diff --git a/src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java b/src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java index 1ab68ecd9..e4849fa2f 100644 --- a/src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java +++ b/src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java @@ -24,6 +24,7 @@ import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType import java.util.ArrayList; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.AbstractGui; @@ -33,8 +34,8 @@ import net.minecraft.client.network.play.ClientPlayNetHandler; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.ai.attributes.Attributes; +import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.block.Blocks; import net.minecraft.potion.Effects; @@ -105,11 +106,11 @@ public class ForgeIngameGui extends IngameGui } @Override - public void renderGameOverlay(float partialTicks) + public void func_238445_a_(MatrixStack mStack, float partialTicks) { this.scaledWidth = this.mc.getMainWindow().getScaledWidth(); this.scaledHeight = this.mc.getMainWindow().getScaledHeight(); - eventParent = new RenderGameOverlayEvent(partialTicks, this.mc.getMainWindow()); + eventParent = new RenderGameOverlayEvent(mStack, partialTicks, this.mc.getMainWindow()); renderHealthMount = mc.player.getRidingEntity() instanceof LivingEntity; renderFood = mc.player.getRidingEntity() == null; renderJumpBar = mc.player.isRidingHorse(); @@ -117,7 +118,7 @@ public class ForgeIngameGui extends IngameGui right_height = 39; left_height = 39; - if (pre(ALL)) return; + if (pre(ALL, mStack)) return; fontrenderer = mc.fontRenderer; //mc.entityRenderer.setupOverlayRendering(); @@ -132,7 +133,7 @@ public class ForgeIngameGui extends IngameGui RenderSystem.defaultBlendFunc(); } - if (renderHelmet) renderHelmet(partialTicks); + if (renderHelmet) renderHelmet(partialTicks, mStack); if (renderPortal && !mc.player.isPotionActive(Effects.NAUSEA)) { @@ -141,55 +142,55 @@ public class ForgeIngameGui extends IngameGui if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR) { - if (renderSpectatorTooltip) spectatorGui.renderTooltip(partialTicks); + if (renderSpectatorTooltip) spectatorGui.func_238528_a_(mStack, partialTicks); } else if (!this.mc.gameSettings.hideGUI) { - if (renderHotbar) renderHotbar(partialTicks); + if (renderHotbar) func_238443_a_(partialTicks, mStack); } if (!this.mc.gameSettings.hideGUI) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - setBlitOffset(-90); + func_230926_e_(-90); rand.setSeed((long)(ticks * 312871)); - if (renderCrosshairs) renderAttackIndicator(); - if (renderBossHealth) renderBossHealth(); + if (renderCrosshairs) func_238456_d_(mStack); + if (renderBossHealth) renderBossHealth(mStack); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); if (this.mc.playerController.shouldDrawHUD() && this.mc.getRenderViewEntity() instanceof PlayerEntity) { - if (renderHealth) renderHealth(this.scaledWidth, this.scaledHeight); - if (renderArmor) renderArmor(this.scaledWidth, this.scaledHeight); - if (renderFood) renderFood(this.scaledWidth, this.scaledHeight); - if (renderHealthMount) renderHealthMount(this.scaledWidth, this.scaledHeight); - if (renderAir) renderAir(this.scaledWidth, this.scaledHeight); + if (renderHealth) renderHealth(this.scaledWidth, this.scaledHeight, mStack); + if (renderArmor) renderArmor(mStack, this.scaledWidth, this.scaledHeight); + if (renderFood) renderFood(this.scaledWidth, this.scaledHeight, mStack); + if (renderHealthMount) renderHealthMount(this.scaledWidth, this.scaledHeight, mStack); + if (renderAir) renderAir(this.scaledWidth, this.scaledHeight, mStack); } if (renderJumpBar) { - renderHorseJumpBar(this.scaledWidth / 2 - 91); + func_238446_a_(mStack, this.scaledWidth / 2 - 91); } else if (renderExperiance) { - renderExperience(this.scaledWidth / 2 - 91); + renderExperience(this.scaledWidth / 2 - 91, mStack); } if (this.mc.gameSettings.heldItemTooltips && this.mc.playerController.getCurrentGameType() != GameType.SPECTATOR) { - this.renderSelectedItem(); + this.func_238453_b_(mStack); } else if (this.mc.player.isSpectator()) { - this.spectatorGui.renderSelectedItem(); + this.spectatorGui.func_238527_a_(mStack); } } - renderSleepFade(this.scaledWidth, this.scaledHeight); + renderSleepFade(this.scaledWidth, this.scaledHeight, mStack); - renderHUDText(this.scaledWidth, this.scaledHeight); - renderFPSGraph(); - renderPotionEffects(); + renderHUDText(this.scaledWidth, this.scaledHeight, mStack); + renderFPSGraph(mStack); + func_238444_a_(mStack); if (!mc.gameSettings.hideGUI) { - renderRecordOverlay(this.scaledWidth, this.scaledHeight, partialTicks); - renderSubtitles(); - renderTitle(this.scaledWidth, this.scaledHeight, partialTicks); + renderRecordOverlay(this.scaledWidth, this.scaledHeight, partialTicks, mStack); + renderSubtitles(mStack); + renderTitle(this.scaledWidth, this.scaledHeight, partialTicks, mStack); } @@ -204,66 +205,67 @@ public class ForgeIngameGui extends IngameGui ScoreObjective scoreobjective1 = objective != null ? objective : scoreboard.getObjectiveInDisplaySlot(1); if (renderObjective && scoreobjective1 != null) { - this.renderScoreboard(scoreobjective1); + this.func_238447_a_(mStack, scoreobjective1); } RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); RenderSystem.disableAlphaTest(); - renderChat(this.scaledWidth, this.scaledHeight); + renderChat(this.scaledWidth, this.scaledHeight, mStack); - renderPlayerList(this.scaledWidth, this.scaledHeight); + renderPlayerList(this.scaledWidth, this.scaledHeight, mStack); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.enableAlphaTest(); - post(ALL); + post(ALL, mStack); } @Override - protected void renderAttackIndicator() + protected void func_238456_d_(MatrixStack mStack) { - if (pre(CROSSHAIRS)) return; - bind(AbstractGui.GUI_ICONS_LOCATION); + if (pre(CROSSHAIRS, mStack)) return; + bind(AbstractGui.field_230665_h_); RenderSystem.enableBlend(); RenderSystem.enableAlphaTest(); - super.renderAttackIndicator(); - post(CROSSHAIRS); + super.func_238456_d_(mStack); + post(CROSSHAIRS, mStack); } @Override - protected void renderPotionEffects() + protected void func_238444_a_(MatrixStack mStack) { - if (pre(POTION_ICONS)) return; - super.renderPotionEffects(); - post(POTION_ICONS); + if (pre(POTION_ICONS, mStack)) return; + super.func_238444_a_(mStack); + post(POTION_ICONS, mStack); } - protected void renderSubtitles() + protected void renderSubtitles(MatrixStack mStack) { - if (pre(SUBTITLES)) return; - this.overlaySubtitle.render(); - post(SUBTITLES); + if (pre(SUBTITLES, mStack)) return; + this.overlaySubtitle.render(mStack); + post(SUBTITLES, mStack); } - protected void renderBossHealth() + protected void renderBossHealth(MatrixStack mStack) { - if (pre(BOSSHEALTH)) return; - bind(AbstractGui.GUI_ICONS_LOCATION); + if (pre(BOSSHEALTH, mStack)) return; + bind(AbstractGui.field_230665_h_); RenderSystem.defaultBlendFunc(); mc.getProfiler().startSection("bossHealth"); RenderSystem.enableBlend(); - this.overlayBoss.render(); + this.overlayBoss.func_238484_a_(mStack); RenderSystem.disableBlend(); mc.getProfiler().endSection(); - post(BOSSHEALTH); + post(BOSSHEALTH, mStack); } @Override protected void renderVignette(Entity entity) { - if (pre(VIGNETTE)) + MatrixStack mStack = new MatrixStack(); + if (pre(VIGNETTE, mStack)) { // Need to put this here, since Vanilla assumes this state after the vignette was rendered. RenderSystem.enableDepthTest(); @@ -271,12 +273,13 @@ public class ForgeIngameGui extends IngameGui return; } super.renderVignette(entity); - post(VIGNETTE); + post(VIGNETTE, mStack); } - private void renderHelmet(float partialTicks) + + private void renderHelmet(float partialTicks, MatrixStack mStack) { - if (pre(HELMET)) return; + if (pre(HELMET, mStack)) return; ItemStack itemstack = this.mc.player.inventory.armorItemInSlot(3); @@ -293,12 +296,12 @@ public class ForgeIngameGui extends IngameGui } } - post(HELMET); + post(HELMET, mStack); } - protected void renderArmor(int width, int height) + protected void renderArmor(MatrixStack mStack, int width, int height) { - if (pre(ARMOR)) return; + if (pre(ARMOR, mStack)) return; mc.getProfiler().startSection("armor"); RenderSystem.enableBlend(); @@ -310,15 +313,15 @@ public class ForgeIngameGui extends IngameGui { if (i < level) { - blit(left, top, 34, 9, 9, 9); + func_238474_b_(mStack, left, top, 34, 9, 9, 9); } else if (i == level) { - blit(left, top, 25, 9, 9, 9); + func_238474_b_(mStack, left, top, 25, 9, 9, 9); } else if (i > level) { - blit(left, top, 16, 9, 9, 9); + func_238474_b_(mStack, left, top, 16, 9, 9, 9); } left += 8; } @@ -326,13 +329,14 @@ public class ForgeIngameGui extends IngameGui RenderSystem.disableBlend(); mc.getProfiler().endSection(); - post(ARMOR); + post(ARMOR, mStack); } @Override protected void renderPortal(float partialTicks) { - if (pre(PORTAL)) return; + MatrixStack mStack = new MatrixStack(); + if (pre(PORTAL, mStack)) return; float f1 = mc.player.prevTimeInPortal + (mc.player.timeInPortal - mc.player.prevTimeInPortal) * partialTicks; @@ -341,35 +345,29 @@ public class ForgeIngameGui extends IngameGui super.renderPortal(f1); } - post(PORTAL); + post(PORTAL, mStack); } @Override - protected void renderHotbar(float partialTicks) + protected void func_238443_a_(float partialTicks, MatrixStack mStack) { - if (pre(HOTBAR)) return; + if (pre(HOTBAR, mStack)) return; if (mc.playerController.getCurrentGameType() == GameType.SPECTATOR) { - this.spectatorGui.renderTooltip(partialTicks); + this.spectatorGui.func_238528_a_(mStack, partialTicks); } else { - super.renderHotbar(partialTicks); + super.func_238443_a_(partialTicks, mStack); } - post(HOTBAR); + post(HOTBAR, mStack); } - @Override - public void setOverlayMessage(ITextComponent component, boolean animateColor) + protected void renderAir(int width, int height, MatrixStack mStack) { - this.setOverlayMessage(component.getFormattedText(), animateColor); - } - - protected void renderAir(int width, int height) - { - if (pre(AIR)) return; + if (pre(AIR, mStack)) return; mc.getProfiler().startSection("air"); PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity(); RenderSystem.enableBlend(); @@ -384,20 +382,20 @@ public class ForgeIngameGui extends IngameGui for (int i = 0; i < full + partial; ++i) { - blit(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9); + func_238474_b_(mStack, left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9); } right_height += 10; } RenderSystem.disableBlend(); mc.getProfiler().endSection(); - post(AIR); + post(AIR, mStack); } - public void renderHealth(int width, int height) + public void renderHealth(int width, int height, MatrixStack mStack) { - bind(GUI_ICONS_LOCATION); - if (pre(HEALTH)) return; + bind(field_230665_h_); + if (pre(HEALTH, mStack)) return; mc.getProfiler().startSection("health"); RenderSystem.enableBlend(); @@ -426,7 +424,7 @@ public class ForgeIngameGui extends IngameGui this.playerHealth = health; int healthLast = this.lastPlayerHealth; - IAttributeInstance attrMaxHealth = player.getAttribute(SharedMonsterAttributes.MAX_HEALTH); + ModifiableAttributeInstance attrMaxHealth = player.getAttribute(Attributes.field_233818_a_); float healthMax = (float)attrMaxHealth.getValue(); float absorb = MathHelper.ceil(player.getAbsorptionAmount()); @@ -463,46 +461,46 @@ public class ForgeIngameGui extends IngameGui if (health <= 4) y += rand.nextInt(2); if (i == regen) y -= 2; - blit(x, y, BACKGROUND, TOP, 9, 9); + func_238474_b_(mStack, x, y, BACKGROUND, TOP, 9, 9); if (highlight) { if (i * 2 + 1 < healthLast) - blit(x, y, MARGIN + 54, TOP, 9, 9); //6 + func_238474_b_(mStack, x, y, MARGIN + 54, TOP, 9, 9); //6 else if (i * 2 + 1 == healthLast) - blit(x, y, MARGIN + 63, TOP, 9, 9); //7 + func_238474_b_(mStack, x, y, MARGIN + 63, TOP, 9, 9); //7 } if (absorbRemaining > 0.0F) { if (absorbRemaining == absorb && absorb % 2.0F == 1.0F) { - blit(x, y, MARGIN + 153, TOP, 9, 9); //17 + func_238474_b_(mStack, x, y, MARGIN + 153, TOP, 9, 9); //17 absorbRemaining -= 1.0F; } else { - blit(x, y, MARGIN + 144, TOP, 9, 9); //16 + func_238474_b_(mStack, x, y, MARGIN + 144, TOP, 9, 9); //16 absorbRemaining -= 2.0F; } } else { if (i * 2 + 1 < health) - blit(x, y, MARGIN + 36, TOP, 9, 9); //4 + func_238474_b_(mStack, x, y, MARGIN + 36, TOP, 9, 9); //4 else if (i * 2 + 1 == health) - blit(x, y, MARGIN + 45, TOP, 9, 9); //5 + func_238474_b_(mStack, x, y, MARGIN + 45, TOP, 9, 9); //5 } } RenderSystem.disableBlend(); mc.getProfiler().endSection(); - post(HEALTH); + post(HEALTH, mStack); } - public void renderFood(int width, int height) + public void renderFood(int width, int height, MatrixStack mStack) { - if (pre(FOOD)) return; + if (pre(FOOD, mStack)) return; mc.getProfiler().startSection("food"); PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity(); @@ -535,19 +533,19 @@ public class ForgeIngameGui extends IngameGui y = top + (rand.nextInt(3) - 1); } - blit(x, y, 16 + background * 9, 27, 9, 9); + func_238474_b_(mStack, x, y, 16 + background * 9, 27, 9, 9); if (idx < level) - blit(x, y, icon + 36, 27, 9, 9); + func_238474_b_(mStack, x, y, icon + 36, 27, 9, 9); else if (idx == level) - blit(x, y, icon + 45, 27, 9, 9); + func_238474_b_(mStack, x, y, icon + 45, 27, 9, 9); } RenderSystem.disableBlend(); mc.getProfiler().endSection(); - post(FOOD); + post(FOOD, mStack); } - protected void renderSleepFade(int width, int height) + protected void renderSleepFade(int width, int height, MatrixStack mStack) { if (mc.player.getSleepTimer() > 0) { @@ -563,48 +561,48 @@ public class ForgeIngameGui extends IngameGui } int color = (int)(220.0F * opacity) << 24 | 1052704; - fill(0, 0, width, height, color); + func_238467_a_(mStack, 0, 0, width, height, color); RenderSystem.enableAlphaTest(); RenderSystem.enableDepthTest(); mc.getProfiler().endSection(); } } - protected void renderExperience(int x) + protected void renderExperience(int x, MatrixStack mStack) { - bind(GUI_ICONS_LOCATION); - if (pre(EXPERIENCE)) return; + bind(field_230665_h_); + if (pre(EXPERIENCE, mStack)) return; RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); if (mc.playerController.gameIsSurvivalOrAdventure()) { - super.renderExpBar(x); + super.func_238454_b_(mStack, x); } RenderSystem.enableBlend(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - post(EXPERIENCE); + post(EXPERIENCE, mStack); } @Override - public void renderHorseJumpBar(int x) + public void func_238446_a_(MatrixStack mStack, int x) { - bind(GUI_ICONS_LOCATION); - if (pre(JUMPBAR)) return; + bind(field_230665_h_); + if (pre(JUMPBAR, mStack)) return; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); - super.renderHorseJumpBar(x); + super.func_238446_a_(mStack, x); RenderSystem.enableBlend(); mc.getProfiler().endSection(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - post(JUMPBAR); + post(JUMPBAR, mStack); } - protected void renderHUDText(int width, int height) + protected void renderHUDText(int width, int height, MatrixStack mStack) { mc.getProfiler().startSection("forgeHudText"); RenderSystem.defaultBlendFunc(); @@ -624,23 +622,23 @@ public class ForgeIngameGui extends IngameGui } } - if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG)) + if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG, mStack)) { debugOverlay.update(); listL.addAll(debugOverlay.getLeft()); listR.addAll(debugOverlay.getRight()); - post(DEBUG); + post(DEBUG, mStack); } - RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(eventParent, listL, listR); + RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(mStack, eventParent, listL, listR); if (!MinecraftForge.EVENT_BUS.post(event)) { int top = 2; for (String msg : listL) { if (msg == null) continue; - fill(1, top - 1, 2 + fontrenderer.getStringWidth(msg) + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752); - fontrenderer.drawStringWithShadow(msg, 2, top, 14737632); + func_238467_a_(mStack, 1, top - 1, 2 + fontrenderer.getStringWidth(msg) + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752); + fontrenderer.func_238421_b_(mStack, msg, 2, top, 14737632); top += fontrenderer.FONT_HEIGHT; } @@ -650,26 +648,26 @@ public class ForgeIngameGui extends IngameGui if (msg == null) continue; int w = fontrenderer.getStringWidth(msg); int left = width - 2 - w; - fill(left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752); - fontrenderer.drawStringWithShadow(msg, left, top, 14737632); + func_238467_a_(mStack, left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752); + fontrenderer.func_238421_b_(mStack, msg, left, top, 14737632); top += fontrenderer.FONT_HEIGHT; } } mc.getProfiler().endSection(); - post(TEXT); + post(TEXT, mStack); } - protected void renderFPSGraph() + protected void renderFPSGraph(MatrixStack mStack) { - if (this.mc.gameSettings.showDebugInfo && this.mc.gameSettings.showLagometer && !pre(FPS_GRAPH)) + if (this.mc.gameSettings.showDebugInfo && this.mc.gameSettings.showLagometer && !pre(FPS_GRAPH, mStack)) { - this.debugOverlay.render(); - post(FPS_GRAPH); + this.debugOverlay.render(mStack); + post(FPS_GRAPH, mStack); } } - protected void renderRecordOverlay(int width, int height, float partialTicks) + protected void renderRecordOverlay(int width, int height, float partialTicks, MatrixStack mStack) { if (overlayMessageTime > 0) { @@ -685,8 +683,8 @@ public class ForgeIngameGui extends IngameGui RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); int color = (animateOverlayMessageColor ? MathHelper.hsvToRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE); - renderTextBackground(fontrenderer, -4, fontrenderer.getStringWidth(overlayMessage)); - fontrenderer.drawString(overlayMessage, -fontrenderer.getStringWidth(overlayMessage) / 2, -4, color | (opacity << 24)); + func_238448_a_(mStack, fontrenderer, -4, fontrenderer.func_238414_a_(overlayMessage), 16777215 | (opacity << 24)); + fontrenderer.func_238422_b_(mStack, overlayMessage, -fontrenderer.func_238414_a_(overlayMessage) / 2, -4, color | (opacity << 24)); RenderSystem.disableBlend(); RenderSystem.popMatrix(); } @@ -695,7 +693,7 @@ public class ForgeIngameGui extends IngameGui } } - protected void renderTitle(int width, int height, float partialTicks) + protected void renderTitle(int width, int height, float partialTicks, MatrixStack mStack) { if (titlesTimer > 0) { @@ -721,11 +719,11 @@ public class ForgeIngameGui extends IngameGui RenderSystem.pushMatrix(); RenderSystem.scalef(4.0F, 4.0F, 4.0F); int l = opacity << 24 & -16777216; - this.getFontRenderer().drawStringWithShadow(this.displayedTitle, (float)(-this.getFontRenderer().getStringWidth(this.displayedTitle) / 2), -10.0F, 16777215 | l); + this.getFontRenderer().func_238407_a_(mStack, this.displayedTitle, (float)(-this.getFontRenderer().func_238414_a_(this.displayedTitle) / 2), -10.0F, 16777215 | l); RenderSystem.popMatrix(); RenderSystem.pushMatrix(); RenderSystem.scalef(2.0F, 2.0F, 2.0F); - this.getFontRenderer().drawStringWithShadow(this.displayedSubTitle, (float)(-this.getFontRenderer().getStringWidth(this.displayedSubTitle) / 2), 5.0F, 16777215 | l); + this.getFontRenderer().func_238407_a_(mStack, this.displayedSubTitle, (float)(-this.getFontRenderer().func_238414_a_(this.displayedSubTitle) / 2), 5.0F, 16777215 | l); RenderSystem.popMatrix(); RenderSystem.disableBlend(); RenderSystem.popMatrix(); @@ -735,24 +733,24 @@ public class ForgeIngameGui extends IngameGui } } - protected void renderChat(int width, int height) + protected void renderChat(int width, int height, MatrixStack mStack) { mc.getProfiler().startSection("chat"); - RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48); + RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(mStack, eventParent, 0, height - 48); if (MinecraftForge.EVENT_BUS.post(event)) return; RenderSystem.pushMatrix(); RenderSystem.translatef((float) event.getPosX(), (float) event.getPosY(), 0.0F); - persistantChatGUI.render(ticks); + persistantChatGUI.func_238492_a_(mStack, ticks); RenderSystem.popMatrix(); - post(CHAT); + post(CHAT, mStack); mc.getProfiler().endSection(); } - protected void renderPlayerList(int width, int height) + protected void renderPlayerList(int width, int height, MatrixStack mStack) { ScoreObjective scoreobjective = this.mc.world.getScoreboard().getObjectiveInDisplaySlot(0); ClientPlayNetHandler handler = mc.player.connection; @@ -760,9 +758,9 @@ public class ForgeIngameGui extends IngameGui if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null)) { this.overlayPlayerList.setVisible(true); - if (pre(PLAYER_LIST)) return; - this.overlayPlayerList.render(width, this.mc.world.getScoreboard(), scoreobjective); - post(PLAYER_LIST); + if (pre(PLAYER_LIST, mStack)) return; + this.overlayPlayerList.func_238523_a_(mStack, width, this.mc.world.getScoreboard(), scoreobjective); + post(PLAYER_LIST, mStack); } else { @@ -770,15 +768,15 @@ public class ForgeIngameGui extends IngameGui } } - protected void renderHealthMount(int width, int height) + protected void renderHealthMount(int width, int height, MatrixStack mStack) { PlayerEntity player = (PlayerEntity)mc.getRenderViewEntity(); Entity tmp = player.getRidingEntity(); if (!(tmp instanceof LivingEntity)) return; - bind(GUI_ICONS_LOCATION); + bind(field_230665_h_); - if (pre(HEALTHMOUNT)) return; + if (pre(HEALTHMOUNT, mStack)) return; boolean unused = false; int left_align = width / 2 + 91; @@ -807,28 +805,28 @@ public class ForgeIngameGui extends IngameGui for (int i = 0; i < rowCount; ++i) { int x = left_align - i * 8 - 9; - blit(x, top, BACKGROUND, 9, 9, 9); + func_238474_b_(mStack, x, top, BACKGROUND, 9, 9, 9); if (i * 2 + 1 + heart < health) - blit(x, top, FULL, 9, 9, 9); + func_238474_b_(mStack, x, top, FULL, 9, 9, 9); else if (i * 2 + 1 + heart == health) - blit(x, top, HALF, 9, 9, 9); + func_238474_b_(mStack, x, top, HALF, 9, 9, 9); } right_height += 10; } RenderSystem.disableBlend(); - post(HEALTHMOUNT); + post(HEALTHMOUNT, mStack); } //Helper macros - private boolean pre(ElementType type) + private boolean pre(ElementType type, MatrixStack mStack) { - return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(eventParent, type)); + return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(mStack, eventParent, type)); } - private void post(ElementType type) + private void post(ElementType type, MatrixStack mStack) { - MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(eventParent, type)); + MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(mStack, eventParent, type)); } private void bind(ResourceLocation res) { @@ -849,8 +847,8 @@ public class ForgeIngameGui extends IngameGui this.rayTraceBlock = entity.pick(rayTraceDistance, 0.0F, false); this.rayTraceFluid = entity.pick(rayTraceDistance, 0.0F, true); } - @Override protected void renderDebugInfoLeft(){} - @Override protected void renderDebugInfoRight(){} + @Override protected void renderDebugInfoLeft(MatrixStack mStack){} + @Override protected void renderDebugInfoRight(MatrixStack mStack){} private List getLeft() { List ret = this.getDebugInfoLeft(); diff --git a/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java b/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java index cb6321439..f48e9cf3b 100644 --- a/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java @@ -19,6 +19,7 @@ package net.minecraftforge.client.gui; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; @@ -51,7 +52,7 @@ public class NotificationModUpdateScreen extends Screen } @Override - public void init() + public void func_231160_c_() { if (!hasCheckedForUpdates) { @@ -64,7 +65,7 @@ public class NotificationModUpdateScreen extends Screen } @Override - public void render(int mouseX, int mouseY, float partialTicks) + public void func_230430_a_(MatrixStack mStack, int mouseX, int mouseY, float partialTicks) { if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.runVersionCheck()) { @@ -73,22 +74,20 @@ public class NotificationModUpdateScreen extends Screen Minecraft.getInstance().getTextureManager().bindTexture(VERSION_CHECK_ICONS); RenderSystem.color4f(1, 1, 1, 1); - RenderSystem.pushMatrix(); - int x = modButton.x; - int y = modButton.y; - int w = modButton.getWidth(); + int x = modButton.field_230690_l_; + int y = modButton.field_230691_m_; + int w = modButton.func_230998_h_(); int h = modButton.getHeight(); - blit(x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16); - RenderSystem.popMatrix(); + func_238463_a_(mStack, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16); } public static NotificationModUpdateScreen init(MainMenuScreen guiMainMenu, Button modButton) { NotificationModUpdateScreen notificationModUpdateScreen = new NotificationModUpdateScreen(modButton); - notificationModUpdateScreen.init(guiMainMenu.getMinecraft(), guiMainMenu.width, guiMainMenu.height); - notificationModUpdateScreen.init(); + notificationModUpdateScreen.func_231152_a_(guiMainMenu.getMinecraft(), guiMainMenu.field_230708_k_, guiMainMenu.field_230709_l_); + notificationModUpdateScreen.func_231160_c_(); return notificationModUpdateScreen; } diff --git a/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java b/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java index 33869e69e..a3ffd6db0 100644 --- a/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java +++ b/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java @@ -24,6 +24,7 @@ import java.util.List; import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; @@ -75,7 +76,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable * @param mouseY * @param mouseX */ - protected abstract void drawPanel(int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY); + protected abstract void drawPanel(MatrixStack mStack, int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY); protected boolean clickPanel(double mouseX, double mouseY, int button) { return false; } @@ -105,7 +106,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double scroll) + public boolean func_231043_a_(double mouseX, double mouseY, double scroll) { if (scroll != 0) { @@ -122,15 +123,15 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable } @Override - public boolean isMouseOver(double mouseX, double mouseY) + public boolean func_231047_b_(double mouseX, double mouseY) { return mouseX >= this.left && mouseX <= this.left + this.width && mouseY >= this.top && mouseY <= this.bottom; } @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (super.mouseClicked(mouseX, mouseY, button)) + public boolean func_231044_a_(double mouseX, double mouseY, int button) { + if (super.func_231044_a_(mouseX, mouseY, button)) return true; this.scrolling = button == 0 && mouseX >= barLeft && mouseX < barLeft + barWidth; @@ -147,8 +148,8 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable } @Override - public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) { - if (super.mouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_)) + public boolean func_231048_c_(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) { + if (super.func_231048_c_(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_)) return true; boolean ret = this.scrolling; this.scrolling = false; @@ -168,7 +169,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable } @Override - public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) + public boolean func_231045_a_(double mouseX, double mouseY, int button, double deltaX, double deltaY) { if (this.scrolling) { @@ -182,7 +183,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable } @Override - public void render(int mouseX, int mouseY, float partialTicks) + public void func_230430_a_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks) { this.drawBackground(); @@ -196,13 +197,13 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable if (this.client.world != null) { - this.drawGradientRect(this.left, this.top, this.right, this.bottom, 0xC0101010, 0xD0101010); + this.drawGradientRect(matrix, this.left, this.top, this.right, this.bottom, 0xC0101010, 0xD0101010); } else // Draw dark dirt background { RenderSystem.disableLighting(); RenderSystem.disableFog(); - this.client.getTextureManager().bindTexture(AbstractGui.BACKGROUND_LOCATION); + this.client.getTextureManager().bindTexture(AbstractGui.field_230663_f_); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); final float texScale = 32.0F; worldr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); @@ -214,7 +215,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable } int baseY = this.top + border - (int)this.scrollDistance; - this.drawPanel(right, baseY, tess, mouseX, mouseY); + this.drawPanel(matrix, right, baseY, tess, mouseX, mouseY); RenderSystem.disableDepthTest(); @@ -257,13 +258,13 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable GL11.glDisable(GL11.GL_SCISSOR_TEST); } - protected void drawGradientRect(int left, int top, int right, int bottom, int color1, int color2) + protected void drawGradientRect(MatrixStack mStack, int left, int top, int right, int bottom, int color1, int color2) { - GuiUtils.drawGradientRect(0, left, top, right, bottom, color1, color2); + GuiUtils.drawGradientRect(mStack.getLast().getMatrix(), 0, left, top, right, bottom, color1, color2); } @Override - public List children() + public List func_231039_at__() { return Collections.emptyList(); } diff --git a/src/main/java/net/minecraftforge/client/model/BakedItemModel.java b/src/main/java/net/minecraftforge/client/model/BakedItemModel.java index 0b88c6c9e..f0f62badc 100644 --- a/src/main/java/net/minecraftforge/client/model/BakedItemModel.java +++ b/src/main/java/net/minecraftforge/client/model/BakedItemModel.java @@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; diff --git a/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java b/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java index 9a574eadf..1d43899f9 100644 --- a/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java +++ b/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java @@ -33,7 +33,7 @@ import net.minecraft.client.renderer.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; import net.minecraftforge.client.model.data.IModelData; public abstract class BakedModelWrapper implements IBakedModel @@ -126,7 +126,7 @@ public abstract class BakedModelWrapper implements IBaked @Nonnull @Override - public IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) + public IModelData getModelData(@Nonnull IBlockDisplayReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) { return originalModel.getModelData(world, pos, state, tileData); } diff --git a/src/main/java/net/minecraftforge/client/model/BlockModelConfiguration.java b/src/main/java/net/minecraftforge/client/model/BlockModelConfiguration.java index 4b13d5ac1..dcff4f5e3 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockModelConfiguration.java +++ b/src/main/java/net/minecraftforge/client/model/BlockModelConfiguration.java @@ -99,7 +99,7 @@ public class BlockModelConfiguration implements IModelConfiguration } @Override - public Material resolveTexture(String name) + public RenderMaterial resolveTexture(String name) { return owner.resolveTextureName(name); } @@ -144,14 +144,14 @@ public class BlockModelConfiguration implements IModelConfiguration this.visibilityData.copyFrom(other.visibilityData); } - public Collection getTextureDependencies(Function modelGetter, Set> missingTextureErrors) + public Collection getTextureDependencies(Function modelGetter, Set> missingTextureErrors) { IModelGeometry geometry = getCustomGeometry(); return geometry == null ? Collections.emptySet() : geometry.getTextures(this, modelGetter, missingTextureErrors); } - public IBakedModel bake(ModelBakery bakery, Function bakedTextureGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) + public IBakedModel bake(ModelBakery bakery, Function bakedTextureGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) { IModelGeometry geometry = getCustomGeometry(); if (geometry == null) diff --git a/src/main/java/net/minecraftforge/client/model/CompositeModel.java b/src/main/java/net/minecraftforge/client/model/CompositeModel.java index 5a9836066..e25ddc5cb 100644 --- a/src/main/java/net/minecraftforge/client/model/CompositeModel.java +++ b/src/main/java/net/minecraftforge/client/model/CompositeModel.java @@ -175,19 +175,19 @@ public class CompositeModel implements IDynamicBakedModel } @Override - public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) + public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) { throw new UnsupportedOperationException("Attempted to call adQuads on a Submodel instance. Please don't."); } - public IBakedModel bakeModel(ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) + public IBakedModel bakeModel(ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) { return model.bakeModel(bakery, spriteGetter, new ModelTransformComposition(this.modelTransform, modelTransform, this.modelTransform.isUvLock() || modelTransform.isUvLock()), modelLocation); } @Override - public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { return model.getTextures(modelGetter, missingTextureErrors); } @@ -215,9 +215,9 @@ public class CompositeModel implements IDynamicBakedModel } @Override - public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) + public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) { - Material particleLocation = owner.resolveTexture("particle"); + RenderMaterial particleLocation = owner.resolveTexture("particle"); TextureAtlasSprite particle = spriteGetter.apply(particleLocation); ImmutableMap.Builder bakedParts = ImmutableMap.builder(); @@ -232,9 +232,9 @@ public class CompositeModel implements IDynamicBakedModel } @Override - public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { - Set textures = new HashSet<>(); + Set textures = new HashSet<>(); for(Submodel part : parts.values()) { textures.addAll(part.getTextures(owner, modelGetter, missingTextureErrors)); diff --git a/src/main/java/net/minecraftforge/client/model/DynamicBucketModel.java b/src/main/java/net/minecraftforge/client/model/DynamicBucketModel.java index 4bf63a5a2..c9424574c 100644 --- a/src/main/java/net/minecraftforge/client/model/DynamicBucketModel.java +++ b/src/main/java/net/minecraftforge/client/model/DynamicBucketModel.java @@ -26,8 +26,9 @@ import com.google.common.collect.Sets; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.mojang.datafixers.util.Pair; -import net.minecraft.client.renderer.Quaternion; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.util.math.vector.Quaternion; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.MissingTextureSprite; @@ -94,27 +95,27 @@ public final class DynamicBucketModel implements IModelGeometry spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) + public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) { - Material particleLocation = owner.resolveTexture("particle"); + RenderMaterial particleLocation = owner.resolveTexture("particle"); if (MissingTextureSprite.getLocation().equals(particleLocation.getTextureLocation())) { particleLocation = null; } - Material baseLocation = owner.resolveTexture("base"); + RenderMaterial baseLocation = owner.resolveTexture("base"); if (MissingTextureSprite.getLocation().equals(baseLocation.getTextureLocation())) { baseLocation = null; } - Material fluidMaskLocation = owner.resolveTexture("fluid"); + RenderMaterial fluidMaskLocation = owner.resolveTexture("fluid"); if (MissingTextureSprite.getLocation().equals(fluidMaskLocation.getTextureLocation())) { fluidMaskLocation = null; } - Material coverLocation = owner.resolveTexture("cover"); + RenderMaterial coverLocation = owner.resolveTexture("cover"); if (!MissingTextureSprite.getLocation().equals(coverLocation.getTextureLocation())) { // cover (the actual item around the other two) @@ -188,9 +189,9 @@ public final class DynamicBucketModel implements IModelGeometry getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { - Set texs = Sets.newHashSet(); + Set texs = Sets.newHashSet(); texs.add(owner.resolveTexture("particle")); texs.add(owner.resolveTexture("base")); @@ -265,7 +266,7 @@ public final class DynamicBucketModel implements IModelGeometry { diff --git a/src/main/java/net/minecraftforge/client/model/FancyMissingModel.java b/src/main/java/net/minecraftforge/client/model/FancyMissingModel.java deleted file mode 100644 index de461871b..000000000 --- a/src/main/java/net/minecraftforge/client/model/FancyMissingModel.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.client.model; - -import java.util.function.Function; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.mojang.blaze3d.matrix.MatrixStack; -import net.minecraft.block.BlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.Matrix4f; -import net.minecraft.client.renderer.Quaternion; -import net.minecraft.client.renderer.TransformationMatrix; -import net.minecraft.client.renderer.Vector3f; -import net.minecraft.client.renderer.model.*; -import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Util; -import net.minecraftforge.common.ForgeConfig; -import net.minecraftforge.common.model.TransformationHelper; - -import javax.annotation.Nullable; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Random; -import java.util.Set; - -final class FancyMissingModel implements IUnbakedModel -{ - private static final ResourceLocation font = new ResourceLocation("minecraft", "textures/font/ascii.png"); - private static final Material font2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft", "font/ascii")); - private static final TransformationMatrix smallTransformation = new TransformationMatrix(null, null, new Vector3f(.25f, .25f, .25f), null) - .blockCenterToCorner(); - private static final SimpleModelFontRenderer fontRenderer = Util.make(() -> { - float [] mv = new float[16]; - mv[2*4+0] = 1f / 128f; - mv[0*4+1] =mv[1*4+2] = -mv[2*4+0]; - mv[3*4+3] = 1; - mv[0*4+3] = 1; - mv[0*4+3] = 1 + 1f / 0x100; - mv[0*4+3] = 0; - Matrix4f m = new Matrix4f(mv); - return new SimpleModelFontRenderer( - Minecraft.getInstance().gameSettings, - font, - Minecraft.getInstance().getTextureManager(), - false, - m - ) {/* TODO Implement once SimpleModelFontRenderer is fixed - @Override - protected float renderUnicodeChar(char c, boolean italic) - { - return super.renderDefaultChar(126, italic); - } - */}; - }); - - private final IUnbakedModel missingModel; - private final String message; - - public FancyMissingModel(IUnbakedModel missingModel, String message) - { - this.missingModel = missingModel; - this.message = message; - } - - @Override - public Collection getTextures(Function modelGetter, Set> missingTextureErrors) - { - return ImmutableList.of(font2); - } - - @Override - public Collection getDependencies() - { - return Collections.emptyList(); - } - - @Nullable - @Override - public IBakedModel bakeModel(ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) - { - IBakedModel bigMissing = missingModel.bakeModel(bakery, spriteGetter, modelTransform, modelLocation); - ModelTransformComposition smallState = new ModelTransformComposition(modelTransform, new SimpleModelTransform(smallTransformation)); - IBakedModel smallMissing = missingModel.bakeModel(bakery, spriteGetter, smallState, modelLocation); - return new BakedModel(bigMissing, smallMissing, fontRenderer, message, spriteGetter.apply(font2)); - } - - static final class BakedModel implements IBakedModel - { - private final SimpleModelFontRenderer fontRenderer; - private final String message; - private final TextureAtlasSprite fontTexture; - private final IBakedModel missingModel; - private final IBakedModel otherModel; - private final boolean big; - private ImmutableList quads; - - public BakedModel(IBakedModel bigMissing, IBakedModel smallMissing, SimpleModelFontRenderer fontRenderer, String message, TextureAtlasSprite fontTexture) - { - this.missingModel = bigMissing; - otherModel = new BakedModel(smallMissing, fontRenderer, message, fontTexture, this); - this.big = true; - this.fontRenderer = fontRenderer; - this.message = message; - this.fontTexture = fontTexture; - } - - public BakedModel(IBakedModel smallMissing, SimpleModelFontRenderer fontRenderer, String message, TextureAtlasSprite fontTexture, BakedModel big) - { - this.missingModel = smallMissing; - otherModel = big; - this.big = false; - this.fontRenderer = fontRenderer; - this.message = message; - this.fontTexture = fontTexture; - } - - @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) - { - if (side == null) - { - if (quads == null) - { - fontRenderer.setSprite(fontTexture); - fontRenderer.setFillBlanks(true); - String[] lines = message.split("\\r?\\n"); - List splitLines = Lists.newArrayList(); - for (int y = 0; y < lines.length; y++) - { - splitLines.addAll(fontRenderer.listFormattedStringToWidth(lines[y], 0x80)); - } - for (int y = 0; y < splitLines.size(); y++) - { - fontRenderer.drawString(splitLines.get(y), 0, ((y - splitLines.size() / 2f) * fontRenderer.FONT_HEIGHT) + 0x40, 0xFF00FFFF); - } - ImmutableList.Builder builder = ImmutableList.builder(); - builder.addAll(missingModel.getQuads (state, side, rand)); - builder.addAll(fontRenderer.build()); - quads = builder.build(); - } - return quads; - } - return missingModel.getQuads (state, side, rand); - } - - @Override - public boolean isAmbientOcclusion() { return true; } - - @Override - public boolean isGui3d() { return false; } - - @Override - public boolean func_230044_c_() { return false; } - - @Override - public boolean isBuiltInRenderer() { return false; } - - @Override - public TextureAtlasSprite getParticleTexture() { return fontTexture; } - - @Override - public ItemOverrideList getOverrides() { return ItemOverrideList.EMPTY; } - - @Override - public boolean doesHandlePerspectives() - { - return true; - } - - @Override - public IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat) - { - TransformationMatrix transform = TransformationMatrix.identity(); - boolean big = true; - switch (cameraTransformType) - { - - case THIRD_PERSON_LEFT_HAND: - break; - case THIRD_PERSON_RIGHT_HAND: - break; - case FIRST_PERSON_LEFT_HAND: - transform = new TransformationMatrix(new Vector3f(-0.62f, 0.5f, -.5f), new Quaternion(1, -1, -1, 1), null, null); - big = false; - break; - case FIRST_PERSON_RIGHT_HAND: - transform = new TransformationMatrix(new Vector3f(-0.5f, 0.5f, -.5f), new Quaternion(1, 1, 1, 1), null, null); - big = false; - break; - case HEAD: - break; - case GUI: - if (ForgeConfig.CLIENT.zoomInMissingModelTextInGui.get()) - { - transform = new TransformationMatrix(null, new Quaternion(1, 1, 1, 1), new Vector3f(4, 4, 4), null); - big = false; - } - else - { - transform = new TransformationMatrix(null, new Quaternion(1, 1, 1, 1), null, null); - big = true; - } - break; - case FIXED: - transform = new TransformationMatrix(null, new Quaternion(-1, -1, 1, 1), null, null); - break; - default: - break; - } - mat.getLast().getMatrix().mul(transform.getMatrix()); - if (big != this.big) - { - return otherModel; - } - return this; - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/FluidModel.java b/src/main/java/net/minecraftforge/client/model/FluidModel.java index 30c2212d3..ac52cd672 100644 --- a/src/main/java/net/minecraftforge/client/model/FluidModel.java +++ b/src/main/java/net/minecraftforge/client/model/FluidModel.java @@ -32,7 +32,7 @@ import javax.annotation.Nullable; import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -73,13 +73,13 @@ public final class FluidModel implements IModelGeometry } @Override - public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { return ForgeHooksClient.getFluidMaterials(fluid).collect(Collectors.toList()); } @Override - public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) + public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) { FluidAttributes attrs = fluid.getAttributes(); return new CachingBakedFluid( diff --git a/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java b/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java index b70435504..b9025a2e9 100644 --- a/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java +++ b/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java @@ -22,7 +22,7 @@ package net.minecraftforge.client.model; import net.minecraft.client.renderer.model.IModelTransform; import net.minecraft.client.renderer.model.IUnbakedModel; import net.minecraft.client.renderer.model.ItemCameraTransforms; -import net.minecraft.client.renderer.model.Material; +import net.minecraft.client.renderer.model.RenderMaterial; import net.minecraftforge.client.model.geometry.IModelGeometryPart; import javax.annotation.Nullable; @@ -55,7 +55,7 @@ public interface IModelConfiguration { * @param name The name of a texture channel. * @return The location of the texture, or the missing texture if not found. */ - Material resolveTexture(String name); + RenderMaterial resolveTexture(String name); /** * @return True if the item uses 3D lighting. diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 4e871a002..755bac183 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -28,7 +28,7 @@ import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.mojang.datafixers.util.Pair; import it.unimi.dsi.fastutil.ints.IntSet; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -38,7 +38,6 @@ import net.minecraft.resources.IResourceManager; import net.minecraft.util.Direction; import net.minecraft.util.JSONUtils; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.Vec2f; import net.minecraftforge.client.model.geometry.IModelGeometry; import net.minecraftforge.client.model.pipeline.BakedQuadBuilder; import net.minecraftforge.client.model.pipeline.IVertexConsumer; @@ -64,7 +63,7 @@ public final class ItemLayerModel implements IModelGeometry private static final Direction[] HORIZONTALS = {Direction.UP, Direction.DOWN}; private static final Direction[] VERTICALS = {Direction.WEST, Direction.EAST}; - private ImmutableList textures; + private ImmutableList textures; private final ImmutableSet fullbrightLayers; public ItemLayerModel() @@ -72,20 +71,20 @@ public final class ItemLayerModel implements IModelGeometry this(null, ImmutableSet.of()); } - public ItemLayerModel(ImmutableList textures) + public ItemLayerModel(ImmutableList textures) { this(textures, ImmutableSet.of()); } - public ItemLayerModel(@Nullable ImmutableList textures, ImmutableSet fullbrightLayers) + public ItemLayerModel(@Nullable ImmutableList textures, ImmutableSet fullbrightLayers) { this.textures = textures; this.fullbrightLayers = fullbrightLayers; } - private static ImmutableList getTextures(IModelConfiguration model) + private static ImmutableList getTextures(IModelConfiguration model) { - ImmutableList.Builder builder = ImmutableList.builder(); + ImmutableList.Builder builder = ImmutableList.builder(); for(int i = 0; model.isTexturePresent("layer" + i); i++) { builder.add(model.resolveTexture("layer" + i)); @@ -94,7 +93,7 @@ public final class ItemLayerModel implements IModelGeometry } @Override - public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) + public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) { //TODO: Verify TransformationMatrix transform = modelTransform.getRotation(); @@ -106,12 +105,12 @@ public final class ItemLayerModel implements IModelGeometry return new BakedItemModel(quads, particle, map, overrides, transform.isIdentity(), owner.isSideLit()); } - public static ImmutableList getQuadsForSprites(List textures, TransformationMatrix transform, Function spriteGetter) + public static ImmutableList getQuadsForSprites(List textures, TransformationMatrix transform, Function spriteGetter) { return getQuadsForSprites(textures, transform, spriteGetter, Collections.emptySet()); } - public static ImmutableList getQuadsForSprites(List textures, TransformationMatrix transform, Function spriteGetter, Set fullbrights) + public static ImmutableList getQuadsForSprites(List textures, TransformationMatrix transform, Function spriteGetter, Set fullbrights) { ImmutableList.Builder builder = ImmutableList.builder(); for(int i = 0; i < textures.size(); i++) @@ -303,7 +302,7 @@ public final class ItemLayerModel implements IModelGeometry } @Override - public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { textures = getTextures(owner); return textures; diff --git a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java index 6bd20db23..774549870 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java +++ b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java @@ -21,7 +21,7 @@ package net.minecraftforge.client.model; import com.google.common.collect.Lists; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 13a965366..56cf4395d 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -162,7 +162,7 @@ public final class ModelLoader extends ModelBakery { if (instance == null) { - instance = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, LOCATION).getSprite(); + instance = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, LOCATION).getSprite(); } return instance; } @@ -262,9 +262,9 @@ public final class ModelLoader extends ModelBakery /** * Get the default texture getter the models will be baked with. */ - public static Function defaultTextureGetter() + public static Function defaultTextureGetter() { - return Material::getSprite; + return RenderMaterial::getSprite; } public static Function defaultModelGetter() diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 90f9dbdb2..264fd312c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -26,7 +26,6 @@ import com.google.common.collect.Sets; import com.google.gson.*; import com.mojang.datafixers.util.Pair; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.texture.MissingTextureSprite; @@ -36,6 +35,7 @@ import net.minecraft.resources.IResourceManager; import net.minecraft.util.Direction; import net.minecraft.util.JSONUtils; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraftforge.client.model.geometry.IModelGeometry; import net.minecraftforge.client.model.geometry.ISimpleModelGeometry; import net.minecraftforge.client.model.obj.OBJLoader; @@ -141,7 +141,7 @@ public class ModelLoaderRegistry private static final Pattern FILESYSTEM_PATH_TO_RESLOC = Pattern.compile("(?:.*[\\\\/]assets[\\\\/](?[a-z_-]+)[\\\\/]textures[\\\\/])?(?[a-z_\\\\/-]+)\\.png"); - public static Material resolveTexture(@Nullable String tex, IModelConfiguration owner) + public static RenderMaterial resolveTexture(@Nullable String tex, IModelConfiguration owner) { if (tex == null) return blockMaterial(WHITE_TEXTURE); @@ -163,14 +163,14 @@ public class ModelLoaderRegistry return blockMaterial(tex); } - public static Material blockMaterial(String location) + public static RenderMaterial blockMaterial(String location) { - return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(location)); + return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(location)); } - public static Material blockMaterial(ResourceLocation location) + public static RenderMaterial blockMaterial(ResourceLocation location) { - return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, location); + return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, location); } @Nullable @@ -244,7 +244,7 @@ public class ModelLoaderRegistry } } - public static IBakedModel bakeHelper(BlockModel blockModel, ModelBakery modelBakery, BlockModel otherModel, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation, boolean guiLight3d) + public static IBakedModel bakeHelper(BlockModel blockModel, ModelBakery modelBakery, BlockModel otherModel, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation, boolean guiLight3d) { IBakedModel model; IModelGeometry customModel = blockModel.customData.getCustomGeometry(); @@ -273,7 +273,7 @@ public class ModelLoaderRegistry } @Override - public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) + public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) { for(BlockPart blockpart : elements) { for(Direction direction : blockpart.mapFaces.keySet()) { @@ -291,13 +291,13 @@ public class ModelLoaderRegistry } @Override - public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { - Set textures = Sets.newHashSet(); + Set textures = Sets.newHashSet(); for(BlockPart part : elements) { for(BlockPartFace face : part.mapFaces.values()) { - Material texture = owner.resolveTexture(face.texture); + RenderMaterial texture = owner.resolveTexture(face.texture); if (Objects.equals(texture, MissingTextureSprite.getLocation().toString())) { missingTextureErrors.add(Pair.of(face.texture, owner.getModelName())); } diff --git a/src/main/java/net/minecraftforge/client/model/ModelTransformComposition.java b/src/main/java/net/minecraftforge/client/model/ModelTransformComposition.java index 8176e7435..5c0e5d334 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelTransformComposition.java +++ b/src/main/java/net/minecraftforge/client/model/ModelTransformComposition.java @@ -20,7 +20,7 @@ package net.minecraftforge.client.model; import com.google.common.base.Objects; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraft.client.renderer.model.IModelTransform; /** diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index 578302ebd..753f99ed6 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -31,7 +31,7 @@ import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.datafixers.util.Pair; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -67,16 +67,16 @@ public final class MultiLayerModel implements IModelGeometry } @Override - public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { - Set materials = Sets.newHashSet(); + Set materials = Sets.newHashSet(); materials.add(owner.resolveTexture("particle")); for (IUnbakedModel m : models.values()) materials.addAll(m.getTextures(modelGetter, missingTextureErrors)); return materials; } - private static ImmutableMap buildModels(ImmutableMap models, IModelTransform modelTransform, ModelBakery bakery, Function spriteGetter, ResourceLocation modelLocation) + private static ImmutableMap buildModels(ImmutableMap models, IModelTransform modelTransform, ModelBakery bakery, Function spriteGetter, ResourceLocation modelLocation) { ImmutableMap.Builder builder = ImmutableMap.builder(); for(Map.Entry entry : models.entrySet()) @@ -87,7 +87,7 @@ public final class MultiLayerModel implements IModelGeometry } @Override - public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) + public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) { IUnbakedModel missing = ModelLoader.instance().getMissingModel(); diff --git a/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java b/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java index eb443b906..31ed34a26 100644 --- a/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java +++ b/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java @@ -26,12 +26,13 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraft.world.World; import net.minecraftforge.client.model.data.IDynamicBakedModel; import net.minecraftforge.client.model.data.IModelData; @@ -164,9 +165,9 @@ public class PerspectiveMapWrapper implements IDynamicBakedModel @Nullable @Override - public IBakedModel getModelWithOverrides(IBakedModel model, ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn) + public IBakedModel func_239290_a_(IBakedModel model, ItemStack stack, @Nullable ClientWorld worldIn, @Nullable LivingEntity entityIn) { - model = parent.getOverrides().getModelWithOverrides(parent, stack, worldIn, entityIn); + model = parent.getOverrides().func_239290_a_(parent, stack, worldIn, entityIn); return new PerspectiveMapWrapper(model, transforms); } diff --git a/src/main/java/net/minecraftforge/client/model/QuadTransformer.java b/src/main/java/net/minecraftforge/client/model/QuadTransformer.java index 7372375f4..adb6db5b3 100644 --- a/src/main/java/net/minecraftforge/client/model/QuadTransformer.java +++ b/src/main/java/net/minecraftforge/client/model/QuadTransformer.java @@ -25,9 +25,9 @@ import java.util.List; import com.google.common.collect.Lists; -import net.minecraft.client.renderer.TransformationMatrix; -import net.minecraft.client.renderer.Vector3f; -import net.minecraft.client.renderer.Vector4f; +import net.minecraft.util.math.vector.TransformationMatrix; +import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.util.math.vector.Vector4f; import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; @@ -176,7 +176,7 @@ public class QuadTransformer int[] outData = Arrays.copyOf(inData, inData.length); processVertices(inData, outData); - return new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.shouldApplyDiffuseLighting()); + return new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.func_239287_f_()); } /** @@ -208,7 +208,7 @@ public class QuadTransformer int[] outData = Arrays.copyOf(inData, inData.length); processVertices(inData, outData); - outputs.add(new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.shouldApplyDiffuseLighting())); + outputs.add(new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.func_239287_f_())); } return outputs; } diff --git a/src/main/java/net/minecraftforge/client/model/SimpleModelFontRenderer.java b/src/main/java/net/minecraftforge/client/model/SimpleModelFontRenderer.java deleted file mode 100644 index d07e83bf0..000000000 --- a/src/main/java/net/minecraftforge/client/model/SimpleModelFontRenderer.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.client.model; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.client.GameSettings; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.Matrix4f; -import net.minecraft.client.renderer.TransformationMatrix; -import net.minecraft.client.renderer.Vector3f; -import net.minecraft.client.renderer.Vector4f; -import net.minecraft.client.renderer.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.pipeline.BakedQuadBuilder; - -public abstract class SimpleModelFontRenderer extends FontRenderer { - - private float r, g, b, a; - private final TransformationMatrix transform; - private ImmutableList.Builder builder = ImmutableList.builder(); - private final Vector3f normal = new Vector3f(0, 0, 1); - private final Direction orientation; - private boolean fillBlanks = false; - - private TextureAtlasSprite sprite; - - public SimpleModelFontRenderer(GameSettings settings, ResourceLocation font, TextureManager manager, boolean isUnicode, Matrix4f matrix) - { - super(manager, null); - this.transform = new TransformationMatrix(matrix); - transform.transformNormal(normal); - orientation = Direction.getFacingFromVector(normal.getX(), normal.getY(), normal.getZ()); - } - - public void setSprite(TextureAtlasSprite sprite) - { - this.sprite = sprite; - } - - public void setFillBlanks(boolean fillBlanks) - { - this.fillBlanks = fillBlanks; - } - - private final Vector4f vec = new Vector4f(); - - private void addVertex(BakedQuadBuilder quadBuilder, float x, float y, float u, float v) - { - ImmutableList elements = quadBuilder.getVertexFormat().getElements(); - for(int e = 0; e < elements.size(); e++) - { - VertexFormatElement element = elements.get(e); - switch(element.getUsage()) - { - case POSITION: - vec.set(x, y, 0f, 1f); - transform.transformPosition(vec); - quadBuilder.put(e, vec.getX(), vec.getY(), vec.getZ(), vec.getW()); - break; - case COLOR: - quadBuilder.put(e, r, g, b, a); - break; - case NORMAL: - //quadBuilder.put(e, normal.x, normal.y, normal.z, 1); - quadBuilder.put(e, 0, 0, 1, 1); - break; - case UV: - if(element.getIndex() == 0) - { - quadBuilder.put(e, sprite.getInterpolatedU(u * 16), sprite.getInterpolatedV(v * 16), 0, 1); - break; - } - // else fallthrough to default - default: - quadBuilder.put(e); - break; - } - } - } - - public ImmutableList build() - { - ImmutableList ret = builder.build(); - builder = ImmutableList.builder(); - return ret; - } -} diff --git a/src/main/java/net/minecraftforge/client/model/SimpleModelTransform.java b/src/main/java/net/minecraftforge/client/model/SimpleModelTransform.java index 6b05b9b41..5a8586795 100644 --- a/src/main/java/net/minecraftforge/client/model/SimpleModelTransform.java +++ b/src/main/java/net/minecraftforge/client/model/SimpleModelTransform.java @@ -19,10 +19,10 @@ package net.minecraftforge.client.model; -import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.model.IModelTransform; import com.google.common.collect.ImmutableMap; +import net.minecraft.util.math.vector.TransformationMatrix; /** * Simple implementation of IModelState via a map and a default value. diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java index b9b7e0713..8e8b420a2 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java @@ -27,6 +27,7 @@ import javax.annotation.Nullable; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -43,14 +44,14 @@ public final class AnimationItemOverrideList extends ItemOverrideList private final IModelTransform state; - private final Function bakedTextureGetter; + private final Function bakedTextureGetter; - public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function bakedTextureGetter, ItemOverrideList overrides) + public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function bakedTextureGetter, ItemOverrideList overrides) { this(bakery, model, modelLoc, state, bakedTextureGetter, overrides.getOverrides().reverse()); } - public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function bakedTextureGetter, List overrides) + public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function bakedTextureGetter, List overrides) { super(bakery, model, ModelLoader.defaultModelGetter(), bakedTextureGetter, overrides); this.bakery = bakery; @@ -61,7 +62,7 @@ public final class AnimationItemOverrideList extends ItemOverrideList } @Override - public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity) + public IBakedModel func_239290_a_(IBakedModel originalModel, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) { return stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null) .map(asm -> @@ -80,6 +81,6 @@ public final class AnimationItemOverrideList extends ItemOverrideList }) // TODO where should uvlock data come from? .map(state -> model.bakeModel(bakery, bakedTextureGetter, new ModelTransformComposition(state, this.state), modelLoc)) - .orElseGet(() -> super.getModelWithOverrides(originalModel, stack, world, entity)); + .orElseGet(() -> super.func_239290_a_(originalModel, stack, world, entity)); } } diff --git a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java index ae551d1cf..c2fff71f8 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java @@ -33,8 +33,11 @@ import java.util.TreeMap; import javax.annotation.Nullable; -import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.model.IModelTransform; +import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.math.vector.Quaternion; +import net.minecraft.util.math.vector.TransformationMatrix; +import net.minecraft.util.math.vector.Vector3f; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/minecraftforge/client/model/animation/TileEntityRendererAnimation.java b/src/main/java/net/minecraftforge/client/model/animation/TileEntityRendererAnimation.java index 7f8126933..49085ed5c 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/TileEntityRendererAnimation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/TileEntityRendererAnimation.java @@ -33,7 +33,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.model.ModelDataManager; import net.minecraftforge.client.model.data.IModelData; @@ -66,7 +66,7 @@ public class TileEntityRendererAnimation extends TileEntit } if(blockRenderer == null) blockRenderer = Minecraft.getInstance().getBlockRendererDispatcher(); BlockPos pos = te.getPos(); - ILightReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos); + IBlockDisplayReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos); BlockState state = world.getBlockState(pos); IBakedModel model = blockRenderer.getBlockModelShapes().getModel(state); IModelData data = model.getModelData(world, pos, state, ModelDataManager.getModelData(te.getWorld(), pos)); diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java index 8c1e474ff..cee819db4 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java @@ -19,7 +19,7 @@ package net.minecraftforge.client.model.b3d; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraftforge.client.model.b3d.B3DLoader.NodeJoint; import net.minecraftforge.client.model.b3d.B3DModel.Key; import net.minecraftforge.client.model.b3d.B3DModel.Node; diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 8a94712cb..eb979faa2 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -38,9 +38,9 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; import com.mojang.blaze3d.matrix.MatrixStack; -import net.minecraft.client.renderer.Matrix4f; -import net.minecraft.client.renderer.TransformationMatrix; -import net.minecraft.client.renderer.Vector3f; +import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.math.vector.TransformationMatrix; +import net.minecraft.util.math.vector.Vector3f; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.texture.MissingTextureSprite; @@ -446,10 +446,10 @@ public enum B3DLoader implements ISelectiveResourceReloadListener } @Override - public Collection getTextures(Function modelGetter, Set> missingTextureErrors) + public Collection getTextures(Function modelGetter, Set> missingTextureErrors) { return textures.values().stream().filter(loc -> !loc.startsWith("#")) - .map(t -> new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(t))) + .map(t -> new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(t))) .collect(Collectors.toList()); } @@ -461,10 +461,10 @@ public enum B3DLoader implements ISelectiveResourceReloadListener @Nullable @Override - public IBakedModel bakeModel(ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) + public IBakedModel bakeModel(ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) { ImmutableMap.Builder builder = ImmutableMap.builder(); - TextureAtlasSprite missing = spriteGetter.apply(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, MissingTextureSprite.getLocation())); + TextureAtlasSprite missing = spriteGetter.apply(new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, MissingTextureSprite.getLocation())); for(Map.Entry e : textures.entrySet()) { if(e.getValue().startsWith("#")) @@ -474,7 +474,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener } else { - builder.put(e.getKey(), spriteGetter.apply(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(e.getValue())))); + builder.put(e.getKey(), spriteGetter.apply(new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(e.getValue())))); } } builder.put("missingno", missing); diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java index 249299432..cb11d2673 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java @@ -39,8 +39,7 @@ import java.util.Set; import javax.annotation.Nullable; -import net.minecraft.client.renderer.*; -import net.minecraft.util.math.Vec2f; +import net.minecraft.util.math.vector.*; import net.minecraftforge.versions.forge.ForgeVersion; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.tuple.Pair; @@ -249,8 +248,8 @@ public class B3DModel String path = readString(); int flags = buf.getInt(); int blend = buf.getInt(); - Vec2f pos = new Vec2f(buf.getFloat(), buf.getFloat()); - Vec2f scale = new Vec2f(buf.getFloat(), buf.getFloat()); + Vector2f pos = new Vector2f(buf.getFloat(), buf.getFloat()); + Vector2f scale = new Vector2f(buf.getFloat(), buf.getFloat()); float rot = buf.getFloat(); ret.add(new Texture(path, flags, blend, pos, scale, rot)); } @@ -529,15 +528,15 @@ public class B3DModel public static class Texture { - public static final Texture White = new Texture("builtin/white", 0, 0, new Vec2f(0, 0), new Vec2f(1, 1), 0); + public static final Texture White = new Texture("builtin/white", 0, 0, new Vector2f(0, 0), new Vector2f(1, 1), 0); private final String path; private final int flags; private final int blend; - private final Vec2f pos; - private final Vec2f scale; + private final Vector2f pos; + private final Vector2f scale; private final float rot; - public Texture(String path, int flags, int blend, Vec2f pos, Vec2f scale, float rot) + public Texture(String path, int flags, int blend, Vector2f pos, Vector2f scale, float rot) { this.path = path; this.flags = flags; @@ -562,12 +561,12 @@ public class B3DModel return blend; } - public Vec2f getPos() + public Vector2f getPos() { return pos; } - public Vec2f getScale() + public Vector2f getScale() { return scale; } diff --git a/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java b/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java index 74995a030..2123b7684 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java @@ -47,7 +47,6 @@ import net.minecraft.block.DoorBlock; import net.minecraft.block.FenceBlock; import net.minecraft.block.FenceGateBlock; import net.minecraft.block.FourWayBlock; -import net.minecraft.block.LogBlock; import net.minecraft.block.PaneBlock; import net.minecraft.block.RotatedPillarBlock; import net.minecraft.block.SixWayBlock; @@ -194,7 +193,7 @@ public abstract class BlockStateProvider implements IDataProvider { axisBlock(block, blockTexture(block)); } - public void logBlock(LogBlock block) { + public void logBlock(RotatedPillarBlock block) { axisBlock(block, blockTexture(block), extend(blockTexture(block), "_top")); } diff --git a/src/main/java/net/minecraftforge/client/model/generators/ExistingFileHelper.java b/src/main/java/net/minecraftforge/client/model/generators/ExistingFileHelper.java index 93ca5811d..582b82f41 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ExistingFileHelper.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ExistingFileHelper.java @@ -49,8 +49,8 @@ public class ExistingFileHelper { private final boolean enable; public ExistingFileHelper(Collection existingPacks, boolean enable) { - this.clientResources = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, Thread.currentThread()); - this.serverData = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA, Thread.currentThread()); + this.clientResources = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES); + this.serverData = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA); this.clientResources.addResourcePack(new VanillaPack("minecraft", "realms")); this.serverData.addResourcePack(new VanillaPack("minecraft")); for (Path existing : existingPacks) { diff --git a/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java index b9c25ad9e..0a0b66a34 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java @@ -36,7 +36,7 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import net.minecraft.client.renderer.Vector3f; +import net.minecraft.util.math.vector.Vector3f; import net.minecraft.client.renderer.model.BlockFaceUV; import net.minecraft.client.renderer.model.BlockPart; import net.minecraft.client.renderer.model.BlockPartFace; @@ -53,11 +53,11 @@ import net.minecraft.util.math.MathHelper; /** * General purpose model builder, contains all the commonalities between item * and block models. - * + * * @see ModelProvider * @see BlockModelBuilder * @see ItemModelBuilder - * + * * @param Self type, for simpler chaining of methods. */ @SuppressWarnings("deprecation") @@ -89,7 +89,7 @@ public class ModelBuilder> extends ModelFile { /** * Set the parent model for the current model. - * + * * @param parent the parent model * @return this builder * @throws NullPointerException if {@code parent} is {@code null} @@ -104,7 +104,7 @@ public class ModelBuilder> extends ModelFile { /** * Set the texture for a given dictionary key. - * + * * @param key the texture key * @param texture the texture, can be another key e.g. {@code "#all"} * @return this builder @@ -133,7 +133,7 @@ public class ModelBuilder> extends ModelFile { /** * Set the texture for a given dictionary key. - * + * * @param key the texture key * @param texture the texture * @return this builder @@ -170,7 +170,7 @@ public class ModelBuilder> extends ModelFile { public T gui3d(boolean gui3d) { return self(); } - + public T guiLight(GuiLight light) { this.guiLight = light; return self(); @@ -184,7 +184,7 @@ public class ModelBuilder> extends ModelFile { /** * Get an existing element builder - * + * * @param index the index of the existing element builder * @return the element builder * @throws IndexOutOfBoundsException if {@code} index is out of bounds @@ -204,7 +204,7 @@ public class ModelBuilder> extends ModelFile { if (!this.ambientOcclusion) { root.addProperty("ambientocclusion", this.ambientOcclusion); } - + if (this.guiLight != null) { root.addProperty("gui_light", this.guiLight.getSerializedName()); } @@ -240,7 +240,7 @@ public class ModelBuilder> extends ModelFile { if (!this.elements.isEmpty()) { JsonArray elements = new JsonArray(); - this.elements.stream().map(ElementBuilder::build).forEach(part -> { + this.elements.stream().map(ElementBuilder::build).forEach(part -> { JsonObject partObj = new JsonObject(); partObj.add("from", serializeVector3f(part.positionFrom)); partObj.add("to", serializeVector3f(part.positionTo)); @@ -248,7 +248,7 @@ public class ModelBuilder> extends ModelFile { if (part.partRotation != null) { JsonObject rotation = new JsonObject(); rotation.add("origin", serializeVector3f(part.partRotation.origin)); - rotation.addProperty("axis", part.partRotation.axis.getName()); + rotation.addProperty("axis", part.partRotation.axis.func_176610_l()); rotation.addProperty("angle", part.partRotation.angle); if (part.partRotation.rescale) { rotation.addProperty("rescale", part.partRotation.rescale); @@ -271,7 +271,7 @@ public class ModelBuilder> extends ModelFile { faceObj.add("uv", new Gson().toJsonTree(face.blockFaceUV.uvs)); } if (face.cullFace != null) { - faceObj.addProperty("cullface", face.cullFace.getName()); + faceObj.addProperty("cullface", face.cullFace.func_176610_l()); } if (face.blockFaceUV.rotation != 0) { faceObj.addProperty("rotation", face.blockFaceUV.rotation); @@ -279,7 +279,7 @@ public class ModelBuilder> extends ModelFile { if (face.tintIndex != -1) { faceObj.addProperty("tintindex", face.tintIndex); } - faces.add(dir.getName(), faceObj); + faces.add(dir.func_176610_l(), faceObj); } if (!part.mapFaces.isEmpty()) { partObj.add("faces", faces); @@ -341,7 +341,7 @@ public class ModelBuilder> extends ModelFile { /** * Set the "from" position for this element. - * + * * @param x x-position for this vector * @param y y-position for this vector * @param z z-position for this vector @@ -358,7 +358,7 @@ public class ModelBuilder> extends ModelFile { /** * Set the "to" position for this element. - * + * * @param x x-position for this vector * @param y y-position for this vector * @param z z-position for this vector @@ -375,7 +375,7 @@ public class ModelBuilder> extends ModelFile { /** * Return or create the face builder for the given direction. - * + * * @param dir the direction * @return the face builder for the given direction * @throws NullPointerException if {@code dir} is {@code null} @@ -400,7 +400,7 @@ public class ModelBuilder> extends ModelFile { /** * Modify all possible faces dynamically using a function, creating new * faces as necessary. - * + * * @param action the function to apply to each direction * @return this builder * @throws NullPointerException if {@code action} is {@code null} @@ -413,7 +413,7 @@ public class ModelBuilder> extends ModelFile { /** * Modify all existing faces dynamically using a function. - * + * * @param action the function to apply to each direction * @return this builder * @throws NullPointerException if {@code action} is {@code null} @@ -427,7 +427,7 @@ public class ModelBuilder> extends ModelFile { /** * Texture all possible faces in the current element with the given * texture, creating new faces where necessary. - * + * * @param texture the texture * @return this builder * @throws NullPointerException if {@code texture} is {@code null} @@ -439,7 +439,7 @@ public class ModelBuilder> extends ModelFile { /** * Texture all existing faces in the current element with the given * texture. - * + * * @param texture the texture * @return this builder * @throws NullPointerException if {@code texture} is {@code null} @@ -451,7 +451,7 @@ public class ModelBuilder> extends ModelFile { /** * Create a typical cube element, creating new faces as needed, applying the * given texture, and setting the cullface. - * + * * @param texture the texture * @return this builder * @throws NullPointerException if {@code texture} is {@code null} @@ -496,7 +496,7 @@ public class ModelBuilder> extends ModelFile { /** * Set the texture for the current face. - * + * * @param texture the texture * @return this builder * @throws NullPointerException if {@code texture} is {@code null} @@ -514,7 +514,7 @@ public class ModelBuilder> extends ModelFile { /** * Set the texture rotation for the current face. - * + * * @param rot the rotation * @return this builder * @throws NullPointerException if {@code rot} is {@code null} @@ -625,7 +625,7 @@ public class ModelBuilder> extends ModelFile { /** * Begin building a new transform for the given perspective. - * + * * @param type the perspective to create or return the builder for * @return the builder for the given perspective * @throws NullPointerException if {@code type} is {@code null} diff --git a/src/main/java/net/minecraftforge/client/model/generators/MultiPartBlockStateBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/MultiPartBlockStateBuilder.java index 49d720117..5de682030 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/MultiPartBlockStateBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/MultiPartBlockStateBuilder.java @@ -32,7 +32,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import net.minecraft.block.Block; -import net.minecraft.state.IProperty; +import net.minecraft.state.Property; public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate { @@ -74,7 +74,7 @@ public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate { public class PartBuilder { public BlockStateProvider.ConfiguredModelList models; public boolean useOr; - public final Multimap, Comparable> conditions = HashMultimap.create(); + public final Multimap, Comparable> conditions = HashMultimap.create(); PartBuilder(BlockStateProvider.ConfiguredModelList models) { this.models = models; @@ -101,7 +101,7 @@ public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate { * current block's state */ @SafeVarargs - public final > PartBuilder condition(IProperty prop, T... values) { + public final > PartBuilder condition(Property prop, T... values) { Preconditions.checkNotNull(prop, "Property must not be null"); Preconditions.checkNotNull(values, "Value list must not be null"); Preconditions.checkArgument(values.length > 0, "Value list must not be empty"); @@ -117,12 +117,12 @@ public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate { JsonObject out = new JsonObject(); if (!conditions.isEmpty()) { JsonObject when = new JsonObject(); - for (Entry, Collection>> e : conditions.asMap().entrySet()) { + for (Entry, Collection>> e : conditions.asMap().entrySet()) { StringBuilder activeString = new StringBuilder(); for (Comparable val : e.getValue()) { if (activeString.length() > 0) activeString.append("|"); - activeString.append(((IProperty) e.getKey()).getName(val)); + activeString.append(((Property) e.getKey()).getName(val)); } when.addProperty(e.getKey().getName(), activeString.toString()); } diff --git a/src/main/java/net/minecraftforge/client/model/generators/VariantBlockStateBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/VariantBlockStateBuilder.java index 19992953a..2af2d188e 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/VariantBlockStateBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/VariantBlockStateBuilder.java @@ -44,7 +44,7 @@ import com.google.gson.JsonObject; import net.minecraft.block.Block; import net.minecraft.block.BlockState; -import net.minecraft.state.IProperty; +import net.minecraft.state.Property; import net.minecraftforge.client.model.generators.BlockStateProvider.ConfiguredModelList; /** @@ -60,7 +60,7 @@ import net.minecraftforge.client.model.generators.BlockStateProvider.ConfiguredM *

* This class also provides the convenience methods * {@link #forAllStates(Function)} and - * {@link #forAllStatesExcept(Function, IProperty...)} for cases where the model + * {@link #forAllStatesExcept(Function, Property...)} for cases where the model * for each variant can be decided dynamically based on the state's property * values. * @@ -160,11 +160,11 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate { return forAllStatesExcept(mapper); } - public VariantBlockStateBuilder forAllStatesExcept(Function mapper, IProperty... ignored) { + public VariantBlockStateBuilder forAllStatesExcept(Function mapper, Property... ignored) { Set seen = new HashSet<>(); for (BlockState fullState : owner.getStateContainer().getValidStates()) { - Map, Comparable> propertyValues = Maps.newLinkedHashMap(fullState.getValues()); - for (IProperty p : ignored) { + Map, Comparable> propertyValues = Maps.newLinkedHashMap(fullState.getValues()); + for (Property p : ignored) { propertyValues.remove(p); } PartialBlockstate partialState = new PartialBlockstate(owner, propertyValues, this); @@ -177,7 +177,7 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate { public static class PartialBlockstate implements Predicate { private final Block owner; - private final SortedMap, Comparable> setStates; + private final SortedMap, Comparable> setStates; @Nullable private final VariantBlockStateBuilder outerBuilder; @@ -185,22 +185,22 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate { this(owner, ImmutableMap.of(), outerBuilder); } - PartialBlockstate(Block owner, Map, Comparable> setStates, @Nullable VariantBlockStateBuilder outerBuilder) { + PartialBlockstate(Block owner, Map, Comparable> setStates, @Nullable VariantBlockStateBuilder outerBuilder) { this.owner = owner; this.outerBuilder = outerBuilder; - for (Map.Entry, Comparable> entry : setStates.entrySet()) { - IProperty prop = entry.getKey(); + for (Map.Entry, Comparable> entry : setStates.entrySet()) { + Property prop = entry.getKey(); Comparable value = entry.getValue(); Preconditions.checkArgument(owner.getStateContainer().getProperties().contains(prop), "Property %s not found on block %s", entry, this.owner); Preconditions.checkArgument(prop.getAllowedValues().contains(value), "%s is not a valid value for %s", value, prop); } - this.setStates = Maps.newTreeMap(Comparator.comparing(IProperty::getName)); + this.setStates = Maps.newTreeMap(Comparator.comparing(Property::getName)); this.setStates.putAll(setStates); } - public > PartialBlockstate with(IProperty prop, T value) { + public > PartialBlockstate with(Property prop, T value) { Preconditions.checkArgument(!setStates.containsKey(prop), "Property %s has already been set", prop); - Map, Comparable> newState = new HashMap<>(setStates); + Map, Comparable> newState = new HashMap<>(setStates); newState.put(prop, value); return new PartialBlockstate(owner, newState, outerBuilder); } @@ -281,7 +281,7 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate { return owner; } - public SortedMap, Comparable> getSetStates() { + public SortedMap, Comparable> getSetStates() { return setStates; } @@ -290,7 +290,7 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate { if (blockState.getBlock() != getOwner()) { return false; } - for (Map.Entry, Comparable> entry : setStates.entrySet()) { + for (Map.Entry, Comparable> entry : setStates.entrySet()) { if (blockState.get(entry.getKey()) != entry.getValue()) { return false; } @@ -301,13 +301,13 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate { @Override public String toString() { StringBuilder ret = new StringBuilder(); - for (Map.Entry, Comparable> entry : setStates.entrySet()) { + for (Map.Entry, Comparable> entry : setStates.entrySet()) { if (ret.length() > 0) { ret.append(','); } ret.append(entry.getKey().getName()) .append('=') - .append(((IProperty) entry.getKey()).getName(entry.getValue())); + .append(((Property) entry.getKey()).getName(entry.getValue())); } return ret.toString(); } @@ -316,10 +316,10 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate { public static Comparator comparingByProperties() { // Sort variants inversely by property values, to approximate vanilla style return (s1, s2) -> { - SortedSet> propUniverse = new TreeSet<>(s1.getSetStates().comparator().reversed()); + SortedSet> propUniverse = new TreeSet<>(s1.getSetStates().comparator().reversed()); propUniverse.addAll(s1.getSetStates().keySet()); propUniverse.addAll(s2.getSetStates().keySet()); - for (IProperty prop : propUniverse) { + for (Property prop : propUniverse) { Comparable val1 = s1.getSetStates().get(prop); Comparable val2 = s2.getSetStates().get(prop); if (val1 == null && val2 != null) { diff --git a/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometry.java b/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometry.java index 9e937b9d6..cbb4e263f 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometry.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometry.java @@ -45,7 +45,7 @@ public interface IModelGeometry> return Optional.empty(); } - IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation); + IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation); - Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors); + Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors); } diff --git a/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometryPart.java b/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometryPart.java index afb3f50dd..d2dc7a940 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometryPart.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometryPart.java @@ -22,8 +22,8 @@ package net.minecraftforge.client.model.geometry; import com.mojang.datafixers.util.Pair; import net.minecraft.client.renderer.model.IModelTransform; import net.minecraft.client.renderer.model.IUnbakedModel; -import net.minecraft.client.renderer.model.Material; import net.minecraft.client.renderer.model.ModelBakery; +import net.minecraft.client.renderer.model.RenderMaterial; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.IModelBuilder; @@ -38,9 +38,9 @@ public interface IModelGeometryPart { String name(); - void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation); + void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation); - default Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { + default Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { // No texture dependencies return Collections.emptyList(); } diff --git a/src/main/java/net/minecraftforge/client/model/geometry/IMultipartModelGeometry.java b/src/main/java/net/minecraftforge/client/model/geometry/IMultipartModelGeometry.java index c80e4db82..c9a31636a 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/IMultipartModelGeometry.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/IMultipartModelGeometry.java @@ -23,8 +23,8 @@ import com.google.common.collect.Sets; import com.mojang.datafixers.util.Pair; import net.minecraft.client.renderer.model.IModelTransform; import net.minecraft.client.renderer.model.IUnbakedModel; -import net.minecraft.client.renderer.model.Material; import net.minecraft.client.renderer.model.ModelBakery; +import net.minecraft.client.renderer.model.RenderMaterial; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.IModelBuilder; @@ -43,16 +43,16 @@ public interface IMultipartModelGeometry> e Optional getPart(String name); @Override - default void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) + default void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) { getParts().stream().filter(part -> owner.getPartVisibility(part)) .forEach(part -> part.addQuads(owner, modelBuilder, bakery, spriteGetter, modelTransform, modelLocation)); } @Override - default Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + default Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { - Set combined = Sets.newHashSet(); + Set combined = Sets.newHashSet(); for (IModelGeometryPart part : getParts()) combined.addAll(part.getTextures(owner, modelGetter, missingTextureErrors)); return combined; diff --git a/src/main/java/net/minecraftforge/client/model/geometry/ISimpleModelGeometry.java b/src/main/java/net/minecraftforge/client/model/geometry/ISimpleModelGeometry.java index 8578ce67e..65e27cdc1 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/ISimpleModelGeometry.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/ISimpleModelGeometry.java @@ -33,7 +33,7 @@ import java.util.function.Function; public interface ISimpleModelGeometry> extends IModelGeometry { @Override - default IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) + default IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) { TextureAtlasSprite particle = spriteGetter.apply(owner.resolveTexture("particle")); @@ -44,8 +44,8 @@ public interface ISimpleModelGeometry> extends return builder.build(); } - void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation); + void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation); @Override - Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors); + Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors); } diff --git a/src/main/java/net/minecraftforge/client/model/obj/MaterialLibrary.java b/src/main/java/net/minecraftforge/client/model/obj/MaterialLibrary.java index c6ff30c2c..99d3a78b5 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/MaterialLibrary.java +++ b/src/main/java/net/minecraftforge/client/model/obj/MaterialLibrary.java @@ -21,7 +21,7 @@ package net.minecraftforge.client.model.obj; import com.google.common.collect.Maps; import joptsimple.internal.Strings; -import net.minecraft.client.renderer.Vector4f; +import net.minecraft.util.math.vector.Vector4f; import java.io.IOException; import java.util.Arrays; diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 587e5f913..b0eaeafc9 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -24,16 +24,16 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import joptsimple.internal.Strings; -import net.minecraft.client.renderer.TransformationMatrix; -import net.minecraft.client.renderer.Vector3f; -import net.minecraft.client.renderer.Vector4f; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec2f; +import net.minecraft.util.math.vector.TransformationMatrix; +import net.minecraft.util.math.vector.Vector2f; +import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.util.math.vector.Vector4f; import net.minecraftforge.client.model.*; import net.minecraftforge.client.model.geometry.IModelGeometryPart; import net.minecraftforge.client.model.geometry.IMultipartModelGeometry; @@ -52,17 +52,17 @@ import java.util.stream.Collectors; public class OBJModel implements IMultipartModelGeometry { private static Vector4f COLOR_WHITE = new Vector4f(1, 1, 1, 1); - private static Vec2f[] DEFAULT_COORDS = { - new Vec2f(0, 0), - new Vec2f(0, 1), - new Vec2f(1, 1), - new Vec2f(1, 0), + private static Vector2f[] DEFAULT_COORDS = { + new Vector2f(0, 0), + new Vector2f(0, 1), + new Vector2f(1, 1), + new Vector2f(1, 0), }; private final Map parts = Maps.newHashMap(); private final List positions = Lists.newArrayList(); - private final List texCoords = Lists.newArrayList(); + private final List texCoords = Lists.newArrayList(); private final List normals = Lists.newArrayList(); private final List colors = Lists.newArrayList(); @@ -296,12 +296,12 @@ public class OBJModel implements IMultipartModelGeometry } } - public static Vec2f parseVector2(String[] line) + public static Vector2f parseVector2(String[] line) { switch (line.length) { - case 1: return new Vec2f(0,0); - case 2: return new Vec2f(Float.parseFloat(line[1]), 0); - default: return new Vec2f(Float.parseFloat(line[1]), Float.parseFloat(line[2])); + case 1: return new Vector2f(0,0); + case 2: return new Vector2f(Float.parseFloat(line[1]), 0); + default: return new Vector2f(Float.parseFloat(line[1]), Float.parseFloat(line[2])); } } @@ -366,11 +366,11 @@ public class OBJModel implements IMultipartModelGeometry builder.setQuadTint(tintIndex); - Vec2f uv2 = new Vec2f(0, 0); + Vector2f uv2 = new Vector2f(0, 0); if (ambientToFullbright) { int fakeLight = (int) ((ambientColor.getX() + ambientColor.getY() + ambientColor.getZ()) * 15 / 3.0f); - uv2 = new Vec2f((fakeLight << 4) / 32767.0f, (fakeLight << 4) / 32767.0f); + uv2 = new Vector2f((fakeLight << 4) / 32767.0f, (fakeLight << 4) / 32767.0f); builder.setApplyDiffuseLighting(fakeLight == 0); } else @@ -387,7 +387,7 @@ public class OBJModel implements IMultipartModelGeometry int[] index = indices[Math.min(i,indices.length-1)]; Vector3f pos0 = positions.get(index[0]); Vector4f position = new Vector4f(pos0); - Vec2f texCoord = index.length >= 2 && texCoords.size() > 0 ? texCoords.get(index[1]) : DEFAULT_COORDS[i]; + Vector2f texCoord = index.length >= 2 && texCoords.size() > 0 ? texCoords.get(index[1]) : DEFAULT_COORDS[i]; Vector3f norm0 = !needsNormalRecalculation && index.length >= 3 && normals.size() > 0 ? normals.get(index[2]) : faceNormal; Vector3f normal = norm0; Vector4f color = index.length >= 4 && colors.size() > 0 ? colors.get(index[3]) : COLOR_WHITE; @@ -465,7 +465,7 @@ public class OBJModel implements IMultipartModelGeometry return Pair.of(builder.build(), cull); } - private void putVertexData(IVertexConsumer consumer, Vector4f position0, Vec2f texCoord0, Vector3f normal0, Vector4f color0, Vec2f uv2, TextureAtlasSprite texture) + private void putVertexData(IVertexConsumer consumer, Vector4f position0, Vector2f texCoord0, Vector3f normal0, Vector4f color0, Vector2f uv2, TextureAtlasSprite texture) { ImmutableList elements = consumer.getVertexFormat().getElements(); for(int j=0;j } @Override - public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) + public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) { for(ModelMesh mesh : meshes) { @@ -547,7 +547,7 @@ public class OBJModel implements IMultipartModelGeometry } @Override - public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { return meshes.stream().map(mesh -> ModelLoaderRegistry.resolveTexture(mesh.mat.diffuseColorMap, owner)).collect(Collectors.toSet()); } @@ -568,7 +568,7 @@ public class OBJModel implements IMultipartModelGeometry } @Override - public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) + public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation) { super.addQuads(owner, modelBuilder, bakery, spriteGetter, modelTransform, modelLocation); @@ -577,9 +577,9 @@ public class OBJModel implements IMultipartModelGeometry } @Override - public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { - Set combined = Sets.newHashSet(); + Set combined = Sets.newHashSet(); combined.addAll(super.getTextures(owner, modelGetter, missingTextureErrors)); for (IModelGeometryPart part : getParts()) combined.addAll(part.getTextures(owner, modelGetter, missingTextureErrors)); diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java index 5cdf0dd0c..2ad1e9258 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java @@ -27,16 +27,16 @@ import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.ILightReader; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.world.IBlockDisplayReader; public class BlockInfo { private static final Direction[] SIDES = Direction.values(); private final BlockColors colors; - private ILightReader world; + private IBlockDisplayReader world; private BlockState state; private BlockPos blockPos; @@ -71,13 +71,13 @@ public class BlockInfo public void updateShift() { - Vec3d offset = state.getOffset(world, blockPos); + Vector3d offset = state.getOffset(world, blockPos); shx = (float) offset.x; shy = (float) offset.y; shz = (float) offset.z; } - public void setWorld(ILightReader world) + public void setWorld(IBlockDisplayReader world) { this.world = world; cachedTint = -1; @@ -206,7 +206,7 @@ public class BlockInfo } } - public ILightReader getWorld() + public IBlockDisplayReader getWorld() { return world; } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java index 140c7ca42..3622c6d30 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java @@ -32,7 +32,7 @@ import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.common.ForgeConfig; @@ -51,7 +51,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } @Override - public boolean renderModelFlat(ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData) + public boolean renderModelFlat(IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData) { if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get()) { @@ -71,7 +71,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } @Override - public boolean renderModelSmooth(ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData) + public boolean renderModelSmooth(IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData) { if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get()) { @@ -90,7 +90,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } } - public static boolean render(VertexLighterFlat lighter, ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, boolean checkSides, Random rand, long seed, IModelData modelData) + public static boolean render(VertexLighterFlat lighter, IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, boolean checkSides, Random rand, long seed, IModelData modelData) { lighter.setWorld(world); lighter.setState(state); diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java index e522ad11f..bdf95f243 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -93,7 +93,7 @@ public class LightUtil { consumer.setQuadTint(quad.getTintIndex()); } - consumer.setApplyDiffuseLighting(quad.shouldApplyDiffuseLighting()); + consumer.setApplyDiffuseLighting(quad.func_239287_f_()); float[] data = new float[4]; VertexFormat formatFrom = consumer.getVertexFormat(); VertexFormat formatTo = DefaultVertexFormats.BLOCK; diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/TRSRTransformer.java b/src/main/java/net/minecraftforge/client/model/pipeline/TRSRTransformer.java index 7a47a98cf..3d45f5f6f 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/TRSRTransformer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/TRSRTransformer.java @@ -19,9 +19,9 @@ package net.minecraftforge.client.model.pipeline; -import net.minecraft.client.renderer.TransformationMatrix; -import net.minecraft.client.renderer.Vector3f; -import net.minecraft.client.renderer.Vector4f; +import net.minecraft.util.math.vector.TransformationMatrix; +import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.util.math.vector.Vector4f; public class TRSRTransformer extends VertexTransformer { diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index 7ebb909ce..a378fb503 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -24,9 +24,7 @@ import com.google.common.collect.Lists; import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LightTexture; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; @@ -34,8 +32,9 @@ import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; -import net.minecraft.world.IWorldReader; +import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.util.math.vector.Vector4f; +import net.minecraft.world.IBlockDisplayReader; import java.util.List; import java.util.Objects; @@ -222,7 +221,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer switch(element.getUsage()) { case POSITION: - final net.minecraft.client.renderer.Vector4f pos = new net.minecraft.client.renderer.Vector4f( + final Vector4f pos = new Vector4f( position[v][0], position[v][1], position[v][2], 1); pos.transform(pose.getMatrix()); @@ -232,7 +231,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer parent.put(e, position[v]); break; case NORMAL: - final net.minecraft.client.renderer.Vector3f norm = new net.minecraft.client.renderer.Vector3f(normal[v]); + final Vector3f norm = new Vector3f(normal[v]); norm.transform(pose.getNormal()); normal[v][0] = norm.getX(); @@ -306,7 +305,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer this.diffuse = diffuse; } - public void setWorld(ILightReader world) + public void setWorld(IBlockDisplayReader world) { blockInfo.setWorld(world); } diff --git a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java index b75bb149e..e188e4ca9 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java @@ -49,7 +49,7 @@ public enum KeyModifier { @Override public boolean isActive(@Nullable IKeyConflictContext conflictContext) { - return Screen.hasControlDown(); + return Screen.func_231172_r_(); } @Override @@ -70,7 +70,7 @@ public enum KeyModifier { @Override public boolean isActive(@Nullable IKeyConflictContext conflictContext) { - return Screen.hasShiftDown(); + return Screen.func_231173_s_(); } @Override @@ -89,7 +89,7 @@ public enum KeyModifier { @Override public boolean isActive(@Nullable IKeyConflictContext conflictContext) { - return Screen.hasAltDown(); + return Screen.func_231174_t_(); } @Override diff --git a/src/main/java/net/minecraftforge/common/BiomeDictionary.java b/src/main/java/net/minecraftforge/common/BiomeDictionary.java index 0fb15f3fb..8e1cb6fa6 100644 --- a/src/main/java/net/minecraftforge/common/BiomeDictionary.java +++ b/src/main/java/net/minecraftforge/common/BiomeDictionary.java @@ -377,7 +377,7 @@ public class BiomeDictionary addTypes(Biomes.TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD ); addTypes(Biomes.SWAMP, WET, SWAMP, OVERWORLD ); addTypes(Biomes.RIVER, RIVER, OVERWORLD ); - addTypes(Biomes.NETHER, HOT, DRY, NETHER ); + addTypes(Biomes.field_235254_j_, HOT, DRY, NETHER ); addTypes(Biomes.THE_END, COLD, DRY, END ); addTypes(Biomes.FROZEN_OCEAN, COLD, OCEAN, SNOWY, OVERWORLD ); addTypes(Biomes.FROZEN_RIVER, COLD, RIVER, SNOWY, OVERWORLD ); diff --git a/src/main/java/net/minecraftforge/common/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index 98891bd61..31ff70543 100644 --- a/src/main/java/net/minecraftforge/common/DimensionManager.java +++ b/src/main/java/net/minecraftforge/common/DimensionManager.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.common; +/*package net.minecraftforge.common; import java.io.File; import java.io.IOException; @@ -63,6 +63,7 @@ import net.minecraft.world.chunk.listener.IChunkStatusListener; import net.minecraft.world.server.ServerMultiWorld; import net.minecraft.world.server.ServerWorld; import net.minecraft.world.dimension.DimensionType; +import net.minecraft.world.storage.SaveFormat; import net.minecraft.world.storage.SaveHandler; import net.minecraftforge.common.util.Constants; import net.minecraftforge.event.world.RegisterDimensionsEvent; @@ -108,7 +109,7 @@ public class DimensionManager * @param hasSkyLight does this dimension have a skylight? * @param magnifier The biome generation processor * @return the DimensionType for the dimension. - */ + * / public static DimensionType registerOrGetDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight) { return REGISTRY.getValue(name).orElseGet(()->registerDimension(name, type, data, hasSkyLight)); @@ -125,7 +126,7 @@ public class DimensionManager * @param hasSkyLight skylight for this dimension * @param magnifier The biome generation processor * @return the DimensionType for the dimension. - */ + * / public static DimensionType registerDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight) { Validate.notNull(name, "Can not register a dimension with null name"); @@ -154,7 +155,7 @@ public class DimensionManager * @param dim The dimension * @param value True to keep loaded, false to allow unloading * @return The old value for this dimension. - */ + * / public static boolean keepLoaded(DimensionType dim, boolean value) { Validate.notNull(dim, "Dimension type must not be null"); @@ -168,7 +169,7 @@ public class DimensionManager * Determines if the dimension will stay loaded in memory even if all chunks are unloaded. * @param dim The dimension * @return True if the dimension will stay loaded with no chunks loaded. - */ + * / public static boolean keepLoaded(DimensionType dim) { Validate.notNull(dim, "Dimension type must not be null"); @@ -184,7 +185,7 @@ public class DimensionManager * @param resetUnloadDelay True to reset the unload timer, which is a delay that is used to prevent constant world loading/unloading cycle. * @param forceLoad True to attempt to load the dimension if the server has it unloaded. * @return The world, null if unloaded and not loadable. - */ + * / @Nullable public static ServerWorld getWorld(MinecraftServer server, DimensionType dim, boolean resetUnloadDelay, boolean forceLoad) { @@ -219,7 +220,7 @@ public class DimensionManager * Vanilla dimensions are not supported and will throw an exception. * * @param dim the dimension to delete - */ + * / public static void markForDeletion(DimensionType dim) { if (dim.isVanilla()) @@ -248,7 +249,7 @@ public class DimensionManager /** * Deprecated, unregistering dimensions at runtime is not supported. * @see DimensionManager#markForDeletion(DimensionType) - */ + * / @Deprecated public static void unregisterDimension(int id) { @@ -302,7 +303,7 @@ public class DimensionManager /** * Queues a dimension to unload, if it can be unloaded. * @param world The world to unload - */ + * / public static void unloadWorld(ServerWorld world) { if (world == null || !canUnloadWorld(world)) @@ -466,7 +467,7 @@ public class DimensionManager .forEach(foldersScheduledForDeletion::add); } - public static void processScheduledDeletions(SaveHandler saveHandler) + public static void processScheduledDeletions(SaveFormat.LevelSave levelSave) { List toDelete = new ArrayList<>(foldersScheduledForDeletion); foldersScheduledForDeletion.clear(); @@ -486,7 +487,7 @@ public class DimensionManager } for (String folderName : toDelete) { - File folder = new File(saveHandler.getWorldDirectory(), folderName); + File folder = new File(levelSave.getWorldDir().toFile(), folderName); try { FileUtils.deleteDirectory(folder); @@ -613,4 +614,4 @@ public class DimensionManager playerWorlds = players.getPlayers().stream().map(e -> e.world).collect(Collectors.toSet()); return changed; } -} +}*/ diff --git a/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java b/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java index 6accf7340..61f6b5150 100644 --- a/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java +++ b/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java @@ -26,7 +26,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunk; @@ -36,6 +36,7 @@ import net.minecraftforge.common.ticket.SimpleTicket; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.util.Collections; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -43,7 +44,7 @@ import java.util.Set; public class FarmlandWaterManager { private static boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugFarmlandWaterManager", "false")); - private static final Int2ObjectMap>> customWaterHandler = new Int2ObjectOpenHashMap<>(); + private static final Int2ObjectMap>> customWaterHandler = new Int2ObjectOpenHashMap<>(); private static final Logger LOGGER = LogManager.getLogger(); /** @@ -59,11 +60,11 @@ public class FarmlandWaterManager * @return The ticket for your requested region. */ @SuppressWarnings("unchecked") - public static> T addCustomTicket(World world, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks) + public static> T addCustomTicket(World world, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks) { Preconditions.checkArgument(!world.isRemote, "Water region is only determined server-side"); - Map> ticketMap = customWaterHandler.computeIfAbsent(world.getDimension().getType().getId(), id -> new MapMaker().weakValues().makeMap()); - ChunkTicketManager[] additionalTickets = new ChunkTicketManager[additionalChunks.length]; + Map> ticketMap = Collections.emptyMap();// customWaterHandler.computeIfAbsent(world.getDimension().getType().getId(), id -> new MapMaker().weakValues().makeMap()); //TODO Dimensions + ChunkTicketManager[] additionalTickets = new ChunkTicketManager[additionalChunks.length]; for (int i = 0; i < additionalChunks.length; i++) additionalTickets[i] = ticketMap.computeIfAbsent(additionalChunks[i], ChunkTicketManager::new); ticket.setManager(ticketMap.computeIfAbsent(masterChunk, ChunkTicketManager::new), additionalTickets); @@ -116,7 +117,7 @@ public class FarmlandWaterManager return addCustomTicket(world, new AABBTicket(aabb), masterPos, posSet.toArray(new ChunkPos[0])); } - private static double getDistanceSq(ChunkPos pos, Vec3d vec3d) + private static double getDistanceSq(ChunkPos pos, Vector3d vec3d) { //See ChunkPos#getDistanceSq double d0 = (double)(pos.x * 16 + 8); @@ -132,11 +133,11 @@ public class FarmlandWaterManager */ public static boolean hasBlockWaterTicket(IWorldReader world, BlockPos pos) { - ChunkTicketManager ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), world); + ChunkTicketManager ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), world); if (ticketManager != null) { - Vec3d posAsVec3d = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); - for (SimpleTicket ticket : ticketManager.getTickets()) { + Vector3d posAsVec3d = new Vector3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); + for (SimpleTicket ticket : ticketManager.getTickets()) { if (ticket.matches(posAsVec3d)) return true; } @@ -146,7 +147,7 @@ public class FarmlandWaterManager static void removeTickets(IChunk chunk) { - ChunkTicketManager ticketManager = getTicketManager(chunk.getPos(), chunk.getWorldForge()); + ChunkTicketManager ticketManager = getTicketManager(chunk.getPos(), chunk.getWorldForge()); if (ticketManager != null) { if (DEBUG) @@ -157,9 +158,9 @@ public class FarmlandWaterManager } } - private static ChunkTicketManager getTicketManager(ChunkPos pos, IWorldReader world) { + private static ChunkTicketManager getTicketManager(ChunkPos pos, IWorldReader world) { Preconditions.checkArgument(!world.isRemote(), "Water region is only determined server-side"); - Map> ticketMap = customWaterHandler.get(world.getDimension().getType().getId()); + Map> ticketMap = Collections.emptyMap();//customWaterHandler.get(world.getDimension().getType().getId()); //TODO Dimensions if (ticketMap == null) { return null; diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 6d46a4ed1..c0ece3daf 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -47,7 +47,10 @@ import javax.annotation.Nullable; import net.minecraft.advancements.Advancement; import net.minecraft.block.Block; import net.minecraft.fluid.*; -import net.minecraft.util.CachedBlockInfo; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootTable; +import net.minecraft.loot.LootTableManager; +import net.minecraft.util.*; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; @@ -85,26 +88,17 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionUtils; import net.minecraft.stats.Stats; import net.minecraft.tags.Tag; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.*; import net.minecraft.world.spawner.AbstractSpawner; import net.minecraft.tileentity.FurnaceTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.DamageSource; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.IntIdentityHashBiMap; -import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.EntityRayTraceResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.event.ClickEvent; import net.minecraft.world.Difficulty; import net.minecraft.world.GameType; @@ -112,10 +106,6 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -import net.minecraft.world.dimension.DimensionType; -import net.minecraft.world.storage.loot.LootContext; -import net.minecraft.world.storage.loot.LootTable; -import net.minecraft.world.storage.loot.LootTableManager; import net.minecraftforge.common.loot.IGlobalLootModifier; import net.minecraftforge.common.loot.LootModifierManager; import net.minecraftforge.common.util.BlockSnapshot; @@ -175,7 +165,7 @@ public class ForgeHooks public static boolean canHarvestBlock(@Nonnull BlockState state, @Nonnull PlayerEntity player, @Nonnull IBlockReader world, @Nonnull BlockPos pos) { //state = state.getActualState(world, pos); - if (state.getMaterial().isToolNotRequired()) + if (state.func_235783_q_()) { return true; } @@ -184,13 +174,13 @@ public class ForgeHooks ToolType tool = state.getHarvestTool(); if (stack.isEmpty() || tool == null) { - return player.canHarvestBlock(state); + return true; // TODO: player.canHarvestBlock(state); } int toolLevel = stack.getItem().getHarvestLevel(stack, tool, player, state); if (toolLevel < 0) { - return player.canHarvestBlock(state); + return true; //TODO: player.canHarvestBlock(state); } return ForgeEventFactory.doPlayerHarvestCheck(player, state, toolLevel >= state.getHarvestLevel()); @@ -256,7 +246,7 @@ public class ForgeHooks if (state.isAir(world, pos)) return false; - if (isCreative && Screen.hasControlDown() && state.hasTileEntity()) + if (isCreative && Screen.func_231172_r_() && state.hasTileEntity()) te = world.getTileEntity(pos); result = state.getBlock().getPickBlock(state, target, world, pos, player); @@ -467,7 +457,7 @@ public class ForgeHooks // Includes ipv4 and domain pattern // Matches an ip (xx.xxx.xx.xxx) or a domain (something.com) with or // without a protocol or path. - ITextComponent ichat = null; + IFormattableTextComponent ichat = null; Matcher matcher = URL_PATTERN.matcher(string); int lastEnd = 0; @@ -484,11 +474,11 @@ public class ForgeHooks if (ichat == null) ichat = new StringTextComponent(part); else - ichat.appendText(part); + ichat.func_240702_b_(part); } lastEnd = end; String url = string.substring(start, end); - ITextComponent link = new StringTextComponent(url); + IFormattableTextComponent link = new StringTextComponent(url); try { @@ -500,7 +490,7 @@ public class ForgeHooks if (ichat == null) ichat = new StringTextComponent(url); else - ichat.appendText(url); + ichat.func_240702_b_(url); continue; } url = "http://" + url; @@ -510,18 +500,16 @@ public class ForgeHooks { // Bad syntax bail out! if (ichat == null) ichat = new StringTextComponent(url); - else ichat.appendText(url); + else ichat.func_240702_b_(url); continue; } // Set the click event and append the link. ClickEvent click = new ClickEvent(ClickEvent.Action.OPEN_URL, url); - link.getStyle().setClickEvent(click); - link.getStyle().setUnderlined(true); - link.getStyle().setColor(TextFormatting.BLUE); + link.func_230530_a_(link.getStyle().func_240715_a_(click).setUnderlined(true).func_240718_a_(Color.func_240744_a_(TextFormatting.BLUE))); if (ichat == null) ichat = new StringTextComponent(""); - ichat.appendSibling(link); + ichat.func_230529_a_(link); } // Append the rest of the message. @@ -529,7 +517,7 @@ public class ForgeHooks if (ichat == null) ichat = new StringTextComponent(end); else if (end.length() > 0) - ichat.appendText(string.substring(lastEnd)); + ichat.func_230529_a_(new StringTextComponent(string.substring(lastEnd))); return ichat; } @@ -669,7 +657,7 @@ public class ForgeHooks newBlock.onBlockAdded(world, snap.getPos(), oldBlock, false); } - world.markAndNotifyBlock(snap.getPos(), null, oldBlock, newBlock, updateFlag); + world.markAndNotifyBlock(snap.getPos(), null, oldBlock, newBlock, updateFlag, 512); } player.addStat(Stats.ITEM_USED.get(item)); } @@ -730,7 +718,7 @@ public class ForgeHooks return stack.isEmpty() || !stack.getItem().onLeftClickEntity(stack, player, target); } - public static boolean onTravelToDimension(Entity entity, DimensionType dimension) + public static boolean onTravelToDimension(Entity entity, RegistryKey dimension) { EntityTravelToDimensionEvent event = new EntityTravelToDimensionEvent(entity, dimension); MinecraftForge.EVENT_BUS.post(event); @@ -747,11 +735,11 @@ public class ForgeHooks public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, RayTraceResult ray, Hand hand) { - Vec3d vec3d = ray.getHitVec().subtract(entity.getPositionVec()); + Vector3d vec3d = ray.getHitVec().subtract(entity.getPositionVec()); return onInteractEntityAt(player, entity, vec3d, hand); } - public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, Vec3d vec3d, Hand hand) + public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, Vector3d vec3d, Hand hand) { PlayerInteractEvent.EntityInteractSpecific evt = new PlayerInteractEvent.EntityInteractSpecific(player, hand, entity, vec3d); MinecraftForge.EVENT_BUS.post(evt); @@ -833,8 +821,10 @@ public class ForgeHooks if (!custom) ret = ForgeEventFactory.loadLootTable(name, ret, lootTableManager); - if (ret != null) + /* TODO: + if (ret != null) ret.freeze(); + */ return ret; } @@ -1067,7 +1057,7 @@ public class ForgeHooks } @Override - public IFluidState getFluidState(BlockPos pos) { + public FluidState getFluidState(BlockPos pos) { return Fluids.EMPTY.getDefaultState(); } @@ -1085,6 +1075,7 @@ public class ForgeHooks return res == Result.DEFAULT ? 0 : res == Result.DENY ? -1 : 1; } + /* @SuppressWarnings("deprecation") public static void deserializeTagAdditions(Tag.Builder builder, Function> valueGetter, JsonObject json) { @@ -1121,6 +1112,7 @@ public class ForgeHooks } } } + */ private static final Map, DataSerializerEntry> serializerEntries = GameData.getSerializerMap(); //private static final ForgeRegistry serializerRegistry = (ForgeRegistry) ForgeRegistries.DATA_SERIALIZERS; @@ -1189,10 +1181,12 @@ public class ForgeHooks * @return The modified list */ public static List modifyLoot(List list, LootContext context) { + /* LootModifierManager man = context.getWorld().getServer().getLootModifierManager(); for(IGlobalLootModifier mod : man.getAllLootMods()) { list = mod.apply(list, context); } + */ return list; } diff --git a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java index a46634565..81078bfc9 100644 --- a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java +++ b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java @@ -89,12 +89,14 @@ public class ForgeInternalHandler FarmlandWaterManager.removeTickets(event.getChunk()); } + /* @SubscribeEvent public void playerChangeDimension(PlayerEvent.PlayerChangedDimensionEvent event) { if (event.getPlayer() instanceof ServerPlayerEntity) DimensionManager.rebuildPlayerMap(((ServerPlayerEntity)event.getPlayer()).server.getPlayerList(), true); } + */ @SubscribeEvent public void playerLogin(PlayerEvent.PlayerLoggedInEvent event) diff --git a/src/main/java/net/minecraftforge/common/ForgeMod.java b/src/main/java/net/minecraftforge/common/ForgeMod.java index 0c1f938b4..d8a21387e 100644 --- a/src/main/java/net/minecraftforge/common/ForgeMod.java +++ b/src/main/java/net/minecraftforge/common/ForgeMod.java @@ -20,6 +20,9 @@ package net.minecraftforge.common; import net.minecraft.util.SoundEvent; +import net.minecraft.world.storage.IServerConfiguration; +import net.minecraft.world.storage.IWorldInfo; +import net.minecraft.world.storage.SaveFormat; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.*; @@ -44,8 +47,6 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.storage.SaveHandler; -import net.minecraft.world.storage.WorldInfo; import net.minecraftforge.common.crafting.CompoundIngredient; import net.minecraftforge.common.crafting.ConditionalRecipe; import net.minecraftforge.common.crafting.CraftingHelper; @@ -144,22 +145,24 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook } @Override - public CompoundNBT getDataForWriting(SaveHandler handler, WorldInfo info) + public CompoundNBT getDataForWriting(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo) { CompoundNBT forgeData = new CompoundNBT(); CompoundNBT dims = new CompoundNBT(); - DimensionManager.writeRegistry(dims); + //TODO Dimensions +// DimensionManager.writeRegistry(dims); if (!dims.isEmpty()) forgeData.put("dims", dims); return forgeData; } @Override - public void readData(SaveHandler handler, WorldInfo info, CompoundNBT tag) + public void readData(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo, CompoundNBT tag) { - if (tag.contains("dims", 10)) - DimensionManager.readRegistry(tag.getCompound("dims")); - DimensionManager.processScheduledDeletions(handler); + //TODO Dimensions +// if (tag.contains("dims", 10)) +// DimensionManager.readRegistry(tag.getCompound("dims")); +// DimensionManager.processScheduledDeletions(levelSave); } public void mappingChanged(FMLModIdMappingEvent evt) @@ -178,8 +181,9 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook if (event.includeServer()) { + ForgeBlockTagsProvider blockTags = new ForgeBlockTagsProvider(gen); gen.addProvider(new ForgeBlockTagsProvider(gen)); - gen.addProvider(new ForgeItemTagsProvider(gen)); + gen.addProvider(new ForgeItemTagsProvider(gen, blockTags)); gen.addProvider(new ForgeRecipeProvider(gen)); gen.addProvider(new ForgeLootTableProvider(gen)); } diff --git a/src/main/java/net/minecraftforge/common/ModDimension.java b/src/main/java/net/minecraftforge/common/ModDimension.java index 519fbe7dd..cddee9632 100644 --- a/src/main/java/net/minecraftforge/common/ModDimension.java +++ b/src/main/java/net/minecraftforge/common/ModDimension.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.common; +/*package net.minecraftforge.common; import java.util.function.BiFunction; @@ -34,7 +34,7 @@ import net.minecraftforge.registries.ForgeRegistryEntry; * We used to be able to create custom Dimensions separate from DimensionType. * But now that they are hard linked to a single instance, this is the new class that * defines the 'template' for new dimensions. - */ + * / public abstract class ModDimension extends ForgeRegistryEntry { public abstract BiFunction getFactory(); @@ -45,7 +45,7 @@ public abstract class ModDimension extends ForgeRegistryEntry * * @param buffer The data buffer to write to. * @param network true when sent over the network, so you can only data needed by the client. - */ + * / public void write(PacketBuffer buffer, boolean network){} /** @@ -54,7 +54,7 @@ public abstract class ModDimension extends ForgeRegistryEntry * * @param buffer The data buffer to write to. * @param network true when sent over the network, so you can only data needed by the client. - */ + * / public void read(PacketBuffer buffer, boolean network){} public IBiomeMagnifier getMagnifier() { @@ -67,7 +67,7 @@ public abstract class ModDimension extends ForgeRegistryEntry * * @param factory Factory for creating {@link Dimension} instances from DimType and World. * @return A custom ModDimension with that factory. - */ + * / public static ModDimension withFactory(BiFunction factory) { return new ModDimension() { @Override @@ -76,4 +76,4 @@ public abstract class ModDimension extends ForgeRegistryEntry } }; } -} +}*/ diff --git a/src/main/java/net/minecraftforge/common/Tags.java b/src/main/java/net/minecraftforge/common/Tags.java index 9f3b0820a..f9f388048 100644 --- a/src/main/java/net/minecraftforge/common/Tags.java +++ b/src/main/java/net/minecraftforge/common/Tags.java @@ -22,229 +22,228 @@ package net.minecraftforge.common; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ITag; import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag; -import net.minecraft.util.ResourceLocation; public class Tags { public static class Blocks { - public static final Tag CHESTS = tag("chests"); - public static final Tag CHESTS_ENDER = tag("chests/ender"); - public static final Tag CHESTS_TRAPPED = tag("chests/trapped"); - public static final Tag CHESTS_WOODEN = tag("chests/wooden"); - public static final Tag COBBLESTONE = tag("cobblestone"); - public static final Tag DIRT = tag("dirt"); - public static final Tag END_STONES = tag("end_stones"); - public static final Tag FENCE_GATES = tag("fence_gates"); - public static final Tag FENCE_GATES_WOODEN = tag("fence_gates/wooden"); - public static final Tag FENCES = tag("fences"); - public static final Tag FENCES_NETHER_BRICK = tag("fences/nether_brick"); - public static final Tag FENCES_WOODEN = tag("fences/wooden"); + public static final ITag.INamedTag CHESTS = tag("chests"); + public static final ITag.INamedTag CHESTS_ENDER = tag("chests/ender"); + public static final ITag.INamedTag CHESTS_TRAPPED = tag("chests/trapped"); + public static final ITag.INamedTag CHESTS_WOODEN = tag("chests/wooden"); + public static final ITag.INamedTag COBBLESTONE = tag("cobblestone"); + public static final ITag.INamedTag DIRT = tag("dirt"); + public static final ITag.INamedTag END_STONES = tag("end_stones"); + public static final ITag.INamedTag FENCE_GATES = tag("fence_gates"); + public static final ITag.INamedTag FENCE_GATES_WOODEN = tag("fence_gates/wooden"); + public static final ITag.INamedTag FENCES = tag("fences"); + public static final ITag.INamedTag FENCES_NETHER_BRICK = tag("fences/nether_brick"); + public static final ITag.INamedTag FENCES_WOODEN = tag("fences/wooden"); - public static final Tag GLASS = tag("glass"); - public static final Tag GLASS_BLACK = tag("glass/black"); - public static final Tag GLASS_BLUE = tag("glass/blue"); - public static final Tag GLASS_BROWN = tag("glass/brown"); - public static final Tag GLASS_COLORLESS = tag("glass/colorless"); - public static final Tag GLASS_CYAN = tag("glass/cyan"); - public static final Tag GLASS_GRAY = tag("glass/gray"); - public static final Tag GLASS_GREEN = tag("glass/green"); - public static final Tag GLASS_LIGHT_BLUE = tag("glass/light_blue"); - public static final Tag GLASS_LIGHT_GRAY = tag("glass/light_gray"); - public static final Tag GLASS_LIME = tag("glass/lime"); - public static final Tag GLASS_MAGENTA = tag("glass/magenta"); - public static final Tag GLASS_ORANGE = tag("glass/orange"); - public static final Tag GLASS_PINK = tag("glass/pink"); - public static final Tag GLASS_PURPLE = tag("glass/purple"); - public static final Tag GLASS_RED = tag("glass/red"); - public static final Tag GLASS_WHITE = tag("glass/white"); - public static final Tag GLASS_YELLOW = tag("glass/yellow"); + public static final ITag.INamedTag GLASS = tag("glass"); + public static final ITag.INamedTag GLASS_BLACK = tag("glass/black"); + public static final ITag.INamedTag GLASS_BLUE = tag("glass/blue"); + public static final ITag.INamedTag GLASS_BROWN = tag("glass/brown"); + public static final ITag.INamedTag GLASS_COLORLESS = tag("glass/colorless"); + public static final ITag.INamedTag GLASS_CYAN = tag("glass/cyan"); + public static final ITag.INamedTag GLASS_GRAY = tag("glass/gray"); + public static final ITag.INamedTag GLASS_GREEN = tag("glass/green"); + public static final ITag.INamedTag GLASS_LIGHT_BLUE = tag("glass/light_blue"); + public static final ITag.INamedTag GLASS_LIGHT_GRAY = tag("glass/light_gray"); + public static final ITag.INamedTag GLASS_LIME = tag("glass/lime"); + public static final ITag.INamedTag GLASS_MAGENTA = tag("glass/magenta"); + public static final ITag.INamedTag GLASS_ORANGE = tag("glass/orange"); + public static final ITag.INamedTag GLASS_PINK = tag("glass/pink"); + public static final ITag.INamedTag GLASS_PURPLE = tag("glass/purple"); + public static final ITag.INamedTag GLASS_RED = tag("glass/red"); + public static final ITag.INamedTag GLASS_WHITE = tag("glass/white"); + public static final ITag.INamedTag GLASS_YELLOW = tag("glass/yellow"); - public static final Tag GLASS_PANES = tag("glass_panes"); - public static final Tag GLASS_PANES_BLACK = tag("glass_panes/black"); - public static final Tag GLASS_PANES_BLUE = tag("glass_panes/blue"); - public static final Tag GLASS_PANES_BROWN = tag("glass_panes/brown"); - public static final Tag GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); - public static final Tag GLASS_PANES_CYAN = tag("glass_panes/cyan"); - public static final Tag GLASS_PANES_GRAY = tag("glass_panes/gray"); - public static final Tag GLASS_PANES_GREEN = tag("glass_panes/green"); - public static final Tag GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue"); - public static final Tag GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray"); - public static final Tag GLASS_PANES_LIME = tag("glass_panes/lime"); - public static final Tag GLASS_PANES_MAGENTA = tag("glass_panes/magenta"); - public static final Tag GLASS_PANES_ORANGE = tag("glass_panes/orange"); - public static final Tag GLASS_PANES_PINK = tag("glass_panes/pink"); - public static final Tag GLASS_PANES_PURPLE = tag("glass_panes/purple"); - public static final Tag GLASS_PANES_RED = tag("glass_panes/red"); - public static final Tag GLASS_PANES_WHITE = tag("glass_panes/white"); - public static final Tag GLASS_PANES_YELLOW = tag("glass_panes/yellow"); + public static final ITag.INamedTag GLASS_PANES = tag("glass_panes"); + public static final ITag.INamedTag GLASS_PANES_BLACK = tag("glass_panes/black"); + public static final ITag.INamedTag GLASS_PANES_BLUE = tag("glass_panes/blue"); + public static final ITag.INamedTag GLASS_PANES_BROWN = tag("glass_panes/brown"); + public static final ITag.INamedTag GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); + public static final ITag.INamedTag GLASS_PANES_CYAN = tag("glass_panes/cyan"); + public static final ITag.INamedTag GLASS_PANES_GRAY = tag("glass_panes/gray"); + public static final ITag.INamedTag GLASS_PANES_GREEN = tag("glass_panes/green"); + public static final ITag.INamedTag GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue"); + public static final ITag.INamedTag GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray"); + public static final ITag.INamedTag GLASS_PANES_LIME = tag("glass_panes/lime"); + public static final ITag.INamedTag GLASS_PANES_MAGENTA = tag("glass_panes/magenta"); + public static final ITag.INamedTag GLASS_PANES_ORANGE = tag("glass_panes/orange"); + public static final ITag.INamedTag GLASS_PANES_PINK = tag("glass_panes/pink"); + public static final ITag.INamedTag GLASS_PANES_PURPLE = tag("glass_panes/purple"); + public static final ITag.INamedTag GLASS_PANES_RED = tag("glass_panes/red"); + public static final ITag.INamedTag GLASS_PANES_WHITE = tag("glass_panes/white"); + public static final ITag.INamedTag GLASS_PANES_YELLOW = tag("glass_panes/yellow"); - public static final Tag GRAVEL = tag("gravel"); - public static final Tag NETHERRACK = tag("netherrack"); - public static final Tag OBSIDIAN = tag("obsidian"); - public static final Tag ORES = tag("ores"); - public static final Tag ORES_COAL = tag("ores/coal"); - public static final Tag ORES_DIAMOND = tag("ores/diamond"); - public static final Tag ORES_EMERALD = tag("ores/emerald"); - public static final Tag ORES_GOLD = tag("ores/gold"); - public static final Tag ORES_IRON = tag("ores/iron"); - public static final Tag ORES_LAPIS = tag("ores/lapis"); - public static final Tag ORES_QUARTZ = tag("ores/quartz"); - public static final Tag ORES_REDSTONE = tag("ores/redstone"); + public static final ITag.INamedTag GRAVEL = tag("gravel"); + public static final ITag.INamedTag NETHERRACK = tag("netherrack"); + public static final ITag.INamedTag OBSIDIAN = tag("obsidian"); + public static final ITag.INamedTag ORES = tag("ores"); + public static final ITag.INamedTag ORES_COAL = tag("ores/coal"); + public static final ITag.INamedTag ORES_DIAMOND = tag("ores/diamond"); + public static final ITag.INamedTag ORES_EMERALD = tag("ores/emerald"); + public static final ITag.INamedTag ORES_GOLD = tag("ores/gold"); + public static final ITag.INamedTag ORES_IRON = tag("ores/iron"); + public static final ITag.INamedTag ORES_LAPIS = tag("ores/lapis"); + public static final ITag.INamedTag ORES_QUARTZ = tag("ores/quartz"); + public static final ITag.INamedTag ORES_REDSTONE = tag("ores/redstone"); - public static final Tag SAND = tag("sand"); - public static final Tag SAND_COLORLESS = tag("sand/colorless"); - public static final Tag SAND_RED = tag("sand/red"); + public static final ITag.INamedTag SAND = tag("sand"); + public static final ITag.INamedTag SAND_COLORLESS = tag("sand/colorless"); + public static final ITag.INamedTag SAND_RED = tag("sand/red"); - public static final Tag SANDSTONE = tag("sandstone"); - public static final Tag STAINED_GLASS = tag("stained_glass"); - public static final Tag STAINED_GLASS_PANES = tag("stained_glass_panes"); - public static final Tag STONE = tag("stone"); - public static final Tag STORAGE_BLOCKS = tag("storage_blocks"); - public static final Tag STORAGE_BLOCKS_COAL = tag("storage_blocks/coal"); - public static final Tag STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond"); - public static final Tag STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald"); - public static final Tag STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold"); - public static final Tag STORAGE_BLOCKS_IRON = tag("storage_blocks/iron"); - public static final Tag STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis"); - public static final Tag STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz"); - public static final Tag STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); + public static final ITag.INamedTag SANDSTONE = tag("sandstone"); + public static final ITag.INamedTag STAINED_GLASS = tag("stained_glass"); + public static final ITag.INamedTag STAINED_GLASS_PANES = tag("stained_glass_panes"); + public static final ITag.INamedTag STONE = tag("stone"); + public static final ITag.INamedTag STORAGE_BLOCKS = tag("storage_blocks"); + public static final ITag.INamedTag STORAGE_BLOCKS_COAL = tag("storage_blocks/coal"); + public static final ITag.INamedTag STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond"); + public static final ITag.INamedTag STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald"); + public static final ITag.INamedTag STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold"); + public static final ITag.INamedTag STORAGE_BLOCKS_IRON = tag("storage_blocks/iron"); + public static final ITag.INamedTag STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis"); + public static final ITag.INamedTag STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz"); + public static final ITag.INamedTag STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); - private static Tag tag(String name) + private static ITag.INamedTag tag(String name) { - return new BlockTags.Wrapper(new ResourceLocation("forge", name)); + return BlockTags.makeWrapperTag("forge:" + name); } } public static class Items { - public static final Tag ARROWS = tag("arrows"); - public static final Tag BEACON_PAYMENT = tag("beacon_payment"); - public static final Tag BONES = tag("bones"); - public static final Tag BOOKSHELVES = tag("bookshelves"); - public static final Tag CHESTS = tag("chests"); - public static final Tag CHESTS_ENDER = tag("chests/ender"); - public static final Tag CHESTS_TRAPPED = tag("chests/trapped"); - public static final Tag CHESTS_WOODEN = tag("chests/wooden"); - public static final Tag COBBLESTONE = tag("cobblestone"); - public static final Tag CROPS = tag("crops"); - public static final Tag CROPS_BEETROOT = tag("crops/beetroot"); - public static final Tag CROPS_CARROT = tag("crops/carrot"); - public static final Tag CROPS_NETHER_WART = tag("crops/nether_wart"); - public static final Tag CROPS_POTATO = tag("crops/potato"); - public static final Tag CROPS_WHEAT = tag("crops/wheat"); - public static final Tag DUSTS = tag("dusts"); - public static final Tag DUSTS_PRISMARINE = tag("dusts/prismarine"); - public static final Tag DUSTS_REDSTONE = tag("dusts/redstone"); - public static final Tag DUSTS_GLOWSTONE = tag("dusts/glowstone"); + public static final ITag.INamedTag ARROWS = tag("arrows"); + public static final ITag.INamedTag BEACON_PAYMENT = tag("beacon_payment"); + public static final ITag.INamedTag BONES = tag("bones"); + public static final ITag.INamedTag BOOKSHELVES = tag("bookshelves"); + public static final ITag.INamedTag CHESTS = tag("chests"); + public static final ITag.INamedTag CHESTS_ENDER = tag("chests/ender"); + public static final ITag.INamedTag CHESTS_TRAPPED = tag("chests/trapped"); + public static final ITag.INamedTag CHESTS_WOODEN = tag("chests/wooden"); + public static final ITag.INamedTag COBBLESTONE = tag("cobblestone"); + public static final ITag.INamedTag CROPS = tag("crops"); + public static final ITag.INamedTag CROPS_BEETROOT = tag("crops/beetroot"); + public static final ITag.INamedTag CROPS_CARROT = tag("crops/carrot"); + public static final ITag.INamedTag CROPS_NETHER_WART = tag("crops/nether_wart"); + public static final ITag.INamedTag CROPS_POTATO = tag("crops/potato"); + public static final ITag.INamedTag CROPS_WHEAT = tag("crops/wheat"); + public static final ITag.INamedTag DUSTS = tag("dusts"); + public static final ITag.INamedTag DUSTS_PRISMARINE = tag("dusts/prismarine"); + public static final ITag.INamedTag DUSTS_REDSTONE = tag("dusts/redstone"); + public static final ITag.INamedTag DUSTS_GLOWSTONE = tag("dusts/glowstone"); - public static final Tag DYES = tag("dyes"); - public static final Tag DYES_BLACK = tag("dyes/black"); - public static final Tag DYES_RED = tag("dyes/red"); - public static final Tag DYES_GREEN = tag("dyes/green"); - public static final Tag DYES_BROWN = tag("dyes/brown"); - public static final Tag DYES_BLUE = tag("dyes/blue"); - public static final Tag DYES_PURPLE = tag("dyes/purple"); - public static final Tag DYES_CYAN = tag("dyes/cyan"); - public static final Tag DYES_LIGHT_GRAY = tag("dyes/light_gray"); - public static final Tag DYES_GRAY = tag("dyes/gray"); - public static final Tag DYES_PINK = tag("dyes/pink"); - public static final Tag DYES_LIME = tag("dyes/lime"); - public static final Tag DYES_YELLOW = tag("dyes/yellow"); - public static final Tag DYES_LIGHT_BLUE = tag("dyes/light_blue"); - public static final Tag DYES_MAGENTA = tag("dyes/magenta"); - public static final Tag DYES_ORANGE = tag("dyes/orange"); - public static final Tag DYES_WHITE = tag("dyes/white"); + public static final ITag.INamedTag DYES = tag("dyes"); + public static final ITag.INamedTag DYES_BLACK = tag("dyes/black"); + public static final ITag.INamedTag DYES_RED = tag("dyes/red"); + public static final ITag.INamedTag DYES_GREEN = tag("dyes/green"); + public static final ITag.INamedTag DYES_BROWN = tag("dyes/brown"); + public static final ITag.INamedTag DYES_BLUE = tag("dyes/blue"); + public static final ITag.INamedTag DYES_PURPLE = tag("dyes/purple"); + public static final ITag.INamedTag DYES_CYAN = tag("dyes/cyan"); + public static final ITag.INamedTag DYES_LIGHT_GRAY = tag("dyes/light_gray"); + public static final ITag.INamedTag DYES_GRAY = tag("dyes/gray"); + public static final ITag.INamedTag DYES_PINK = tag("dyes/pink"); + public static final ITag.INamedTag DYES_LIME = tag("dyes/lime"); + public static final ITag.INamedTag DYES_YELLOW = tag("dyes/yellow"); + public static final ITag.INamedTag DYES_LIGHT_BLUE = tag("dyes/light_blue"); + public static final ITag.INamedTag DYES_MAGENTA = tag("dyes/magenta"); + public static final ITag.INamedTag DYES_ORANGE = tag("dyes/orange"); + public static final ITag.INamedTag DYES_WHITE = tag("dyes/white"); - public static final Tag EGGS = tag("eggs"); - public static final Tag END_STONES = tag("end_stones"); - public static final Tag ENDER_PEARLS = tag("ender_pearls"); - public static final Tag FEATHERS = tag("feathers"); - public static final Tag FENCE_GATES = tag("fence_gates"); - public static final Tag FENCE_GATES_WOODEN = tag("fence_gates/wooden"); - public static final Tag FENCES = tag("fences"); - public static final Tag FENCES_NETHER_BRICK = tag("fences/nether_brick"); - public static final Tag FENCES_WOODEN = tag("fences/wooden"); - public static final Tag GEMS = tag("gems"); - public static final Tag GEMS_DIAMOND = tag("gems/diamond"); - public static final Tag GEMS_EMERALD = tag("gems/emerald"); - public static final Tag GEMS_LAPIS = tag("gems/lapis"); - public static final Tag GEMS_PRISMARINE = tag("gems/prismarine"); - public static final Tag GEMS_QUARTZ = tag("gems/quartz"); + public static final ITag.INamedTag EGGS = tag("eggs"); + public static final ITag.INamedTag END_STONES = tag("end_stones"); + public static final ITag.INamedTag ENDER_PEARLS = tag("ender_pearls"); + public static final ITag.INamedTag FEATHERS = tag("feathers"); + public static final ITag.INamedTag FENCE_GATES = tag("fence_gates"); + public static final ITag.INamedTag FENCE_GATES_WOODEN = tag("fence_gates/wooden"); + public static final ITag.INamedTag FENCES = tag("fences"); + public static final ITag.INamedTag FENCES_NETHER_BRICK = tag("fences/nether_brick"); + public static final ITag.INamedTag FENCES_WOODEN = tag("fences/wooden"); + public static final ITag.INamedTag GEMS = tag("gems"); + public static final ITag.INamedTag GEMS_DIAMOND = tag("gems/diamond"); + public static final ITag.INamedTag GEMS_EMERALD = tag("gems/emerald"); + public static final ITag.INamedTag GEMS_LAPIS = tag("gems/lapis"); + public static final ITag.INamedTag GEMS_PRISMARINE = tag("gems/prismarine"); + public static final ITag.INamedTag GEMS_QUARTZ = tag("gems/quartz"); - public static final Tag GLASS = tag("glass"); - public static final Tag GLASS_BLACK = tag("glass/black"); - public static final Tag GLASS_BLUE = tag("glass/blue"); - public static final Tag GLASS_BROWN = tag("glass/brown"); - public static final Tag GLASS_COLORLESS = tag("glass/colorless"); - public static final Tag GLASS_CYAN = tag("glass/cyan"); - public static final Tag GLASS_GRAY = tag("glass/gray"); - public static final Tag GLASS_GREEN = tag("glass/green"); - public static final Tag GLASS_LIGHT_BLUE = tag("glass/light_blue"); - public static final Tag GLASS_LIGHT_GRAY = tag("glass/light_gray"); - public static final Tag GLASS_LIME = tag("glass/lime"); - public static final Tag GLASS_MAGENTA = tag("glass/magenta"); - public static final Tag GLASS_ORANGE = tag("glass/orange"); - public static final Tag GLASS_PINK = tag("glass/pink"); - public static final Tag GLASS_PURPLE = tag("glass/purple"); - public static final Tag GLASS_RED = tag("glass/red"); - public static final Tag GLASS_WHITE = tag("glass/white"); - public static final Tag GLASS_YELLOW = tag("glass/yellow"); + public static final ITag.INamedTag GLASS = tag("glass"); + public static final ITag.INamedTag GLASS_BLACK = tag("glass/black"); + public static final ITag.INamedTag GLASS_BLUE = tag("glass/blue"); + public static final ITag.INamedTag GLASS_BROWN = tag("glass/brown"); + public static final ITag.INamedTag GLASS_COLORLESS = tag("glass/colorless"); + public static final ITag.INamedTag GLASS_CYAN = tag("glass/cyan"); + public static final ITag.INamedTag GLASS_GRAY = tag("glass/gray"); + public static final ITag.INamedTag GLASS_GREEN = tag("glass/green"); + public static final ITag.INamedTag GLASS_LIGHT_BLUE = tag("glass/light_blue"); + public static final ITag.INamedTag GLASS_LIGHT_GRAY = tag("glass/light_gray"); + public static final ITag.INamedTag GLASS_LIME = tag("glass/lime"); + public static final ITag.INamedTag GLASS_MAGENTA = tag("glass/magenta"); + public static final ITag.INamedTag GLASS_ORANGE = tag("glass/orange"); + public static final ITag.INamedTag GLASS_PINK = tag("glass/pink"); + public static final ITag.INamedTag GLASS_PURPLE = tag("glass/purple"); + public static final ITag.INamedTag GLASS_RED = tag("glass/red"); + public static final ITag.INamedTag GLASS_WHITE = tag("glass/white"); + public static final ITag.INamedTag GLASS_YELLOW = tag("glass/yellow"); - public static final Tag GLASS_PANES = tag("glass_panes"); - public static final Tag GLASS_PANES_BLACK = tag("glass_panes/black"); - public static final Tag GLASS_PANES_BLUE = tag("glass_panes/blue"); - public static final Tag GLASS_PANES_BROWN = tag("glass_panes/brown"); - public static final Tag GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); - public static final Tag GLASS_PANES_CYAN = tag("glass_panes/cyan"); - public static final Tag GLASS_PANES_GRAY = tag("glass_panes/gray"); - public static final Tag GLASS_PANES_GREEN = tag("glass_panes/green"); - public static final Tag GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue"); - public static final Tag GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray"); - public static final Tag GLASS_PANES_LIME = tag("glass_panes/lime"); - public static final Tag GLASS_PANES_MAGENTA = tag("glass_panes/magenta"); - public static final Tag GLASS_PANES_ORANGE = tag("glass_panes/orange"); - public static final Tag GLASS_PANES_PINK = tag("glass_panes/pink"); - public static final Tag GLASS_PANES_PURPLE = tag("glass_panes/purple"); - public static final Tag GLASS_PANES_RED = tag("glass_panes/red"); - public static final Tag GLASS_PANES_WHITE = tag("glass_panes/white"); - public static final Tag GLASS_PANES_YELLOW = tag("glass_panes/yellow"); + public static final ITag.INamedTag GLASS_PANES = tag("glass_panes"); + public static final ITag.INamedTag GLASS_PANES_BLACK = tag("glass_panes/black"); + public static final ITag.INamedTag GLASS_PANES_BLUE = tag("glass_panes/blue"); + public static final ITag.INamedTag GLASS_PANES_BROWN = tag("glass_panes/brown"); + public static final ITag.INamedTag GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); + public static final ITag.INamedTag GLASS_PANES_CYAN = tag("glass_panes/cyan"); + public static final ITag.INamedTag GLASS_PANES_GRAY = tag("glass_panes/gray"); + public static final ITag.INamedTag GLASS_PANES_GREEN = tag("glass_panes/green"); + public static final ITag.INamedTag GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue"); + public static final ITag.INamedTag GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray"); + public static final ITag.INamedTag GLASS_PANES_LIME = tag("glass_panes/lime"); + public static final ITag.INamedTag GLASS_PANES_MAGENTA = tag("glass_panes/magenta"); + public static final ITag.INamedTag GLASS_PANES_ORANGE = tag("glass_panes/orange"); + public static final ITag.INamedTag GLASS_PANES_PINK = tag("glass_panes/pink"); + public static final ITag.INamedTag GLASS_PANES_PURPLE = tag("glass_panes/purple"); + public static final ITag.INamedTag GLASS_PANES_RED = tag("glass_panes/red"); + public static final ITag.INamedTag GLASS_PANES_WHITE = tag("glass_panes/white"); + public static final ITag.INamedTag GLASS_PANES_YELLOW = tag("glass_panes/yellow"); - public static final Tag GRAVEL = tag("gravel"); - public static final Tag GUNPOWDER = tag("gunpowder"); - public static final Tag HEADS = tag("heads"); - public static final Tag INGOTS = tag("ingots"); - public static final Tag INGOTS_BRICK = tag("ingots/brick"); - public static final Tag INGOTS_GOLD = tag("ingots/gold"); - public static final Tag INGOTS_IRON = tag("ingots/iron"); - public static final Tag INGOTS_NETHER_BRICK = tag("ingots/nether_brick"); - public static final Tag LEATHER = tag("leather"); - public static final Tag MUSHROOMS = tag("mushrooms"); - public static final Tag MUSIC_DISCS = tag("music_discs"); - public static final Tag NETHER_STARS = tag("nether_stars"); - public static final Tag NETHERRACK = tag("netherrack"); - public static final Tag NUGGETS = tag("nuggets"); - public static final Tag NUGGETS_GOLD = tag("nuggets/gold"); - public static final Tag NUGGETS_IRON = tag("nuggets/iron"); - public static final Tag OBSIDIAN = tag("obsidian"); - public static final Tag ORES = tag("ores"); - public static final Tag ORES_COAL = tag("ores/coal"); - public static final Tag ORES_DIAMOND = tag("ores/diamond"); - public static final Tag ORES_EMERALD = tag("ores/emerald"); - public static final Tag ORES_GOLD = tag("ores/gold"); - public static final Tag ORES_IRON = tag("ores/iron"); - public static final Tag ORES_LAPIS = tag("ores/lapis"); - public static final Tag ORES_QUARTZ = tag("ores/quartz"); - public static final Tag ORES_REDSTONE = tag("ores/redstone"); - public static final Tag RODS = tag("rods"); - public static final Tag RODS_BLAZE = tag("rods/blaze"); - public static final Tag RODS_WOODEN = tag("rods/wooden"); + public static final ITag.INamedTag GRAVEL = tag("gravel"); + public static final ITag.INamedTag GUNPOWDER = tag("gunpowder"); + public static final ITag.INamedTag HEADS = tag("heads"); + public static final ITag.INamedTag INGOTS = tag("ingots"); + public static final ITag.INamedTag INGOTS_BRICK = tag("ingots/brick"); + public static final ITag.INamedTag INGOTS_GOLD = tag("ingots/gold"); + public static final ITag.INamedTag INGOTS_IRON = tag("ingots/iron"); + public static final ITag.INamedTag INGOTS_NETHER_BRICK = tag("ingots/nether_brick"); + public static final ITag.INamedTag LEATHER = tag("leather"); + public static final ITag.INamedTag MUSHROOMS = tag("mushrooms"); + public static final ITag.INamedTag MUSIC_DISCS = tag("music_discs"); + public static final ITag.INamedTag NETHER_STARS = tag("nether_stars"); + public static final ITag.INamedTag NETHERRACK = tag("netherrack"); + public static final ITag.INamedTag NUGGETS = tag("nuggets"); + public static final ITag.INamedTag NUGGETS_GOLD = tag("nuggets/gold"); + public static final ITag.INamedTag NUGGETS_IRON = tag("nuggets/iron"); + public static final ITag.INamedTag OBSIDIAN = tag("obsidian"); + public static final ITag.INamedTag ORES = tag("ores"); + public static final ITag.INamedTag ORES_COAL = tag("ores/coal"); + public static final ITag.INamedTag ORES_DIAMOND = tag("ores/diamond"); + public static final ITag.INamedTag ORES_EMERALD = tag("ores/emerald"); + public static final ITag.INamedTag ORES_GOLD = tag("ores/gold"); + public static final ITag.INamedTag ORES_IRON = tag("ores/iron"); + public static final ITag.INamedTag ORES_LAPIS = tag("ores/lapis"); + public static final ITag.INamedTag ORES_QUARTZ = tag("ores/quartz"); + public static final ITag.INamedTag ORES_REDSTONE = tag("ores/redstone"); + public static final ITag.INamedTag RODS = tag("rods"); + public static final ITag.INamedTag RODS_BLAZE = tag("rods/blaze"); + public static final ITag.INamedTag RODS_WOODEN = tag("rods/wooden"); - public static final Tag SAND = tag("sand"); - public static final Tag SAND_COLORLESS = tag("sand/colorless"); - public static final Tag SAND_RED = tag("sand/red"); + public static final ITag.INamedTag SAND = tag("sand"); + public static final ITag.INamedTag SAND_COLORLESS = tag("sand/colorless"); + public static final ITag.INamedTag SAND_RED = tag("sand/red"); public static final ITag.INamedTag SANDSTONE = tag("sandstone"); public static final ITag.INamedTag SEEDS = tag("seeds"); @@ -252,7 +251,6 @@ public class Tags public static final ITag.INamedTag SEEDS_MELON = tag("seeds/melon"); public static final ITag.INamedTag SEEDS_PUMPKIN = tag("seeds/pumpkin"); public static final ITag.INamedTag SEEDS_WHEAT = tag("seeds/wheat"); - public static final ITag.INamedTag SHEARS = tag("shears"); public static final ITag.INamedTag SLIMEBALLS = tag("slimeballs"); public static final ITag.INamedTag STAINED_GLASS = tag("stained_glass"); public static final ITag.INamedTag STAINED_GLASS_PANES = tag("stained_glass_panes"); @@ -268,9 +266,9 @@ public class Tags public static final ITag.INamedTag STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); public static final ITag.INamedTag STRING = tag("string"); - private static Tag tag(String name) + private static ITag.INamedTag tag(String name) { - return new ItemTags.Wrapper(new ResourceLocation("forge", name)); + return ItemTags.makeWrapperTag("forge:" + name); } } } diff --git a/src/main/java/net/minecraftforge/common/animation/TimeValues.java b/src/main/java/net/minecraftforge/common/animation/TimeValues.java index 4e17b1b80..5282a80cb 100644 --- a/src/main/java/net/minecraftforge/common/animation/TimeValues.java +++ b/src/main/java/net/minecraftforge/common/animation/TimeValues.java @@ -53,7 +53,7 @@ public final class TimeValues } @Override - public String getName() + public String func_176610_l() { return "identity"; } @@ -245,7 +245,7 @@ public final class TimeValues } @Override - public String getName() + public String func_176610_l() { return parameterName; } @@ -347,7 +347,7 @@ public final class TimeValues } else if(parameter instanceof IStringSerializable) { - out.value("#" + ((IStringSerializable)parameter).getName()); + out.value("#" + ((IStringSerializable)parameter).func_176610_l()); } } diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java index 65e670c95..c16d285a4 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java @@ -22,6 +22,7 @@ package net.minecraftforge.common.crafting.conditions; import com.google.gson.JsonObject; import net.minecraft.item.Item; +import net.minecraft.tags.ITag; import net.minecraft.tags.ItemTags; import net.minecraft.tags.Tag; import net.minecraft.util.JSONUtils; @@ -56,8 +57,8 @@ public class TagEmptyCondition implements ICondition @Override public boolean test() { - Tag tag = ItemTags.getCollection().get(tag_name); - return tag == null || tag.getAllElements().isEmpty(); + ITag tag = ItemTags.getCollection().get(tag_name); + return tag == null || tag.func_230236_b_().isEmpty(); } @Override diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java index 6cdb1f4a2..f30517042 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java @@ -21,6 +21,7 @@ package net.minecraftforge.common.data; import net.minecraft.data.DataGenerator; import net.minecraft.item.DyeColor; +import net.minecraft.tags.ITag; import net.minecraft.tags.Tag; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.Tags; @@ -50,76 +51,76 @@ public class ForgeBlockTagsProvider extends BlockTagsProvider public void registerTags() { super.registerTags(); - filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey().getId()).collect(Collectors.toSet()); + filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toSet()); - getBuilder(CHESTS).add(CHESTS_ENDER, CHESTS_TRAPPED, CHESTS_WOODEN); - getBuilder(CHESTS_ENDER).add(Blocks.ENDER_CHEST); - getBuilder(CHESTS_TRAPPED).add(Blocks.TRAPPED_CHEST); - getBuilder(CHESTS_WOODEN).add(Blocks.CHEST, Blocks.TRAPPED_CHEST); - getBuilder(COBBLESTONE).add(Blocks.COBBLESTONE, Blocks.INFESTED_COBBLESTONE, Blocks.MOSSY_COBBLESTONE); - getBuilder(DIRT).add(Blocks.DIRT, Blocks.GRASS_BLOCK, Blocks.COARSE_DIRT, Blocks.PODZOL, Blocks.MYCELIUM); - getBuilder(END_STONES).add(Blocks.END_STONE); - getBuilder(FENCE_GATES).add(FENCE_GATES_WOODEN); - getBuilder(FENCE_GATES_WOODEN).add(Blocks.OAK_FENCE_GATE, Blocks.SPRUCE_FENCE_GATE, Blocks.BIRCH_FENCE_GATE, Blocks.JUNGLE_FENCE_GATE, Blocks.ACACIA_FENCE_GATE, Blocks.DARK_OAK_FENCE_GATE); - getBuilder(FENCES).add(FENCES_NETHER_BRICK, FENCES_WOODEN); - getBuilder(FENCES_NETHER_BRICK).add(Blocks.NETHER_BRICK_FENCE); - getBuilder(FENCES_WOODEN).add(Blocks.OAK_FENCE, Blocks.SPRUCE_FENCE, Blocks.BIRCH_FENCE, Blocks.JUNGLE_FENCE, Blocks.ACACIA_FENCE, Blocks.DARK_OAK_FENCE); - getBuilder(GLASS).add(GLASS_COLORLESS, STAINED_GLASS); - getBuilder(GLASS_COLORLESS).add(Blocks.GLASS); - addColored(getBuilder(STAINED_GLASS)::add, GLASS, "{color}_stained_glass"); - getBuilder(GLASS_PANES).add(GLASS_PANES_COLORLESS, STAINED_GLASS_PANES); - getBuilder(GLASS_PANES_COLORLESS).add(Blocks.GLASS_PANE); - addColored(getBuilder(STAINED_GLASS_PANES)::add, GLASS_PANES, "{color}_stained_glass_pane"); - getBuilder(GRAVEL).add(Blocks.GRAVEL); - getBuilder(NETHERRACK).add(Blocks.NETHERRACK); - getBuilder(OBSIDIAN).add(Blocks.OBSIDIAN); - getBuilder(ORES).add(ORES_COAL, ORES_DIAMOND, ORES_EMERALD, ORES_GOLD, ORES_IRON, ORES_LAPIS, ORES_REDSTONE, ORES_QUARTZ); - getBuilder(ORES_COAL).add(Blocks.COAL_ORE); - getBuilder(ORES_DIAMOND).add(Blocks.DIAMOND_ORE); - getBuilder(ORES_EMERALD).add(Blocks.EMERALD_ORE); - getBuilder(ORES_GOLD).add(Blocks.GOLD_ORE); - getBuilder(ORES_IRON).add(Blocks.IRON_ORE); - getBuilder(ORES_LAPIS).add(Blocks.LAPIS_ORE); - getBuilder(ORES_QUARTZ).add(Blocks.NETHER_QUARTZ_ORE); - getBuilder(ORES_REDSTONE).add(Blocks.REDSTONE_ORE); - getBuilder(SAND).add(SAND_COLORLESS, SAND_RED); - getBuilder(SAND_COLORLESS).add(Blocks.SAND); - getBuilder(SAND_RED).add(Blocks.RED_SAND); - getBuilder(SANDSTONE).add(Blocks.SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE); - getBuilder(STONE).add(Blocks.ANDESITE, Blocks.DIORITE, Blocks.GRANITE, Blocks.INFESTED_STONE, Blocks.STONE, Blocks.POLISHED_ANDESITE, Blocks.POLISHED_DIORITE, Blocks.POLISHED_GRANITE); - getBuilder(STORAGE_BLOCKS).add(STORAGE_BLOCKS_COAL, STORAGE_BLOCKS_DIAMOND, STORAGE_BLOCKS_EMERALD, STORAGE_BLOCKS_GOLD, STORAGE_BLOCKS_IRON, STORAGE_BLOCKS_LAPIS, STORAGE_BLOCKS_QUARTZ, STORAGE_BLOCKS_REDSTONE); - getBuilder(STORAGE_BLOCKS_COAL).add(Blocks.COAL_BLOCK); - getBuilder(STORAGE_BLOCKS_DIAMOND).add(Blocks.DIAMOND_BLOCK); - getBuilder(STORAGE_BLOCKS_EMERALD).add(Blocks.EMERALD_BLOCK); - getBuilder(STORAGE_BLOCKS_GOLD).add(Blocks.GOLD_BLOCK); - getBuilder(STORAGE_BLOCKS_IRON).add(Blocks.IRON_BLOCK); - getBuilder(STORAGE_BLOCKS_LAPIS).add(Blocks.LAPIS_BLOCK); - getBuilder(STORAGE_BLOCKS_QUARTZ).add(Blocks.QUARTZ_BLOCK); - getBuilder(STORAGE_BLOCKS_REDSTONE).add(Blocks.REDSTONE_BLOCK); + func_240522_a_(CHESTS).addTags(CHESTS_ENDER, CHESTS_TRAPPED, CHESTS_WOODEN); + func_240522_a_(CHESTS_ENDER).func_240534_a_(Blocks.ENDER_CHEST); + func_240522_a_(CHESTS_TRAPPED).func_240534_a_(Blocks.TRAPPED_CHEST); + func_240522_a_(CHESTS_WOODEN).func_240534_a_(Blocks.CHEST, Blocks.TRAPPED_CHEST); + func_240522_a_(COBBLESTONE).func_240534_a_(Blocks.COBBLESTONE, Blocks.INFESTED_COBBLESTONE, Blocks.MOSSY_COBBLESTONE); + func_240522_a_(DIRT).func_240534_a_(Blocks.DIRT, Blocks.GRASS_BLOCK, Blocks.COARSE_DIRT, Blocks.PODZOL, Blocks.MYCELIUM); + func_240522_a_(END_STONES).func_240534_a_(Blocks.END_STONE); + func_240522_a_(FENCE_GATES).addTags(FENCE_GATES_WOODEN); + func_240522_a_(FENCE_GATES_WOODEN).func_240534_a_(Blocks.OAK_FENCE_GATE, Blocks.SPRUCE_FENCE_GATE, Blocks.BIRCH_FENCE_GATE, Blocks.JUNGLE_FENCE_GATE, Blocks.ACACIA_FENCE_GATE, Blocks.DARK_OAK_FENCE_GATE); + func_240522_a_(FENCES).addTags(FENCES_NETHER_BRICK, FENCES_WOODEN); + func_240522_a_(FENCES_NETHER_BRICK).func_240534_a_(Blocks.NETHER_BRICK_FENCE); + func_240522_a_(FENCES_WOODEN).func_240534_a_(Blocks.OAK_FENCE, Blocks.SPRUCE_FENCE, Blocks.BIRCH_FENCE, Blocks.JUNGLE_FENCE, Blocks.ACACIA_FENCE, Blocks.DARK_OAK_FENCE); + func_240522_a_(GLASS).addTags(GLASS_COLORLESS, STAINED_GLASS); + func_240522_a_(GLASS_COLORLESS).func_240534_a_(Blocks.GLASS); + addColored(func_240522_a_(STAINED_GLASS)::func_240534_a_, GLASS, "{color}_stained_glass"); + func_240522_a_(GLASS_PANES).addTags(GLASS_PANES_COLORLESS, STAINED_GLASS_PANES); + func_240522_a_(GLASS_PANES_COLORLESS).func_240534_a_(Blocks.GLASS_PANE); + addColored(func_240522_a_(STAINED_GLASS_PANES)::func_240534_a_, GLASS_PANES, "{color}_stained_glass_pane"); + func_240522_a_(GRAVEL).func_240534_a_(Blocks.GRAVEL); + func_240522_a_(NETHERRACK).func_240534_a_(Blocks.NETHERRACK); + func_240522_a_(OBSIDIAN).func_240534_a_(Blocks.OBSIDIAN); + func_240522_a_(ORES).addTags(ORES_COAL, ORES_DIAMOND, ORES_EMERALD, ORES_GOLD, ORES_IRON, ORES_LAPIS, ORES_REDSTONE, ORES_QUARTZ); + func_240522_a_(ORES_COAL).func_240534_a_(Blocks.COAL_ORE); + func_240522_a_(ORES_DIAMOND).func_240534_a_(Blocks.DIAMOND_ORE); + func_240522_a_(ORES_EMERALD).func_240534_a_(Blocks.EMERALD_ORE); + func_240522_a_(ORES_GOLD).func_240534_a_(Blocks.GOLD_ORE); + func_240522_a_(ORES_IRON).func_240534_a_(Blocks.IRON_ORE); + func_240522_a_(ORES_LAPIS).func_240534_a_(Blocks.LAPIS_ORE); + func_240522_a_(ORES_QUARTZ).func_240534_a_(Blocks.NETHER_QUARTZ_ORE); + func_240522_a_(ORES_REDSTONE).func_240534_a_(Blocks.REDSTONE_ORE); + func_240522_a_(SAND).addTags(SAND_COLORLESS, SAND_RED); + func_240522_a_(SAND_COLORLESS).func_240534_a_(Blocks.SAND); + func_240522_a_(SAND_RED).func_240534_a_(Blocks.RED_SAND); + func_240522_a_(SANDSTONE).func_240534_a_(Blocks.SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE); + func_240522_a_(STONE).func_240534_a_(Blocks.ANDESITE, Blocks.DIORITE, Blocks.GRANITE, Blocks.INFESTED_STONE, Blocks.STONE, Blocks.POLISHED_ANDESITE, Blocks.POLISHED_DIORITE, Blocks.POLISHED_GRANITE); + func_240522_a_(STORAGE_BLOCKS).addTags(STORAGE_BLOCKS_COAL, STORAGE_BLOCKS_DIAMOND, STORAGE_BLOCKS_EMERALD, STORAGE_BLOCKS_GOLD, STORAGE_BLOCKS_IRON, STORAGE_BLOCKS_LAPIS, STORAGE_BLOCKS_QUARTZ, STORAGE_BLOCKS_REDSTONE); + func_240522_a_(STORAGE_BLOCKS_COAL).func_240534_a_(Blocks.COAL_BLOCK); + func_240522_a_(STORAGE_BLOCKS_DIAMOND).func_240534_a_(Blocks.DIAMOND_BLOCK); + func_240522_a_(STORAGE_BLOCKS_EMERALD).func_240534_a_(Blocks.EMERALD_BLOCK); + func_240522_a_(STORAGE_BLOCKS_GOLD).func_240534_a_(Blocks.GOLD_BLOCK); + func_240522_a_(STORAGE_BLOCKS_IRON).func_240534_a_(Blocks.IRON_BLOCK); + func_240522_a_(STORAGE_BLOCKS_LAPIS).func_240534_a_(Blocks.LAPIS_BLOCK); + func_240522_a_(STORAGE_BLOCKS_QUARTZ).func_240534_a_(Blocks.QUARTZ_BLOCK); + func_240522_a_(STORAGE_BLOCKS_REDSTONE).func_240534_a_(Blocks.REDSTONE_BLOCK); } - private void addColored(Consumer consumer, Tag group, String pattern) + private void addColored(Consumer consumer, ITag.INamedTag group, String pattern) { - String prefix = group.getId().getPath().toUpperCase(Locale.ENGLISH) + '_'; + String prefix = group.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getTranslationKey())); - Tag tag = getForgeTag(prefix + color.getTranslationKey()); + ITag.INamedTag tag = getForgeTag(prefix + color.getTranslationKey()); Block block = ForgeRegistries.BLOCKS.getValue(key); if (block == null || block == Blocks.AIR) throw new IllegalStateException("Unknown vanilla block: " + key.toString()); - getBuilder(tag).add(block); + func_240522_a_(tag).func_240534_a_(block); consumer.accept(block); } } @SuppressWarnings("unchecked") - private Tag getForgeTag(String name) + private ITag.INamedTag getForgeTag(String name) { try { name = name.toUpperCase(Locale.ENGLISH); - return (Tag)Tags.Blocks.class.getDeclaredField(name).get(null); + return (ITag.INamedTag)Tags.Blocks.class.getDeclaredField(name).get(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { diff --git a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java index 071360803..2db6762f9 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java @@ -1,6 +1,6 @@ /* * Minecraft Forge - * Copyright (c) 2016-2019. + * func_240521_a_right (c) 2016-2019. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -12,7 +12,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public + * You should have received a func_240521_a_ of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -26,11 +26,13 @@ import java.util.function.Consumer; import java.util.stream.Collectors; import net.minecraft.block.Block; +import net.minecraft.data.BlockTagsProvider; import net.minecraft.data.DataGenerator; import net.minecraft.data.ItemTagsProvider; import net.minecraft.item.DyeColor; import net.minecraft.item.Item; import net.minecraft.item.Items; +import net.minecraft.tags.ITag; import net.minecraft.tags.Tag; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.Tags; @@ -40,16 +42,16 @@ public class ForgeItemTagsProvider extends ItemTagsProvider { private Set filter = null; - public ForgeItemTagsProvider(DataGenerator gen) + public ForgeItemTagsProvider(DataGenerator gen, BlockTagsProvider blockTagProvider) { - super(gen); + super(gen, blockTagProvider); } @Override public void registerTags() { super.registerTags(); - filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey().getId()).collect(Collectors.toSet()); + filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toSet()); func_240522_a_(Tags.Items.ARROWS).func_240534_a_(Items.ARROW, Items.TIPPED_ARROW, Items.SPECTRAL_ARROW); func_240522_a_(Tags.Items.BEACON_PAYMENT).func_240534_a_(Items.EMERALD, Items.DIAMOND, Items.GOLD_INGOT, Items.IRON_INGOT); @@ -128,7 +130,6 @@ public class ForgeItemTagsProvider extends ItemTagsProvider func_240522_a_(Tags.Items.SEEDS_MELON).func_240534_a_(Items.MELON_SEEDS); func_240522_a_(Tags.Items.SEEDS_PUMPKIN).func_240534_a_(Items.PUMPKIN_SEEDS); func_240522_a_(Tags.Items.SEEDS_WHEAT).func_240534_a_(Items.WHEAT_SEEDS); - func_240522_a_(Tags.Items.SHEARS).func_240534_a_(Items.SHEARS); func_240522_a_(Tags.Items.SLIMEBALLS).func_240534_a_(Items.SLIME_BALL); func_240521_a_(Tags.Blocks.STAINED_GLASS, Tags.Items.STAINED_GLASS); func_240521_a_(Tags.Blocks.STAINED_GLASS_PANES, Tags.Items.STAINED_GLASS_PANES); @@ -145,41 +146,41 @@ public class ForgeItemTagsProvider extends ItemTagsProvider func_240522_a_(Tags.Items.STRING).func_240534_a_(Items.STRING); } - private void addColored(Consumer> consumer, Tag group, String pattern) + private void addColored(Consumer> consumer, ITag.INamedTag group, String pattern) { - String prefix = group.getId().getPath().toUpperCase(Locale.ENGLISH) + '_'; + String prefix = group.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getTranslationKey())); - Tag tag = getForgeItemTag(prefix + color.getTranslationKey()); + ITag.INamedTag tag = getForgeItemTag(prefix + color.getTranslationKey()); Item item = ForgeRegistries.ITEMS.getValue(key); if (item == null || item == Items.AIR) throw new IllegalStateException("Unknown vanilla item: " + key.toString()); - getBuilder(tag).add(item); + func_240522_a_(tag).func_240534_a_(item); consumer.accept(tag); } } - private void copyColored(Tag blockGroup, Tag itemGroup) + private void func_240521_a_Colored(ITag.INamedTag blockGroup, ITag.INamedTag itemGroup) { - String blockPre = blockGroup.getId().getPath().toUpperCase(Locale.ENGLISH) + '_'; - String itemPre = itemGroup.getId().getPath().toUpperCase(Locale.ENGLISH) + '_'; + String blockPre = blockGroup.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_'; + String itemPre = itemGroup.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { - Tag from = getForgeBlockTag(blockPre + color.getTranslationKey()); - Tag to = getForgeItemTag(itemPre + color.getTranslationKey()); - copy(from, to); + ITag.INamedTag from = getForgeBlockTag(blockPre + color.getTranslationKey()); + ITag.INamedTag to = getForgeItemTag(itemPre + color.getTranslationKey()); + func_240521_a_(from, to); } - copy(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless")); + func_240521_a_(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless")); } @SuppressWarnings("unchecked") - private Tag getForgeBlockTag(String name) + private ITag.INamedTag getForgeBlockTag(String name) { try { name = name.toUpperCase(Locale.ENGLISH); - return (Tag)Tags.Blocks.class.getDeclaredField(name).get(null); + return (ITag.INamedTag)Tags.Blocks.class.getDeclaredField(name).get(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { @@ -188,12 +189,12 @@ public class ForgeItemTagsProvider extends ItemTagsProvider } @SuppressWarnings("unchecked") - private Tag getForgeItemTag(String name) + private ITag.INamedTag getForgeItemTag(String name) { try { name = name.toUpperCase(Locale.ENGLISH); - return (Tag)Tags.Items.class.getDeclaredField(name).get(null); + return (ITag.INamedTag)Tags.Items.class.getDeclaredField(name).get(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { diff --git a/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java index 5381bb71a..80290c590 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java @@ -45,6 +45,7 @@ import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient.IItemList; import net.minecraft.item.crafting.Ingredient.TagList; import net.minecraft.item.crafting.Ingredient.SingleItemList; +import net.minecraft.tags.ITag; import net.minecraft.tags.Tag; import net.minecraft.util.IItemProvider; import net.minecraft.util.ResourceLocation; @@ -52,7 +53,7 @@ import net.minecraftforge.common.Tags; public class ForgeRecipeProvider extends RecipeProvider { - private Map> replacements = new HashMap<>(); + private Map> replacements = new HashMap<>(); private Set excludes = new HashSet<>(); public ForgeRecipeProvider(DataGenerator generatorIn) @@ -65,7 +66,7 @@ public class ForgeRecipeProvider extends RecipeProvider excludes.add(item.asItem().getRegistryName()); } - private void replace(IItemProvider item, Tag tag) + private void replace(IItemProvider item, ITag tag) { replacements.put(item.asItem(), tag); } @@ -158,7 +159,7 @@ public class ForgeRecipeProvider extends RecipeProvider if (entry instanceof SingleItemList) { ItemStack stack = entry.getStacks().stream().findFirst().orElse(ItemStack.EMPTY); - Tag replacement = replacements.get(stack.getItem()); + ITag replacement = replacements.get(stack.getItem()); if (replacement != null) { items.add(new TagList(replacement)); diff --git a/src/main/java/net/minecraftforge/common/data/IOptionalTagEntry.java b/src/main/java/net/minecraftforge/common/data/IOptionalTagEntry.java index 1cb4edaf7..a13085b14 100644 --- a/src/main/java/net/minecraftforge/common/data/IOptionalTagEntry.java +++ b/src/main/java/net/minecraftforge/common/data/IOptionalTagEntry.java @@ -17,11 +17,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.common.data; +//package net.minecraftforge.common.data; -import net.minecraft.tags.Tag.ITagEntry; +//import net.minecraft.tags.Tag.ITagEntry; /** * Marker class used by Forge to make a tag entry optional at runtime */ -public interface IOptionalTagEntry extends ITagEntry {} +//public interface IOptionalTagEntry extends ITagEntry {} diff --git a/src/main/java/net/minecraftforge/common/extensions/IAbstractRailBlock.java b/src/main/java/net/minecraftforge/common/extensions/IAbstractRailBlock.java new file mode 100644 index 000000000..5d1dabf6b --- /dev/null +++ b/src/main/java/net/minecraftforge/common/extensions/IAbstractRailBlock.java @@ -0,0 +1,76 @@ +package net.minecraftforge.common.extensions; + +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.BlockState; +import net.minecraft.entity.item.minecart.AbstractMinecartEntity; +import net.minecraft.state.properties.RailShape; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; + +import javax.annotation.Nullable; + +public interface IAbstractRailBlock +{ + + default AbstractBlock getAbstractBlock() + { + return (AbstractBlock)this; + } + + /** + * 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. + */ + boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos); + + /** + * 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. + */ + default 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. + */ + RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @Nullable AbstractMinecartEntity cart); + + /** + * 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. + */ + default 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 + */ + default void onMinecartPass(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart){} +} diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java index a4b76b738..8c7e93529 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java @@ -26,18 +26,8 @@ import java.util.function.Predicate; import javax.annotation.Nullable; -import net.minecraft.block.Block; -import net.minecraft.block.BedBlock; -import net.minecraft.block.FarmlandBlock; -import net.minecraft.block.FenceGateBlock; -import net.minecraft.block.FireBlock; -import net.minecraft.block.HorizontalBlock; -import net.minecraft.block.IBeaconBeamColorProvider; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.SoundType; -import net.minecraft.block.StainedGlassBlock; +import net.minecraft.block.*; import net.minecraft.block.material.Material; -import net.minecraft.block.BlockState; import net.minecraft.client.particle.ParticleManager; import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.enchantment.EnchantmentHelper; @@ -50,13 +40,12 @@ import net.minecraft.entity.boss.dragon.EnderDragonEntity; import net.minecraft.entity.boss.WitherEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.WitherSkullEntity; -import net.minecraft.fluid.IFluidState; -import net.minecraft.block.Blocks; +import net.minecraft.fluid.FluidState; import net.minecraft.potion.Effects; import net.minecraft.item.DyeColor; import net.minecraft.item.ItemStack; import net.minecraft.pathfinding.PathNodeType; -import net.minecraft.state.IProperty; +import net.minecraft.state.Property; import net.minecraft.state.properties.BedPart; import net.minecraft.tags.BlockTags; import net.minecraft.tileentity.TileEntity; @@ -66,20 +55,14 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.ILightReader; -import net.minecraft.world.IWorld; -import net.minecraft.world.IWorldReader; -import net.minecraft.world.IWorldWriter; -import net.minecraft.world.World; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.world.*; import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.dimension.EndDimension; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.IPlantable; +import net.minecraftforge.common.Tags; import net.minecraftforge.common.ToolType; @SuppressWarnings("deprecation") @@ -212,7 +195,7 @@ public interface IForgeBlock * @param fluid The current fluid state at current position * @return True if the block is actually destroyed. */ - default boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid) + default boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid) { getBlock().onBlockHarvested(world, pos, state, player); return world.setBlockState(pos, fluid.getBlockState(), world.isRemote ? 11 : 3); @@ -259,7 +242,7 @@ public interface IForgeBlock * @param sleeper The sleeper or camera entity, null in some cases. * @return The spawn position */ - default Optional getBedSpawnPosition(EntityType entityType, BlockState state, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper) + default Optional getBedSpawnPosition(EntityType entityType, BlockState state, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper) { if (world instanceof World) { @@ -347,7 +330,7 @@ public interface IForgeBlock */ default boolean canBeReplacedByLeaves(BlockState state, IWorldReader world, BlockPos pos) { - return isAir(state, world, pos) || state.isIn(BlockTags.LEAVES); + return isAir(state, world, pos) || state.func_235714_a_(BlockTags.LEAVES); } /** @@ -360,7 +343,7 @@ public interface IForgeBlock */ default boolean canBeReplacedByLogs(BlockState state, IWorldReader world, BlockPos pos) { - return (isAir(state, world, pos) || state.isIn(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT) + return (isAir(state, world, pos) || state.func_235714_a_(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || state.func_235714_a_(Tags.Blocks.DIRT) || getBlock().isIn(BlockTags.LOGS) || getBlock().isIn(BlockTags.SAPLINGS) || this == Blocks.VINE; } @@ -536,7 +519,7 @@ public interface IForgeBlock */ default void onPlantGrow(BlockState state, IWorld world, BlockPos pos, BlockPos source) { - if (state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT)) + if (state.func_235714_a_(Tags.Blocks.DIRT)) world.setBlockState(pos, Blocks.DIRT.getDefaultState(), 2); } @@ -632,7 +615,7 @@ public interface IForgeBlock @Nullable default Direction[] getValidRotations(BlockState state, IBlockReader world, BlockPos pos) { - for (IProperty prop : state.getProperties()) + for (Property prop : state.func_235904_r_()) { if ((prop.getName().equals("facing") || prop.getName().equals("rotation")) && prop.getValueClass() == Direction.class) { @@ -668,14 +651,14 @@ public interface IForgeBlock @SuppressWarnings("unchecked") default boolean recolorBlock(BlockState state, IWorld world, BlockPos pos, Direction facing, DyeColor color) { - for (IProperty prop : state.getProperties()) + for (Property prop : state.func_235904_r_()) { if (prop.getName().equals("color") && prop.getValueClass() == DyeColor.class) { DyeColor current = (DyeColor)state.get(prop); if (current != color && prop.getAllowedValues().contains(color)) { - world.setBlockState(pos, state.with(((IProperty)prop), color), 3); + world.setBlockState(pos, state.with(((Property)prop), color), 3); return true; } } @@ -801,7 +784,7 @@ public interface IForgeBlock * @return The new fog color. */ @OnlyIn(Dist.CLIENT) - default Vec3d getFogColor(BlockState state, IWorldReader world, BlockPos pos, Entity entity, Vec3d originalColor, float partialTicks) + default Vector3d getFogColor(BlockState state, IWorldReader world, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks) { if (state.getMaterial() == Material.WATER) { @@ -817,11 +800,11 @@ public interface IForgeBlock f12 = f12 * 0.3F + 0.6F; } } - return new Vec3d(0.02F + f12, 0.02F + f12, 0.2F + f12); + return new Vector3d(0.02F + f12, 0.02F + f12, 0.2F + f12); } else if (state.getMaterial() == Material.LAVA) { - return new Vec3d(0.6F, 0.1F, 0.0F); + return new Vector3d(0.6F, 0.1F, 0.0F); } return originalColor; } @@ -837,7 +820,7 @@ public interface IForgeBlock * @param viewpoint the viewpoint * @return the block state that should be 'seen' */ - default BlockState getStateAtViewpoint(BlockState state, IBlockReader world, BlockPos pos, Vec3d viewpoint) + default BlockState getStateAtViewpoint(BlockState state, IBlockReader world, BlockPos pos, Vector3d viewpoint) { return state; } @@ -983,15 +966,9 @@ public interface IForgeBlock * @param side The face that the fire is coming from * @return True if this block sustains fire, meaning it will never go out. */ - default boolean isFireSource(BlockState state, IBlockReader world, BlockPos pos, Direction side) + default boolean isFireSource(BlockState state, IWorldReader world, BlockPos pos, Direction side) { - if (side != Direction.UP) - return false; - if (getBlock() == Blocks.NETHERRACK || getBlock() == Blocks.MAGMA_BLOCK) - return true; - if (world instanceof IWorldReader && ((IWorldReader)world).getDimension() instanceof EndDimension && getBlock() == Blocks.BEDROCK) - return true; - return false; + return state.func_235714_a_(world.func_230315_m_().func_241515_q_()); } /** @@ -1006,7 +983,7 @@ public interface IForgeBlock { if (entity instanceof EnderDragonEntity) { - return !BlockTags.DRAGON_IMMUNE.contains(this.getBlock()); + return !BlockTags.DRAGON_IMMUNE.func_230235_a_(this.getBlock()); } else if ((entity instanceof WitherEntity) || (entity instanceof WitherSkullEntity)) @@ -1029,7 +1006,7 @@ public interface IForgeBlock * @return A result that suits your block */ @Nullable - default RayTraceResult getRayTraceResult(BlockState state, World world, BlockPos pos, Vec3d start, Vec3d end, RayTraceResult original) + default RayTraceResult getRayTraceResult(BlockState state, World world, BlockPos pos, Vector3d start, Vector3d end, RayTraceResult original) { return original; } @@ -1081,8 +1058,8 @@ public interface IForgeBlock * @param fluidState The state of the fluid * @return Whether the fluid overlay texture should be used */ - default boolean shouldDisplayFluidOverlay(BlockState state, ILightReader world, BlockPos pos, IFluidState fluidState) + default boolean shouldDisplayFluidOverlay(BlockState state, IBlockDisplayReader world, BlockPos pos, FluidState fluidState) { - return state.getBlock() == Blocks.GLASS || state.getBlock() instanceof StainedGlassBlock; + return state.getBlock() instanceof BreakableBlock || state.getBlock() instanceof StainedGlassBlock; } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java index 6d3d3a103..5c0c4cc1b 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java @@ -26,14 +26,13 @@ import javax.annotation.Nullable; import net.minecraft.block.*; import net.minecraft.client.particle.ParticleManager; -import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.entity.Entity; import net.minecraft.entity.MobEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.EntitySpawnPlacementRegistry.PlacementType; import net.minecraft.entity.EntityType; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.item.DyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -42,13 +41,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.ILightReader; -import net.minecraft.world.IWorld; -import net.minecraft.world.IWorldReader; -import net.minecraft.world.World; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.world.*; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -162,7 +156,7 @@ public interface IForgeBlockState * @param fluid The current fluid and block state for the position in the world. * @return True if the block is actually destroyed. */ - default boolean removedByPlayer(World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid) + default boolean removedByPlayer(World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid) { return getBlockState().getBlock().removedByPlayer(getBlockState(), world, pos, player, willHarvest, fluid); } @@ -204,7 +198,7 @@ public interface IForgeBlockState * @param sleeper The sleeper or camera entity, null in some cases. * @return The spawn position */ - default Optional getBedSpawnPosition(EntityType type, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper) + default Optional getBedSpawnPosition(EntityType type, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper) { return getBlockState().getBlock().getBedSpawnPosition(type, getBlockState(), world, pos, sleeper); } @@ -673,7 +667,7 @@ public interface IForgeBlockState * @return The new fog color. */ @OnlyIn(Dist.CLIENT) - default Vec3d getFogColor(IWorldReader world, BlockPos pos, Entity entity, Vec3d originalColor, float partialTicks) + default Vector3d getFogColor(IWorldReader world, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks) { return getBlockState().getBlock().getFogColor(getBlockState(), world, pos, entity, originalColor, partialTicks); } @@ -688,7 +682,7 @@ public interface IForgeBlockState * @param viewpoint the viewpoint * @return the block state that should be 'seen' */ - default BlockState getStateAtViewpoint(IBlockReader world, BlockPos pos, Vec3d viewpoint) + default BlockState getStateAtViewpoint(IBlockReader world, BlockPos pos, Vector3d viewpoint) { return getBlockState().getBlock().getStateAtViewpoint(getBlockState(), world, pos, viewpoint); } @@ -816,7 +810,7 @@ public interface IForgeBlockState * @param side The face that the fire is coming from * @return True if this block sustains fire, meaning it will never go out. */ - default boolean isFireSource(IBlockReader world, BlockPos pos, Direction side) + default boolean isFireSource(IWorldReader world, BlockPos pos, Direction side) { return getBlockState().getBlock().isFireSource(getBlockState(), world, pos, side); } @@ -920,7 +914,7 @@ public interface IForgeBlockState * @param fluidState The state of the fluid * @return Whether the fluid overlay texture should be used */ - default boolean shouldDisplayFluidOverlay(ILightReader world, BlockPos pos, IFluidState fluidState) + default boolean shouldDisplayFluidOverlay(IBlockDisplayReader world, BlockPos pos, FluidState fluidState) { return getBlockState().getBlock().shouldDisplayFluidOverlay(getBlockState(), world, pos, fluidState); } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java b/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java index a9bad6f69..f2e117849 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.common.extensions; +/*package net.minecraftforge.common.extensions; import javax.annotation.Nullable; @@ -59,7 +59,7 @@ public interface IForgeDimension * always called before the world load event. * * @return initial holder for capabilities on the world - */ + * / default net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities() { return null; @@ -73,7 +73,7 @@ public interface IForgeDimension * to nether multiplies coordinates by 1/8. * * @return The movement factor - */ + * / default double getMovementFactor() { if (getDimension() instanceof NetherDimension) @@ -115,7 +115,7 @@ public interface IForgeDimension * @param colors The color values that will be used: [r, g, b]. * * @see net.minecraft.client.renderer.GameRenderer#updateLightmap(float) - */ + * / default void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, Vector3f colors) {} void resetRainAndThunder(); @@ -134,7 +134,7 @@ public interface IForgeDimension * Called on the client to get the music type to play when in this world type. * At the time of calling, the client player and world are guaranteed to be non-null * @return null to use vanilla logic, otherwise a MusicType to play in this world - */ + * / @Nullable @OnlyIn(Dist.CLIENT) default MusicTicker.MusicType getMusicType() @@ -148,7 +148,7 @@ public interface IForgeDimension * @param player The player that is attempting to sleep * @param pos The location where the player tries to sleep at (the position of the clicked on bed for example) * @return the result of a player trying to sleep at the given location - */ + * / default SleepResult canSleepAt(net.minecraft.entity.player.PlayerEntity player, BlockPos pos) { return (getDimension().canRespawnHere() && getWorld().getBiome(pos) != Biomes.NETHER) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES; @@ -170,7 +170,7 @@ public interface IForgeDimension * Calculates the current moon phase factor. * This factor is effective for slimes. * (This method do not affect the moon rendering) - * */ + * * / default float getCurrentMoonPhaseFactor(long time) { return Dimension.MOON_PHASE_FACTORS[this.getDimension().getMoonPhase(time)]; @@ -247,7 +247,7 @@ public interface IForgeDimension * @param z Z Position * @param rotation the regular rotation of the marker * @return True to 'spin' the cursor - */ + * / default boolean shouldMapSpin(String entity, double x, double z, double rotation) { return getDimension().getType() == DimensionType.THE_NETHER; @@ -258,9 +258,9 @@ public interface IForgeDimension * * @param player The player that is respawning * @return The dimension to respawn the player in - */ + * / default DimensionType getRespawnDimension(ServerPlayerEntity player) { return player.getSpawnDimension(); } -} +}*/ diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeEffect.java b/src/main/java/net/minecraftforge/common/extensions/IForgeEffect.java index 7475463fe..182fa244a 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeEffect.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeEffect.java @@ -22,6 +22,7 @@ package net.minecraftforge.common.extensions; import java.util.ArrayList; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.DisplayEffectsScreen; import net.minecraft.item.ItemStack; @@ -64,25 +65,27 @@ public interface IForgeEffect { * * @param effect the active PotionEffect * @param gui the gui instance + * @param mStack The MatrixStack * @param x the x coordinate * @param y the y coordinate * @param z the z level */ @OnlyIn(Dist.CLIENT) - default void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen gui, int x, int y, float z) { } + default void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen gui, MatrixStack mStack, 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 mStack The MatrixStack * @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) - default void renderHUDEffect(EffectInstance effect, AbstractGui gui, int x, int y, float z, float alpha) { } + default void renderHUDEffect(EffectInstance effect, AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { } /** * Get a fresh list of items that can cure this Potion. diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeEffectInstance.java b/src/main/java/net/minecraftforge/common/extensions/IForgeEffectInstance.java index b680673ea..e83bbba67 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeEffectInstance.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeEffectInstance.java @@ -21,6 +21,7 @@ package net.minecraftforge.common.extensions; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.DisplayEffectsScreen; import net.minecraft.item.ItemStack; @@ -66,13 +67,14 @@ public interface IForgeEffectInstance { * This can be used to e.g. render Potion icons from your own texture. * * @param gui the gui instance + * @param mStack The MatrixStack * @param x the x coordinate * @param y the y coordinate * @param z the z level */ @OnlyIn(Dist.CLIENT) - default void renderInventoryEffect(DisplayEffectsScreen gui, int x, int y, float z) { - getEffectInstance().getPotion().renderInventoryEffect(getEffectInstance(), gui, x, y, z); + default void renderInventoryEffect(DisplayEffectsScreen gui, MatrixStack mStack, int x, int y, float z) { + getEffectInstance().getPotion().renderInventoryEffect(getEffectInstance(), gui, mStack, x, y, z); } /** @@ -80,14 +82,15 @@ public interface IForgeEffectInstance { * This can be used to e.g. render Potion icons from your own texture. * * @param gui the gui instance + * @param mStack The MatrixStack * @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) - default void renderHUDEffect(AbstractGui gui, int x, int y, float z, float alpha) { - getEffectInstance().getPotion().renderHUDEffect(getEffectInstance(), gui, x, y, z, alpha); + default void renderHUDEffect(AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { + getEffectInstance().getPotion().renderHUDEffect(getEffectInstance(), gui, mStack, x, y, z, alpha); } /*** diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeEntityMinecart.java b/src/main/java/net/minecraftforge/common/extensions/IForgeEntityMinecart.java index 4bf6901d2..a2756e41e 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeEntityMinecart.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeEntityMinecart.java @@ -56,7 +56,7 @@ public interface IForgeEntityMinecart int y = MathHelper.floor(getMinecart().getPosY()); int z = MathHelper.floor(getMinecart().getPosZ()); BlockPos pos = new BlockPos(x, y - 1, z); - if (getMinecart().world.getBlockState(pos).isIn(BlockTags.RAILS)) pos = pos.down(); + if (getMinecart().world.getBlockState(pos).func_235714_a_(BlockTags.RAILS)) pos = pos.down(); return pos; } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java b/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java index 92bf59e6d..55c2022e9 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java @@ -27,7 +27,7 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.entity.Entity; import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.tags.Tag; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; @@ -54,7 +54,7 @@ public interface IForgeFluid * @param tag Fluid category * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment. */ - default boolean isEntityInside(IFluidState state, IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag tag, boolean testingHead) + default boolean isEntityInside(FluidState state, IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag tag, boolean testingHead) { return state.isTagged(tag) && yToTest < (double)(pos.getY() + state.getActualHeight(world, pos) + 0.11111111F); } @@ -70,7 +70,7 @@ public interface IForgeFluid * @return null for default behavior, true if the box is within the material, false if it was not. */ @Nullable - default Boolean isAABBInsideMaterial(IFluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn) + default Boolean isAABBInsideMaterial(FluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn) { return null; } @@ -84,7 +84,7 @@ public interface IForgeFluid * @return null for default behavior, true if the box is within the material, false if it was not. */ @Nullable - default Boolean isAABBInsideLiquid(IFluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox) + default Boolean isAABBInsideLiquid(FluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox) { return null; } @@ -98,7 +98,7 @@ public interface IForgeFluid * @param explosion The explosion * @return The amount of the explosion absorbed. */ - default float getExplosionResistance(IFluidState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion) + default float getExplosionResistance(FluidState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion) { return state.getExplosionResistance(); } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java index 799a47acf..fa8d84a8d 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java @@ -24,7 +24,7 @@ import javax.annotation.Nullable; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.entity.Entity; import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.tags.Tag; import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; @@ -32,9 +32,9 @@ import net.minecraft.world.IWorldReader; public interface IForgeFluidState { - default IFluidState getFluidState() + default FluidState getFluidState() { - return (IFluidState)this; + return (FluidState)this; } /** @@ -45,7 +45,7 @@ public interface IForgeFluidState * @param pos position thats being tested. * @param entity that is being tested. * @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height. - * @param material to test for. + * @param tag to test for. * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment. */ default boolean isEntityInside(IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag tag, boolean testingHead) diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java index 560626c6e..82520283c 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java @@ -33,6 +33,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.MobEntity; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.ai.attributes.Attribute; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.player.PlayerEntity; @@ -48,6 +49,8 @@ import net.minecraft.util.ActionResultType; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.IFormattableTextComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -68,7 +71,7 @@ public interface IForgeItem * ItemStack sensitive version of getItemAttributeModifiers */ @SuppressWarnings("deprecation") - default Multimap getAttributeModifiers(EquipmentSlotType slot, ItemStack stack) + default Multimap getAttributeModifiers(EquipmentSlotType slot, ItemStack stack) { return getItem().getAttributeModifiers(slot); } @@ -95,7 +98,7 @@ public interface IForgeItem * @param displayName the name that will be displayed unless it is changed in * this method. */ - default String getHighlightTip(ItemStack item, String displayName) + default ITextComponent getHighlightTip(ItemStack item, ITextComponent displayName) { return displayName; } @@ -616,7 +619,7 @@ public interface IForgeItem */ default boolean isBeaconPayment(ItemStack stack) { - return Tags.Items.BEACON_PAYMENT.contains(stack.getItem()); + return Tags.Items.BEACON_PAYMENT.func_230235_a_(stack.getItem()); } /** @@ -703,12 +706,13 @@ public interface IForgeItem return null; } - default ImmutableMap getAnimationParameters(final ItemStack stack, final World world, final LivingEntity entity) - { - com.google.common.collect.ImmutableMap.Builder builder = ImmutableMap.builder(); - getItem().properties.forEach((k,v) -> builder.put(k.toString(), input -> v.call(stack, world, entity))); - return builder.build(); - } + //TODO, properties dont exist anymore +// default ImmutableMap getAnimationParameters(final ItemStack stack, final World world, final LivingEntity entity) +// { +// com.google.common.collect.ImmutableMap.Builder builder = ImmutableMap.builder(); +// getItem().properties.forEach((k,v) -> builder.put(k.toString(), input -> v.call(stack, world, entity))); +// return builder.build(); +// } /** * Can this Item disable a shield diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java index 8913a6599..c545d76ad 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java @@ -39,6 +39,8 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.stats.Stats; import net.minecraft.util.ActionResultType; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.IFormattableTextComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import net.minecraftforge.common.ToolType; import net.minecraftforge.common.capabilities.ICapabilitySerializable; @@ -358,7 +360,7 @@ public interface IForgeItemStack extends ICapabilitySerializable * @param displayName the name that will be displayed unless it is changed in * this method. */ - default String getHighlightTip(String displayName) + default ITextComponent getHighlightTip(ITextComponent displayName) { return getStack().getItem().getHighlightTip(getStack(), displayName); } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeTagBuilder.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTagBuilder.java index b8c977f59..7d78dbc36 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeTagBuilder.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTagBuilder.java @@ -19,24 +19,25 @@ package net.minecraftforge.common.extensions; -import java.util.Arrays; -import java.util.Collection; -import java.util.Optional; -import java.util.function.Function; - -import javax.annotation.Nonnull; - -import com.google.gson.JsonArray; - -import net.minecraft.tags.Tag; -import net.minecraft.tags.TagCollection; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.data.IOptionalTagEntry; +import net.minecraft.data.TagsProvider; +import net.minecraft.tags.ITag; public interface IForgeTagBuilder { - default Tag.Builder addOptional(final TagCollection collection, final ResourceLocation... locations) + default TagsProvider.Builder getBuilder() { + return (TagsProvider.Builder) this; + } + + default TagsProvider.Builder addTags(ITag.INamedTag... values) { + TagsProvider.Builder builder = getBuilder(); + for (ITag.INamedTag value : values) { + builder.func_240531_a_(value); + } + return builder; + } + + /*default Tag.Builder addOptional(final TagCollection collection, final ResourceLocation... locations) { return addOptional(collection, Arrays.asList(locations)); } @@ -104,5 +105,5 @@ public interface IForgeTagBuilder }; return ((Tag.Builder)this).add(new TagTarget<>(tag)); - } + }*/ } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java index 0e4ac8e2f..43b54dc2a 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java @@ -43,7 +43,14 @@ public interface IForgeTileEntity extends ICapabilitySerializable @Override default void deserializeNBT(CompoundNBT nbt) { - getTileEntity().read(nbt); + //TODO re-evaluate + deserializeNBT(null, nbt); + } + + // @Override TODO re-evaluate + default void deserializeNBT(BlockState state, CompoundNBT nbt) + { + getTileEntity().func_230337_a_(state, nbt); } @Override @@ -72,9 +79,9 @@ public interface IForgeTileEntity extends ICapabilitySerializable * * @param tag The {@link NBTTagCompound} sent from {@link #getUpdateTag()} */ - default void handleUpdateTag(CompoundNBT tag) + default void handleUpdateTag(BlockState state, CompoundNBT tag) { - getTileEntity().read(tag); + getTileEntity().func_230337_a_(state, tag); } /** diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeWorldType.java b/src/main/java/net/minecraftforge/common/extensions/IForgeWorldType.java index c6cb13c43..f2fed96be 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeWorldType.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeWorldType.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.common.extensions; +/*package net.minecraftforge.common.extensions; import java.util.function.LongFunction; @@ -50,7 +50,7 @@ public interface IForgeWorldType /** * Called when 'Create New World' button is pressed before starting game - */ + * / default void onGUICreateWorldPress() { } @@ -60,7 +60,7 @@ public interface IForgeWorldType * * @param mc The Minecraft instance * @param gui the createworld GUI - */ + * / @OnlyIn(Dist.CLIENT) default void onCustomizeButton(Minecraft mc, CreateWorldScreen gui) { @@ -89,7 +89,7 @@ public interface IForgeWorldType * Get the height to render the clouds for this world type * * @return The height to render clouds at - */ + * / default float getCloudHeight() { return 128.0F; @@ -115,7 +115,7 @@ public interface IForgeWorldType * the supplied size. * @return An {@link IAreaFactory} that representing the Biomes to be generated. * @see {@link GenLayerBiome} - */ + * / default > IAreaFactory getBiomeLayer(IAreaFactory parentLayer, OverworldGenSettings chunkSettings, LongFunction contextFactory) { @@ -125,4 +125,4 @@ public interface IForgeWorldType parentLayer = EdgeBiomeLayer.INSTANCE.apply(contextFactory.apply(1000L), parentLayer); return parentLayer; } -} +}*/ diff --git a/src/main/java/net/minecraftforge/common/loot/GlobalLootModifierSerializer.java b/src/main/java/net/minecraftforge/common/loot/GlobalLootModifierSerializer.java index aa198ff50..3ffd5700a 100644 --- a/src/main/java/net/minecraftforge/common/loot/GlobalLootModifierSerializer.java +++ b/src/main/java/net/minecraftforge/common/loot/GlobalLootModifierSerializer.java @@ -21,8 +21,8 @@ package net.minecraftforge.common.loot; import com.google.gson.JsonObject; +import net.minecraft.loot.conditions.ILootCondition; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.storage.loot.conditions.ILootCondition; import net.minecraftforge.registries.GameData; import net.minecraftforge.registries.IForgeRegistryEntry; diff --git a/src/main/java/net/minecraftforge/common/loot/IGlobalLootModifier.java b/src/main/java/net/minecraftforge/common/loot/IGlobalLootModifier.java index 17934ce07..b1b100926 100644 --- a/src/main/java/net/minecraftforge/common/loot/IGlobalLootModifier.java +++ b/src/main/java/net/minecraftforge/common/loot/IGlobalLootModifier.java @@ -24,7 +24,7 @@ import java.util.List; import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; -import net.minecraft.world.storage.loot.LootContext; +import net.minecraft.loot.LootContext; /** * Implementation that defines what a global loot modifier must implement in order to be functional. diff --git a/src/main/java/net/minecraftforge/common/loot/LootModifier.java b/src/main/java/net/minecraftforge/common/loot/LootModifier.java index 51d7af5a3..da6951020 100644 --- a/src/main/java/net/minecraftforge/common/loot/LootModifier.java +++ b/src/main/java/net/minecraftforge/common/loot/LootModifier.java @@ -25,9 +25,9 @@ import java.util.function.Predicate; import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; -import net.minecraft.world.storage.loot.LootContext; -import net.minecraft.world.storage.loot.conditions.ILootCondition; -import net.minecraft.world.storage.loot.conditions.LootConditionManager; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.loot.conditions.LootConditionManager; /** * A base implementation of a Global Loot Modifier for modders to extend. diff --git a/src/main/java/net/minecraftforge/common/loot/LootModifierManager.java b/src/main/java/net/minecraftforge/common/loot/LootModifierManager.java index fdc618420..90cbc0bd4 100644 --- a/src/main/java/net/minecraftforge/common/loot/LootModifierManager.java +++ b/src/main/java/net/minecraftforge/common/loot/LootModifierManager.java @@ -30,6 +30,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Map; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.loot.conditions.LootConditionManager; +import net.minecraft.loot.functions.ILootFunction; +import net.minecraft.loot.functions.LootFunctionManager; import org.apache.commons.io.IOUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -48,15 +52,11 @@ import net.minecraft.resources.IResource; import net.minecraft.resources.IResourceManager; import net.minecraft.util.JSONUtils; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.storage.loot.conditions.ILootCondition; -import net.minecraft.world.storage.loot.conditions.LootConditionManager; -import net.minecraft.world.storage.loot.functions.ILootFunction; -import net.minecraft.world.storage.loot.functions.LootFunctionManager; import net.minecraftforge.registries.ForgeRegistries; public class LootModifierManager extends JsonReloadListener { public static final Logger LOGGER = LogManager.getLogger(); - private static final Gson GSON_INSTANCE = (new GsonBuilder()).registerTypeHierarchyAdapter(ILootFunction.class, new LootFunctionManager.Serializer()).registerTypeHierarchyAdapter(ILootCondition.class, new LootConditionManager.Serializer()).create(); + private static final Gson GSON_INSTANCE = (new GsonBuilder()).registerTypeHierarchyAdapter(ILootFunction.class, LootFunctionManager.func_237450_a_()).registerTypeHierarchyAdapter(ILootCondition.class, LootConditionManager.func_237474_a_()).create(); private Map registeredLootModifiers = ImmutableMap.of(); private static final String folder = "loot_modifiers"; @@ -66,7 +66,7 @@ public class LootModifierManager extends JsonReloadListener { } @Override - protected void apply(Map resourceList, IResourceManager resourceManagerIn, IProfiler profilerIn) { + protected void apply(Map resourceList, IResourceManager resourceManagerIn, IProfiler profilerIn) { Builder builder = ImmutableMap.builder(); //old way (for reference) /*Map toLocation = new HashMap(); @@ -116,7 +116,8 @@ public class LootModifierManager extends JsonReloadListener { finalLocations.forEach(location -> { try { IGlobalLootModifier modifier = deserializeModifier(location, resourceList.get(location)); - builder.put(location, modifier); + if(modifier != null) + builder.put(location, modifier); } catch (Exception exception) { LOGGER.error("Couldn't parse loot modifier {}", location, exception); } @@ -125,7 +126,9 @@ public class LootModifierManager extends JsonReloadListener { this.registeredLootModifiers = immutablemap; } - private IGlobalLootModifier deserializeModifier(ResourceLocation location, JsonObject object) { + private IGlobalLootModifier deserializeModifier(ResourceLocation location, JsonElement element) { + if (!element.isJsonObject()) return null; + JsonObject object = element.getAsJsonObject(); ILootCondition[] lootConditions = GSON_INSTANCE.fromJson(object.get("conditions"), ILootCondition[].class); // For backward compatibility with the initial implementation, fall back to using the location as the type. diff --git a/src/main/java/net/minecraftforge/common/model/TransformationHelper.java b/src/main/java/net/minecraftforge/common/model/TransformationHelper.java index c35e0808c..966c555f2 100644 --- a/src/main/java/net/minecraftforge/common/model/TransformationHelper.java +++ b/src/main/java/net/minecraftforge/common/model/TransformationHelper.java @@ -23,10 +23,10 @@ import java.lang.reflect.Type; import java.util.Map; import com.google.gson.*; -import net.minecraft.client.renderer.*; import net.minecraft.util.math.MathHelper; import net.minecraft.client.renderer.model.ItemTransformVec3f; +import net.minecraft.util.math.vector.*; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; diff --git a/src/main/java/net/minecraftforge/common/model/animation/Clips.java b/src/main/java/net/minecraftforge/common/model/animation/Clips.java index 62232f7f4..78d628900 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/common/model/animation/Clips.java @@ -21,7 +21,7 @@ package net.minecraftforge.common.model.animation; import java.io.IOException; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraft.client.renderer.model.IModelTransform; import net.minecraft.client.renderer.model.IUnbakedModel; import net.minecraft.client.renderer.model.ModelResourceLocation; @@ -61,7 +61,7 @@ import javax.annotation.Nullable; public final class Clips { private static final Logger LOGGER = LogManager.getLogger(); - + /** * Clip that does nothing. */ @@ -82,7 +82,7 @@ public final class Clips } @Override - public String getName() + public String func_176610_l() { return "identity"; } @@ -416,7 +416,7 @@ public final class Clips } @Override - public String getName() + public String func_176610_l() { return clipName; } @@ -475,7 +475,7 @@ public final class Clips // IdentityClip + ClipReference if(clip instanceof IStringSerializable) { - out.value("#" + ((IStringSerializable)clip).getName()); + out.value("#" + ((IStringSerializable)clip).func_176610_l()); return; } else if(clip instanceof TimeClip) diff --git a/src/main/java/net/minecraftforge/common/model/animation/IJoint.java b/src/main/java/net/minecraftforge/common/model/animation/IJoint.java index 766ada924..def85f72f 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/IJoint.java +++ b/src/main/java/net/minecraftforge/common/model/animation/IJoint.java @@ -19,9 +19,9 @@ package net.minecraftforge.common.model.animation; -import java.util.Optional; +import net.minecraft.util.math.vector.TransformationMatrix; -import net.minecraft.client.renderer.TransformationMatrix; +import java.util.Optional; /** * Model part that's a part of the hierarchical skeleton. diff --git a/src/main/java/net/minecraftforge/common/model/animation/IJointClip.java b/src/main/java/net/minecraftforge/common/model/animation/IJointClip.java index 7bc8e7a35..31d999977 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/IJointClip.java +++ b/src/main/java/net/minecraftforge/common/model/animation/IJointClip.java @@ -19,7 +19,7 @@ package net.minecraftforge.common.model.animation; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; /** * Returns Local joint pose; animation clip for specific model part. diff --git a/src/main/java/net/minecraftforge/common/model/animation/JointClips.java b/src/main/java/net/minecraftforge/common/model/animation/JointClips.java index fc8355685..24b7f74da 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/JointClips.java +++ b/src/main/java/net/minecraftforge/common/model/animation/JointClips.java @@ -19,7 +19,7 @@ package net.minecraftforge.common.model.animation; -import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.util.math.vector.TransformationMatrix; /** * Various implementations of IJointClip. diff --git a/src/main/java/net/minecraftforge/common/ticket/AABBTicket.java b/src/main/java/net/minecraftforge/common/ticket/AABBTicket.java index 5b50c5655..9d42f19fd 100644 --- a/src/main/java/net/minecraftforge/common/ticket/AABBTicket.java +++ b/src/main/java/net/minecraftforge/common/ticket/AABBTicket.java @@ -20,11 +20,11 @@ package net.minecraftforge.common.ticket; import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import javax.annotation.Nonnull; -public class AABBTicket extends SimpleTicket +public class AABBTicket extends SimpleTicket { @Nonnull public final AxisAlignedBB axisAlignedBB; @@ -35,7 +35,7 @@ public class AABBTicket extends SimpleTicket } @Override - public boolean matches(Vec3d toMatch) + public boolean matches(Vector3d toMatch) { return this.axisAlignedBB.contains(toMatch); } diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index b361f53e5..91b899f9b 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -29,7 +29,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; import net.minecraft.world.World; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.fml.server.ServerLifecycleHooks; import net.minecraftforge.registries.ForgeRegistries; @@ -66,7 +65,7 @@ public class BlockSnapshot public BlockSnapshot(IWorld world, BlockPos pos, BlockState state, @Nullable CompoundNBT nbt) { this.setWorld(world); - this.dimId = world.getDimension().getType().getId(); + this.dimId = 0; //world.getDimension().getType().getId(); //TODO this.pos = pos.toImmutable(); this.setReplacedBlock(state); this.registryName = state.getBlock().getRegistryName(); @@ -74,7 +73,7 @@ public class BlockSnapshot this.nbt = nbt; if (DEBUG) { - System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), getRegistryName(), getMeta()); + System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo()/*TODO .getWorldName()*/, pos.getX(), pos.getY(), pos.getZ(), getRegistryName(), getMeta()); } } @@ -136,7 +135,8 @@ public class BlockSnapshot IWorld world = this.world != null ? this.world.get() : null; if (world == null) { - world = ServerLifecycleHooks.getCurrentServer().getWorld(DimensionType.getById(getDimId())); + //TODO + //world = ServerLifecycleHooks.getCurrentServer().getWorld(DimensionType.getById(getDimId())); this.world = new WeakReference(world); } return world; @@ -154,7 +154,7 @@ public class BlockSnapshot @Nullable public TileEntity getTileEntity() { - return getNbt() != null ? TileEntity.create(getNbt()) : null; + return getNbt() != null ? TileEntity.func_235657_b_(getReplacedBlock(), getNbt()) : null; } public boolean restore() @@ -201,14 +201,14 @@ public class BlockSnapshot te = world.getTileEntity(pos); if (te != null) { - te.read(getNbt()); + te.func_230337_a_(getReplacedBlock(), getNbt()); te.markDirty(); } } if (DEBUG) { - System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][State: %s ][Block: %s ][TileEntity: %s ][force: %s ][notifyNeighbors: %s]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), replaced, replaced.getBlock().delegate.name(), te, force, notifyNeighbors); + System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][State: %s ][Block: %s ][TileEntity: %s ][force: %s ][notifyNeighbors: %s]", world.getWorldInfo()/*TODO .getWorldName()*/, pos.getX(), pos.getY(), pos.getZ(), replaced, replaced.getBlock().delegate.name(), te, force, notifyNeighbors); } return true; } diff --git a/src/main/java/net/minecraftforge/common/util/FakePlayer.java b/src/main/java/net/minecraftforge/common/util/FakePlayer.java index dadadc5c2..1f224150c 100644 --- a/src/main/java/net/minecraftforge/common/util/FakePlayer.java +++ b/src/main/java/net/minecraftforge/common/util/FakePlayer.java @@ -31,12 +31,14 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.management.PlayerInteractionManager; import net.minecraft.stats.Stat; import net.minecraft.util.DamageSource; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.math.Vec3d; import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.fml.server.ServerLifecycleHooks; +import java.util.UUID; + //Preliminary, simple Fake Player class public class FakePlayer extends ServerPlayerEntity { @@ -45,9 +47,10 @@ public class FakePlayer extends ServerPlayerEntity super(world.getServer(), world, name, new PlayerInteractionManager(world)); } - @Override public Vec3d getPositionVector(){ return new Vec3d(0, 0, 0); } + @Override public Vector3d getPositionVec(){ return new Vector3d(0, 0, 0); } + @Override public BlockPos func_233580_cy_(){ return BlockPos.ZERO; } @Override public void sendStatusMessage(ITextComponent chatComponent, boolean actionBar){} - @Override public void sendMessage(ITextComponent component) {} + @Override public void sendMessage(ITextComponent component, UUID p_145747_2_) {} @Override public void addStat(Stat par1StatBase, int par2){} //@Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){} @Override public boolean isInvulnerableTo(DamageSource source){ return true; } diff --git a/src/main/java/net/minecraftforge/common/util/ITeleporter.java b/src/main/java/net/minecraftforge/common/util/ITeleporter.java index b1ee652b7..5c4c5c940 100644 --- a/src/main/java/net/minecraftforge/common/util/ITeleporter.java +++ b/src/main/java/net/minecraftforge/common/util/ITeleporter.java @@ -24,7 +24,6 @@ import java.util.function.Function; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.world.dimension.Dimension; import net.minecraft.world.server.ServerWorld; /** diff --git a/src/main/java/net/minecraftforge/common/util/ReverseTagWrapper.java b/src/main/java/net/minecraftforge/common/util/ReverseTagWrapper.java index 260b8b1fc..0eb6c5ff5 100644 --- a/src/main/java/net/minecraftforge/common/util/ReverseTagWrapper.java +++ b/src/main/java/net/minecraftforge/common/util/ReverseTagWrapper.java @@ -21,35 +21,36 @@ package net.minecraftforge.common.util; import java.util.Collections; import java.util.HashSet; +import java.util.Map; import java.util.Set; -import java.util.function.IntSupplier; import java.util.function.Supplier; +import net.minecraft.tags.ITag; import net.minecraft.tags.TagCollection; import net.minecraft.util.ResourceLocation; public class ReverseTagWrapper { private final T target; - private final IntSupplier genSupplier; private final Supplier> colSupplier; - private int generation = -1; + //This map is immutable we track its identity change. + private Map> colCache; private Set cache = null; - public ReverseTagWrapper(T target, IntSupplier genSupplier, Supplier> colSupplier) + public ReverseTagWrapper(T target, Supplier> colSupplier) { this.target = target; - this.genSupplier = genSupplier; this.colSupplier = colSupplier; } public Set getTagNames() { - if (cache == null || generation != genSupplier.getAsInt()) + TagCollection collection = colSupplier.get(); + if (cache == null || colCache != collection.getTagMap()) // Identity equals. { - this.cache = Collections.unmodifiableSet(new HashSet<>(colSupplier.get().getOwningTags(target))); - this.generation = genSupplier.getAsInt(); + this.cache = Collections.unmodifiableSet(new HashSet<>(collection.getOwningTags(target))); + this.colCache = collection.getTagMap(); } return this.cache; } diff --git a/src/main/java/net/minecraftforge/common/util/WorldCapabilityData.java b/src/main/java/net/minecraftforge/common/util/WorldCapabilityData.java index a25744c46..fe26fbe3d 100644 --- a/src/main/java/net/minecraftforge/common/util/WorldCapabilityData.java +++ b/src/main/java/net/minecraftforge/common/util/WorldCapabilityData.java @@ -22,7 +22,6 @@ package net.minecraftforge.common.util; import javax.annotation.Nullable; import net.minecraft.nbt.CompoundNBT; -import net.minecraft.world.dimension.Dimension; import net.minecraft.world.storage.WorldSavedData; public class WorldCapabilityData extends WorldSavedData @@ -68,7 +67,7 @@ public class WorldCapabilityData extends WorldSavedData return true; } - public void setCapabilities(Dimension provider, INBTSerializable capabilities) + public void setCapabilities(INBTSerializable capabilities) { this.serializable = capabilities; if (this.capNBT != null && serializable != null) diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index f85ef8724..a324b13f6 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -36,7 +36,6 @@ import net.minecraft.entity.SpawnReason; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.effect.LightningBoltEntity; -import net.minecraft.entity.item.FireworkRocketEntity; import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.monster.ZombieEntity; import net.minecraft.entity.passive.AnimalEntity; @@ -45,10 +44,13 @@ import net.minecraft.entity.player.PlayerEntity.SleepResult; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.entity.projectile.DamagingProjectileEntity; +import net.minecraft.entity.projectile.FireworkRocketEntity; import net.minecraft.entity.projectile.ThrowableEntity; import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; +import net.minecraft.loot.LootTable; +import net.minecraft.loot.LootTableManager; import net.minecraft.world.spawner.AbstractSpawner; import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; @@ -71,10 +73,7 @@ import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraft.world.WorldSettings; import net.minecraft.world.biome.Biome; -import net.minecraft.world.storage.IPlayerFileData; -import net.minecraft.world.storage.SaveHandler; -import net.minecraft.world.storage.loot.LootTable; -import net.minecraft.world.storage.loot.LootTableManager; +import net.minecraft.world.storage.PlayerData; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.ClientChatEvent; @@ -324,9 +323,9 @@ public class ForgeEventFactory MinecraftForge.EVENT_BUS.post(new PlayerEvent.SaveToFile(player, playerDirectory, uuidString)); } - public static void firePlayerLoadingEvent(PlayerEntity player, IPlayerFileData playerFileData, String uuidString) + public static void firePlayerLoadingEvent(PlayerEntity player, PlayerData playerFileData, String uuidString) { - MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, ((SaveHandler)playerFileData).getPlayerFolder(), uuidString)); + MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, playerFileData.getPlayerDataFolder(), uuidString)); } @Nullable @@ -531,13 +530,13 @@ public class ForgeEventFactory @OnlyIn(Dist.CLIENT) public static boolean renderFireOverlay(PlayerEntity player, MatrixStack mat) { - return renderBlockOverlay(player, mat, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), new BlockPos(player)); + return renderBlockOverlay(player, mat, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), player.func_233580_cy_()); } @OnlyIn(Dist.CLIENT) public static boolean renderWaterOverlay(PlayerEntity player, MatrixStack mat) { - return renderBlockOverlay(player, mat, OverlayType.WATER, Blocks.WATER.getDefaultState(), new BlockPos(player)); + return renderBlockOverlay(player, mat, OverlayType.WATER, Blocks.WATER.getDefaultState(), player.func_233580_cy_()); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/net/minecraftforge/event/LootTableLoadEvent.java b/src/main/java/net/minecraftforge/event/LootTableLoadEvent.java index b110c0491..1acff12c8 100644 --- a/src/main/java/net/minecraftforge/event/LootTableLoadEvent.java +++ b/src/main/java/net/minecraftforge/event/LootTableLoadEvent.java @@ -20,8 +20,8 @@ package net.minecraftforge.event; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.storage.loot.LootTable; -import net.minecraft.world.storage.loot.LootTableManager; +import net.minecraft.loot.LootTable; +import net.minecraft.loot.LootTableManager; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; diff --git a/src/main/java/net/minecraftforge/event/entity/EntityTravelToDimensionEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityTravelToDimensionEvent.java index a4a7bf80a..9c2efb0fb 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityTravelToDimensionEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityTravelToDimensionEvent.java @@ -20,7 +20,8 @@ package net.minecraftforge.event.entity; import net.minecraft.entity.Entity; -import net.minecraft.world.dimension.DimensionType; +import net.minecraft.util.RegistryKey; +import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event.HasResult; @@ -40,15 +41,15 @@ import net.minecraftforge.eventbus.api.Event.HasResult; @Cancelable public class EntityTravelToDimensionEvent extends EntityEvent { - private final DimensionType dimension; + private final RegistryKey dimension; - public EntityTravelToDimensionEvent(Entity entity, DimensionType dimension) + public EntityTravelToDimensionEvent(Entity entity, RegistryKey dimension) { super(entity); this.dimension = dimension; } - public DimensionType getDimension() + public RegistryKey getDimension() { return dimension; } diff --git a/src/main/java/net/minecraftforge/event/entity/ProjectileImpactEvent.java b/src/main/java/net/minecraftforge/event/entity/ProjectileImpactEvent.java index 1dccfc749..e6ebdb4ec 100644 --- a/src/main/java/net/minecraftforge/event/entity/ProjectileImpactEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/ProjectileImpactEvent.java @@ -20,9 +20,9 @@ package net.minecraftforge.event.entity; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.FireworkRocketEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.entity.projectile.DamagingProjectileEntity; +import net.minecraft.entity.projectile.FireworkRocketEntity; import net.minecraft.entity.projectile.ThrowableEntity; import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/net/minecraftforge/event/entity/player/ItemFishedEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ItemFishedEvent.java index 7a8132f36..aa2cc2ef9 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ItemFishedEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ItemFishedEvent.java @@ -44,7 +44,7 @@ public class ItemFishedEvent extends PlayerEvent public ItemFishedEvent(List stacks, int rodDamage, FishingBobberEntity hook) { - super(hook.getAngler()); + super(hook.func_234606_i_()); this.stacks.addAll(stacks); this.rodDamage = rodDamage; this.hook = hook; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java index 7ad8989cf..77ebcda54 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java @@ -25,7 +25,6 @@ import net.minecraft.client.multiplayer.PlayerController; import net.minecraft.entity.Entity; import net.minecraft.server.management.PlayerInteractionManager; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java index 410ac49c0..876fd46d1 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java @@ -24,7 +24,8 @@ import java.io.File; import net.minecraft.entity.item.ItemEntity; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.world.dimension.DimensionType; +import net.minecraft.util.RegistryKey; +import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.eventbus.api.Cancelable; @@ -488,21 +489,21 @@ public class PlayerEvent extends LivingEvent } public static class PlayerChangedDimensionEvent extends PlayerEvent { - private final DimensionType fromDim; - private final DimensionType toDim; - public PlayerChangedDimensionEvent(PlayerEntity player, DimensionType fromDim, DimensionType toDim) + private final RegistryKey fromDim; + private final RegistryKey toDim; + public PlayerChangedDimensionEvent(PlayerEntity player, RegistryKey fromDim, RegistryKey toDim) { super(player); this.fromDim = fromDim; this.toDim = toDim; } - public DimensionType getFrom() + public RegistryKey getFrom() { return this.fromDim; } - public DimensionType getTo() + public RegistryKey getTo() { return this.toDim; } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java index 602c09785..8e251b654 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -27,7 +27,7 @@ import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; @@ -73,12 +73,12 @@ public class PlayerInteractEvent extends PlayerEvent @Cancelable public static class EntityInteractSpecific extends PlayerInteractEvent { - private final Vec3d localPos; + private final Vector3d localPos; private final Entity target; - public EntityInteractSpecific(PlayerEntity player, Hand hand, Entity target, Vec3d localPos) + public EntityInteractSpecific(PlayerEntity player, Hand hand, Entity target, Vector3d localPos) { - super(player, hand, new BlockPos(target), null); + super(player, hand, target.func_233580_cy_(), null); this.localPos = localPos; this.target = target; } @@ -89,7 +89,7 @@ public class PlayerInteractEvent extends PlayerEvent * [-width / 2, width / 2] while Y values will be in the range [0, height] * @return The local position */ - public Vec3d getLocalPos() + public Vector3d getLocalPos() { return localPos; } @@ -118,7 +118,7 @@ public class PlayerInteractEvent extends PlayerEvent public EntityInteract(PlayerEntity player, Hand hand, Entity target) { - super(player, hand, new BlockPos(target), null); + super(player, hand, target.func_233580_cy_(), null); this.target = target; } @@ -210,7 +210,7 @@ public class PlayerInteractEvent extends PlayerEvent { public RightClickItem(PlayerEntity player, Hand hand) { - super(player, hand, new BlockPos(player), null); + super(player, hand, player.func_233580_cy_(), null); } } @@ -223,7 +223,7 @@ public class PlayerInteractEvent extends PlayerEvent { public RightClickEmpty(PlayerEntity player, Hand hand) { - super(player, hand, new BlockPos(player), null); + super(player, hand, player.func_233580_cy_(), null); } } @@ -297,7 +297,7 @@ public class PlayerInteractEvent extends PlayerEvent { public LeftClickEmpty(PlayerEntity player) { - super(player, Hand.MAIN_HAND, new BlockPos(player), null); + super(player, Hand.MAIN_HAND, player.func_233580_cy_(), null); } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java deleted file mode 100644 index e37aca18f..000000000 --- a/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.event.terraingen; - -import net.minecraft.world.WorldType; -import net.minecraft.world.biome.provider.BiomeProvider; -import net.minecraft.world.gen.layer.Layer; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.Cancelable; -import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.eventbus.api.Event.HasResult; - -/** - * WorldTypeEvent is fired when an event involving the world occurs.
- * If a method utilizes this {@link Event} as its parameter, the method will - * receive every child event of this class.
- *
- * {@link #worldType} contains the WorldType of the world this event is occurring in.
- *
- * All children of this event are fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
- **/ -public class WorldTypeEvent extends Event -{ - private final WorldType worldType; - - public WorldTypeEvent(WorldType worldType) - { - this.worldType = worldType; - } - - public WorldType getWorldType() - { - return worldType; - } - - /** - * BiomeSize is fired when vanilla Minecraft attempts to generate biomes.
- * This event is fired during biome generation in - * {@link GenLayer#initializeAllBiomeGenerators(long, WorldType, ChunkProviderSettings)}.
- *
- * {@link #originalSize} the original size of the Biome.
- * {@link #newSize} the new size of the biome. Initially set to the {@link #originalSize}.
- * If {@link #newSize} is set to a new value, that value will be used for the Biome size.
- *
- * This event is not {@link Cancelable}.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
- **/ - public static class BiomeSize extends WorldTypeEvent - { - private final int originalSize; - private int newSize; - - public BiomeSize(WorldType worldType, int original) - { - super(worldType); - originalSize = original; - setNewSize(original); - } - - public int getOriginalSize() - { - return originalSize; - } - - public int getNewSize() - { - return newSize; - } - - public void setNewSize(int newSize) - { - this.newSize = newSize; - } - } - -} diff --git a/src/main/java/net/minecraftforge/event/village/VillageSiegeEvent.java b/src/main/java/net/minecraftforge/event/village/VillageSiegeEvent.java index 3bcd2f443..25c0c9e25 100644 --- a/src/main/java/net/minecraftforge/event/village/VillageSiegeEvent.java +++ b/src/main/java/net/minecraftforge/event/village/VillageSiegeEvent.java @@ -20,7 +20,7 @@ package net.minecraftforge.event.village; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.village.VillageSiege; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -43,9 +43,9 @@ public class VillageSiegeEvent extends Event private final VillageSiege siege; private final World world; private final PlayerEntity player; - private final Vec3d attemptedSpawnPos; + private final Vector3d attemptedSpawnPos; - public VillageSiegeEvent(VillageSiege siege, World world, PlayerEntity player, Vec3d attemptedSpawnPos) + public VillageSiegeEvent(VillageSiege siege, World world, PlayerEntity player, Vector3d attemptedSpawnPos) { this.siege = siege; this.world = world; @@ -68,7 +68,7 @@ public class VillageSiegeEvent extends Event return player; } - public Vec3d getAttemptedSpawnPos() + public Vector3d getAttemptedSpawnPos() { return attemptedSpawnPos; } diff --git a/src/main/java/net/minecraftforge/event/world/RegisterDimensionsEvent.java b/src/main/java/net/minecraftforge/event/world/RegisterDimensionsEvent.java index 2472a677f..c50011f95 100644 --- a/src/main/java/net/minecraftforge/event/world/RegisterDimensionsEvent.java +++ b/src/main/java/net/minecraftforge/event/world/RegisterDimensionsEvent.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.event.world; +/*package net.minecraftforge.event.world; import java.util.Collections; import java.util.Map; @@ -35,7 +35,7 @@ import net.minecraftforge.eventbus.api.Event; * * Contains a list of missing entries. Registering an entry with the DimensionManger * will remove the matching entry from the missing list. - */ + * / public class RegisterDimensionsEvent extends Event { private final Map missing; @@ -57,4 +57,4 @@ public class RegisterDimensionsEvent extends Event { return missing.get(key); } -} +}*/ diff --git a/src/main/java/net/minecraftforge/fluids/FluidAttributes.java b/src/main/java/net/minecraftforge/fluids/FluidAttributes.java index cf6686e3f..ef8179472 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidAttributes.java +++ b/src/main/java/net/minecraftforge/fluids/FluidAttributes.java @@ -23,13 +23,13 @@ import javax.annotation.Nullable; import net.minecraft.block.BlockState; import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.item.ItemStack; import net.minecraft.particles.ParticleTypes; import net.minecraft.util.*; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; import java.util.function.BiFunction; import java.util.stream.Stream; @@ -152,22 +152,22 @@ public class FluidAttributes return new ItemStack(stack.getFluid().getFilledBucket()); } - public BlockState getBlock(ILightReader reader, BlockPos pos, IFluidState state) + public BlockState getBlock(IBlockDisplayReader reader, BlockPos pos, FluidState state) { return state.getBlockState(); } - public IFluidState getStateForPlacement(ILightReader reader, BlockPos pos, FluidStack state) + public FluidState getStateForPlacement(IBlockDisplayReader reader, BlockPos pos, FluidStack state) { return state.getFluid().getDefaultState(); } - public final boolean canBePlacedInWorld(ILightReader reader, BlockPos pos, IFluidState state) + public final boolean canBePlacedInWorld(IBlockDisplayReader reader, BlockPos pos, FluidState state) { return !getBlock(reader, pos, state).isAir(reader, pos); } - public final boolean canBePlacedInWorld(ILightReader reader, BlockPos pos, FluidStack state) + public final boolean canBePlacedInWorld(IBlockDisplayReader reader, BlockPos pos, FluidStack state) { return !getBlock(reader, pos, getStateForPlacement(reader, pos, state)).isAir(reader, pos); } @@ -186,7 +186,7 @@ public class FluidAttributes * @param fluidStack The fluidStack is trying to be placed. * @return true if this fluid should vaporize in dimensions where water vaporizes when placed. */ - public boolean doesVaporize(ILightReader reader, BlockPos pos, FluidStack fluidStack) + public boolean doesVaporize(IBlockDisplayReader reader, BlockPos pos, FluidStack fluidStack) { BlockState blockstate = getBlock(reader, pos, getStateForPlacement(reader, pos, fluidStack)); if (blockstate == null) @@ -314,17 +314,17 @@ public class FluidAttributes public SoundEvent getEmptySound(FluidStack stack) { return getEmptySound(); } /* World-based Accessors */ - public int getLuminosity(ILightReader world, BlockPos pos){ return getLuminosity(); } - public int getDensity(ILightReader world, BlockPos pos){ return getDensity(); } - public int getTemperature(ILightReader world, BlockPos pos){ return getTemperature(); } - public int getViscosity(ILightReader world, BlockPos pos){ return getViscosity(); } - public boolean isGaseous(ILightReader world, BlockPos pos){ return isGaseous(); } - public Rarity getRarity(ILightReader world, BlockPos pos){ return getRarity(); } - public int getColor(ILightReader world, BlockPos pos){ return getColor(); } - public ResourceLocation getStillTexture(ILightReader world, BlockPos pos) { return getStillTexture(); } - public ResourceLocation getFlowingTexture(ILightReader world, BlockPos pos) { return getFlowingTexture(); } - public SoundEvent getFillSound(ILightReader world, BlockPos pos) { return getFillSound(); } - public SoundEvent getEmptySound(ILightReader world, BlockPos pos) { return getEmptySound(); } + public int getLuminosity(IBlockDisplayReader world, BlockPos pos){ return getLuminosity(); } + public int getDensity(IBlockDisplayReader world, BlockPos pos){ return getDensity(); } + public int getTemperature(IBlockDisplayReader world, BlockPos pos){ return getTemperature(); } + public int getViscosity(IBlockDisplayReader world, BlockPos pos){ return getViscosity(); } + public boolean isGaseous(IBlockDisplayReader world, BlockPos pos){ return isGaseous(); } + public Rarity getRarity(IBlockDisplayReader world, BlockPos pos){ return getRarity(); } + public int getColor(IBlockDisplayReader world, BlockPos pos){ return getColor(); } + public ResourceLocation getStillTexture(IBlockDisplayReader world, BlockPos pos) { return getStillTexture(); } + public ResourceLocation getFlowingTexture(IBlockDisplayReader world, BlockPos pos) { return getFlowingTexture(); } + public SoundEvent getFillSound(IBlockDisplayReader world, BlockPos pos) { return getFillSound(); } + public SoundEvent getEmptySound(IBlockDisplayReader world, BlockPos pos) { return getEmptySound(); } public static Builder builder(ResourceLocation stillTexture, ResourceLocation flowingTexture) { return new Builder(stillTexture, flowingTexture, FluidAttributes::new); @@ -441,7 +441,7 @@ public class FluidAttributes } @Override - public int getColor(ILightReader world, BlockPos pos) + public int getColor(IBlockDisplayReader world, BlockPos pos) { return BiomeColors.getWaterColor(world, pos) | 0xFF000000; } diff --git a/src/main/java/net/minecraftforge/fluids/FluidUtil.java b/src/main/java/net/minecraftforge/fluids/FluidUtil.java index fb5ba4337..03bb0ded8 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidUtil.java +++ b/src/main/java/net/minecraftforge/fluids/FluidUtil.java @@ -37,7 +37,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; @@ -548,7 +548,7 @@ public class FluidUtil return false; } - BlockItemUseContext context = new BlockItemUseContext(new ItemUseContext(player, hand, new BlockRayTraceResult(Vec3d.ZERO, Direction.UP, pos, false))); //TODO: This neds proper context... + BlockItemUseContext context = new BlockItemUseContext(new ItemUseContext(player, hand, new BlockRayTraceResult(Vector3d.ZERO, Direction.UP, pos, false))); //TODO: This neds proper context... // check that we can place the fluid at the destination BlockState destBlockState = world.getBlockState(pos); @@ -560,7 +560,7 @@ public class FluidUtil return false; // Non-air, solid, unreplacable block. We can't put fluid here. } - if (world.dimension.doesWaterVaporize() && fluid.getAttributes().doesVaporize(world, pos, resource)) + if (world.func_230315_m_().func_236040_e_() && fluid.getAttributes().doesVaporize(world, pos, resource)) { FluidStack result = fluidSource.drain(resource, IFluidHandler.FluidAction.EXECUTE); if (!result.isEmpty()) diff --git a/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java b/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java index 208848339..457605dec 100644 --- a/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java +++ b/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java @@ -25,7 +25,7 @@ import net.minecraft.block.Blocks; import net.minecraft.block.FlowingFluidBlock; import net.minecraft.fluid.FlowingFluid; import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.item.Item; import net.minecraft.item.Items; import net.minecraft.state.StateContainer; @@ -90,7 +90,7 @@ public abstract class ForgeFlowingFluid extends FlowingFluid @Override protected void beforeReplacingBlock(IWorld worldIn, BlockPos pos, BlockState state) { - TileEntity tileentity = state.getBlock().hasTileEntity() ? worldIn.getTileEntity(pos) : null; + TileEntity tileentity = state.getBlock().hasTileEntity(state) ? worldIn.getTileEntity(pos) : null; Block.spawnDrops(state, worldIn.getWorld(), pos, tileentity); } @@ -113,7 +113,7 @@ public abstract class ForgeFlowingFluid extends FlowingFluid } @Override - protected boolean canDisplace(IFluidState state, IBlockReader world, BlockPos pos, Fluid fluidIn, Direction direction) + protected boolean canDisplace(FluidState state, IBlockReader world, BlockPos pos, Fluid fluidIn, Direction direction) { // Based on the water implementation, may need to be overriden for mod fluids that shouldn't behave like water. return direction == Direction.DOWN && !isEquivalentTo(fluidIn); @@ -132,7 +132,7 @@ public abstract class ForgeFlowingFluid extends FlowingFluid } @Override - protected BlockState getBlockState(IFluidState state) + protected BlockState getBlockState(FluidState state) { if (block != null) return block.get().getDefaultState().with(FlowingFluidBlock.LEVEL, getLevelFromState(state)); @@ -158,16 +158,16 @@ public abstract class ForgeFlowingFluid extends FlowingFluid setDefaultState(getStateContainer().getBaseState().with(LEVEL_1_8, 7)); } - protected void fillStateContainer(StateContainer.Builder builder) { + protected void fillStateContainer(StateContainer.Builder builder) { super.fillStateContainer(builder); builder.add(LEVEL_1_8); } - public int getLevel(IFluidState state) { + public int getLevel(FluidState state) { return state.get(LEVEL_1_8); } - public boolean isSource(IFluidState state) { + public boolean isSource(FluidState state) { return false; } } @@ -179,11 +179,11 @@ public abstract class ForgeFlowingFluid extends FlowingFluid super(properties); } - public int getLevel(IFluidState state) { + public int getLevel(FluidState state) { return 8; } - public boolean isSource(IFluidState state) { + public boolean isSource(FluidState state) { return true; } } diff --git a/src/main/java/net/minecraftforge/fluids/capability/TileFluidHandler.java b/src/main/java/net/minecraftforge/fluids/capability/TileFluidHandler.java index bff42ad71..4f24b3465 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/TileFluidHandler.java +++ b/src/main/java/net/minecraftforge/fluids/capability/TileFluidHandler.java @@ -19,6 +19,7 @@ package net.minecraftforge.fluids.capability; +import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; @@ -43,9 +44,9 @@ public class TileFluidHandler extends TileEntity } @Override - public void read(CompoundNBT tag) + public void func_230337_a_(BlockState state, CompoundNBT tag) { - super.read(tag); + super.func_230337_a_(state, tag); tank.readFromNBT(tag); } diff --git a/src/main/java/net/minecraftforge/fml/FMLWorldPersistenceHook.java b/src/main/java/net/minecraftforge/fml/FMLWorldPersistenceHook.java index d687fc9b2..13bda540a 100644 --- a/src/main/java/net/minecraftforge/fml/FMLWorldPersistenceHook.java +++ b/src/main/java/net/minecraftforge/fml/FMLWorldPersistenceHook.java @@ -28,8 +28,8 @@ import com.google.common.collect.Multimap; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.storage.SaveHandler; -import net.minecraft.world.storage.WorldInfo; +import net.minecraft.world.storage.IServerConfiguration; +import net.minecraft.world.storage.SaveFormat; import net.minecraftforge.registries.ForgeRegistry; import net.minecraftforge.registries.GameData; import net.minecraftforge.registries.RegistryManager; @@ -56,7 +56,7 @@ public final class FMLWorldPersistenceHook implements WorldPersistenceHooks.Worl } @Override - public CompoundNBT getDataForWriting(SaveHandler handler, WorldInfo info) + public CompoundNBT getDataForWriting(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo) { CompoundNBT fmlData = new CompoundNBT(); ListNBT modList = new ListNBT(); @@ -71,7 +71,7 @@ public final class FMLWorldPersistenceHook implements WorldPersistenceHooks.Worl CompoundNBT registries = new CompoundNBT(); fmlData.put("Registries", registries); - LOGGER.debug(WORLDPERSISTENCE,"Gathering id map for writing to world save {}", info.getWorldName()); + LOGGER.debug(WORLDPERSISTENCE,"Gathering id map for writing to world save {}", serverInfo.getWorldName()); for (Map.Entry e : RegistryManager.ACTIVE.takeSnapshot(true).entrySet()) { @@ -81,7 +81,7 @@ public final class FMLWorldPersistenceHook implements WorldPersistenceHooks.Worl } @Override - public void readData(SaveHandler handler, WorldInfo info, CompoundNBT tag) + public void readData(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo, CompoundNBT tag) { if (tag.contains("LoadingModList")) { diff --git a/src/main/java/net/minecraftforge/fml/ForgeI18n.java b/src/main/java/net/minecraftforge/fml/ForgeI18n.java index e576a7d8e..b25e22291 100644 --- a/src/main/java/net/minecraftforge/fml/ForgeI18n.java +++ b/src/main/java/net/minecraftforge/fml/ForgeI18n.java @@ -36,6 +36,7 @@ import java.util.function.BiConsumer; import static net.minecraftforge.fml.Logging.CORE; +//TODO, this should be re-evaluated now that ITextComponents are passed everywhere instaed of strings. public class ForgeI18n { private static final Logger LOGGER = LogManager.getLogger(); private static Map i18n; diff --git a/src/main/java/net/minecraftforge/fml/TextComponentMessageFormatHandler.java b/src/main/java/net/minecraftforge/fml/TextComponentMessageFormatHandler.java index ac1c2082b..be89b00c9 100644 --- a/src/main/java/net/minecraftforge/fml/TextComponentMessageFormatHandler.java +++ b/src/main/java/net/minecraftforge/fml/TextComponentMessageFormatHandler.java @@ -19,17 +19,17 @@ package net.minecraftforge.fml; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.ITextProperties; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TranslationTextComponent; import java.util.List; public class TextComponentMessageFormatHandler { - public static int handle(final TranslationTextComponent parent, final List children, final Object[] formatArgs, final String format) { + public static int handle(final TranslationTextComponent parent, final List children, final Object[] formatArgs, final String format) { try { StringTextComponent component = new StringTextComponent(ForgeI18n.parseFormat(format, formatArgs)); - component.getStyle().setParentStyle(parent.getStyle()); + component.getStyle().func_240717_a_(parent.getStyle()); children.add(component); return format.length(); } catch (IllegalArgumentException ex) { diff --git a/src/main/java/net/minecraftforge/fml/WorldPersistenceHooks.java b/src/main/java/net/minecraftforge/fml/WorldPersistenceHooks.java index db0fbf122..2328056e2 100644 --- a/src/main/java/net/minecraftforge/fml/WorldPersistenceHooks.java +++ b/src/main/java/net/minecraftforge/fml/WorldPersistenceHooks.java @@ -20,8 +20,8 @@ package net.minecraftforge.fml; import net.minecraft.nbt.CompoundNBT; -import net.minecraft.world.storage.SaveHandler; -import net.minecraft.world.storage.WorldInfo; +import net.minecraft.world.storage.IServerConfiguration; +import net.minecraft.world.storage.SaveFormat; import net.minecraftforge.fml.common.thread.EffectiveSide; import java.util.ArrayList; @@ -35,42 +35,23 @@ public class WorldPersistenceHooks worldPersistenceHooks.add(hook); } - public static void handleWorldDataSave(final SaveHandler handler, final WorldInfo worldInfo, final CompoundNBT tagCompound) + public static void handleWorldDataSave(final SaveFormat.LevelSave levelSave, final IServerConfiguration serverInfo, final CompoundNBT tagCompound) { - worldPersistenceHooks.forEach(wac->tagCompound.put(wac.getModId(), wac.getDataForWriting(handler, worldInfo))); + worldPersistenceHooks.forEach(wac->tagCompound.put(wac.getModId(), wac.getDataForWriting(levelSave, serverInfo))); } - public static void handleWorldDataLoad(SaveHandler handler, WorldInfo worldInfo, CompoundNBT tagCompound) + public static void handleWorldDataLoad(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo, CompoundNBT tagCompound) { if (EffectiveSide.get() == LogicalSide.SERVER) { - worldPersistenceHooks.forEach(wac->wac.readData(handler, worldInfo, tagCompound.getCompound(wac.getModId()))); + worldPersistenceHooks.forEach(wac->wac.readData(levelSave, serverInfo, tagCompound.getCompound(wac.getModId()))); } } - public static void confirmBackupLevelDatUse(SaveHandler handler) - { -/* - if (handlerToCheck == null || handlerToCheck.get() != handler) { - // only run if the save has been initially loaded - handlerToCheck = null; - return; - } - - String text = "Forge Mod Loader detected that the backup level.dat is being used.\n\n" + - "This may happen due to a bug or corruption, continuing can damage\n" + - "your world beyond repair or lose data / progress.\n\n" + - "It's recommended to create a world backup before continuing."; - - boolean confirmed = StartupQuery.confirm(text); - if (!confirmed) StartupQuery.abort(); -*/ - } - public interface WorldPersistenceHook { String getModId(); - CompoundNBT getDataForWriting(SaveHandler handler, WorldInfo info); - void readData(SaveHandler handler, WorldInfo info, CompoundNBT tag); + CompoundNBT getDataForWriting(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo); + void readData(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo, CompoundNBT tag); } } diff --git a/src/main/java/net/minecraftforge/fml/client/ClientHooks.java b/src/main/java/net/minecraftforge/fml/client/ClientHooks.java index 99f6343e4..b84048a72 100644 --- a/src/main/java/net/minecraftforge/fml/client/ClientHooks.java +++ b/src/main/java/net/minecraftforge/fml/client/ClientHooks.java @@ -20,10 +20,7 @@ package net.minecraftforge.fml.client; import java.io.File; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; +import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; @@ -34,11 +31,13 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.SetMultimap; import com.google.common.collect.Sets; import com.google.common.collect.Table; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.screen.MultiplayerScreen; import net.minecraft.client.gui.screen.WorldSelectionScreen; import net.minecraft.client.multiplayer.PlayerController; +import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.client.event.ClientPlayerNetworkEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.ExtensionPoint; @@ -131,7 +130,7 @@ public class ClientHooks } - public static void drawForgePingInfo(MultiplayerScreen gui, ServerData target, int x, int y, int width, int relativeMouseX, int relativeMouseY) { + public static void drawForgePingInfo(MultiplayerScreen gui, ServerData target, MatrixStack mStack, int x, int y, int width, int relativeMouseX, int relativeMouseY) { int idx; String tooltip; if (target.forgeData == null) @@ -166,10 +165,11 @@ public class ClientHooks } Minecraft.getInstance().getTextureManager().bindTexture(iconSheet); - AbstractGui.blit(x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256); + AbstractGui.func_238466_a_(mStack, x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256); if(relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26) - gui.setHoveringText(tooltip); + //TODO using StringTextComponent here is a hack, we should be using TranslationTextComponents. + gui.func_238854_b_(Collections.singletonList(new StringTextComponent(tooltip))); } @@ -187,7 +187,8 @@ public class ClientHooks { try { - Minecraft.getInstance().launchIntegratedServer(comparator.getFileName(), comparator.getDisplayName(), null); + //TODO + //Minecraft.getInstance().launchIntegratedServer(comparator.getFileName(), comparator.getDisplayName(), null); } catch (StartupQuery.AbortedException e) { diff --git a/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java b/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java index a1c5d9390..f7ef56b6c 100644 --- a/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java +++ b/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java @@ -34,6 +34,7 @@ import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Supplier; +import net.minecraft.resources.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -43,11 +44,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.resources.ClientResourcePackInfo; import net.minecraft.client.resources.DownloadingPackFinder; import net.minecraft.profiler.IProfiler; -import net.minecraft.resources.IFutureReloadListener; -import net.minecraft.resources.IReloadableResourceManager; -import net.minecraft.resources.IResourceManager; -import net.minecraft.resources.ResourcePackInfo; -import net.minecraft.resources.ResourcePackList; import net.minecraft.resources.data.PackMetadataSection; import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.api.distmarker.Dist; @@ -189,14 +185,14 @@ public class ClientModLoader return (packList, factory) -> clientPackFinder(modResourcePacks, packSetter, packList, factory); } - private static void clientPackFinder(Map modResourcePacks, BiConsumer packSetter, Map packList, ResourcePackInfo.IFactory factory) { + private static void clientPackFinder(Map modResourcePacks, BiConsumer packSetter, Consumer consumer, ResourcePackInfo.IFactory factory) { List hiddenPacks = new ArrayList<>(); for (Entry e : modResourcePacks.entrySet()) { IModInfo mod = e.getKey().getModInfos().get(0); if (Objects.equals(mod.getModId(), "minecraft")) continue; // skip the minecraft "mod" final String name = "mod:" + mod.getModId(); - final T packInfo = ResourcePackInfo.createResourcePack(name, false, e::getValue, factory, ResourcePackInfo.Priority.BOTTOM); + final T packInfo = ResourcePackInfo.createResourcePack(name, false, e::getValue, factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.field_232625_a_); if (packInfo == null) { // Vanilla only logs an error, instead of propagating, so handle null and warn that something went wrong ModLoader.get().addWarning(new ModLoadingWarning(mod, ModLoadingStage.ERROR, "fml.modloading.brokenresources", e.getKey())); @@ -205,14 +201,14 @@ public class ClientModLoader packSetter.accept(e.getValue(), packInfo); LOGGER.debug(CORE, "Generating PackInfo named {} for mod file {}", name, e.getKey().getFilePath()); if (mod.getOwningFile().showAsResourcePack()) { - packList.put(name, packInfo); + consumer.accept(packInfo); } else { hiddenPacks.add(e.getValue()); } } final T packInfo = ResourcePackInfo.createResourcePack("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources", new PackMetadataSection(new TranslationTextComponent("fml.resources.modresources", hiddenPacks.size()), 5), - hiddenPacks), factory, ResourcePackInfo.Priority.BOTTOM); - packList.put("mod_resources", packInfo); + hiddenPacks), factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.field_232625_a_); + consumer.accept(packInfo); } } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/GuiUtils.java b/src/main/java/net/minecraftforge/fml/client/gui/GuiUtils.java index f72d9a1a5..90b24e3ce 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/GuiUtils.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/GuiUtils.java @@ -25,10 +25,11 @@ import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Matrix4f; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.text.ITextProperties; import net.minecraftforge.client.event.RenderTooltipEvent; import net.minecraftforge.common.MinecraftForge; @@ -239,9 +240,9 @@ public class GuiUtils cachedTooltipStack = ItemStack.EMPTY; } - public static void drawHoveringText(List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) + public static void drawHoveringText(MatrixStack mStack, List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) { - drawHoveringText(textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, DEFAULT_BACKGROUND_COLOR, DEFAULT_BORDER_COLOR_START, DEFAULT_BORDER_COLOR_END, font); + drawHoveringText(mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, DEFAULT_BACKGROUND_COLOR, DEFAULT_BORDER_COLOR_START, DEFAULT_BORDER_COLOR_END, font); } /** @@ -263,23 +264,24 @@ public class GuiUtils * between the start and end values. * @param font the font for drawing the text in the tooltip box */ - public static void drawHoveringText(List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, + public static void drawHoveringText(MatrixStack mStack, List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font) { - drawHoveringText(cachedTooltipStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, backgroundColor, borderColorStart, borderColorEnd, font); + drawHoveringText(cachedTooltipStack, mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, backgroundColor, borderColorStart, borderColorEnd, font); } - public static void drawHoveringText(@Nonnull final ItemStack stack, List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) + public static void drawHoveringText(@Nonnull final ItemStack stack, MatrixStack mStack, List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) { - drawHoveringText(stack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, DEFAULT_BACKGROUND_COLOR, DEFAULT_BORDER_COLOR_START, DEFAULT_BORDER_COLOR_END, font); + drawHoveringText(stack, mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, DEFAULT_BACKGROUND_COLOR, DEFAULT_BORDER_COLOR_START, DEFAULT_BORDER_COLOR_END, font); } /** * Use this version if calling from somewhere where ItemStack context is available. * - * @see #drawHoveringText(List, int, int, int, int, int, int, int, int, FontRenderer) + * @see #drawHoveringText(MatrixStack, List, int, int, int, int, int, int, int, int, FontRenderer) */ - public static void drawHoveringText(@Nonnull final ItemStack stack, List textLines, int mouseX, int mouseY, + //TODO, Validate rendering is the same as the original + public static void drawHoveringText(@Nonnull final ItemStack stack, MatrixStack mStack, List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font) { @@ -299,9 +301,9 @@ public class GuiUtils RenderSystem.disableDepthTest(); int tooltipTextWidth = 0; - for (String textLine : textLines) + for (ITextProperties textLine : textLines) { - int textLineWidth = font.getStringWidth(textLine); + int textLineWidth = font.func_238414_a_(textLine); if (textLineWidth > tooltipTextWidth) tooltipTextWidth = textLineWidth; } @@ -332,17 +334,17 @@ public class GuiUtils if (needsWrap) { int wrappedTooltipWidth = 0; - List wrappedTextLines = new ArrayList(); + List wrappedTextLines = new ArrayList<>(); for (int i = 0; i < textLines.size(); i++) { - String textLine = textLines.get(i); - List wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth); + ITextProperties textLine = textLines.get(i); + List wrappedLine = font.func_238425_b_(textLine, tooltipTextWidth); if (i == 0) titleLinesCount = wrappedLine.size(); - for (String line : wrappedLine) + for (ITextProperties line : wrappedLine) { - int lineWidth = font.getStringWidth(line); + int lineWidth = font.func_238414_a_(line); if (lineWidth > wrappedTooltipWidth) wrappedTooltipWidth = lineWidth; wrappedTextLines.add(line); @@ -379,30 +381,31 @@ public class GuiUtils borderColorStart = colorEvent.getBorderStart(); borderColorEnd = colorEvent.getBorderEnd(); - drawGradientRect(zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor); - drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor); - drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); - drawGradientRect(zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); - drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); - drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); - drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); - drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart); - drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd); + mStack.push(); + Matrix4f mat = mStack.getLast().getMatrix(); + //TODO, lots of unnessesary GL calls here, we can buffer all these together. + drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor); + drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor); + drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + drawGradientRect(mat, zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + drawGradientRect(mat, zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); + drawGradientRect(mat, zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); + drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart); + drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd); MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostBackground(stack, textLines, tooltipX, tooltipY, font, tooltipTextWidth, tooltipHeight)); IRenderTypeBuffer.Impl renderType = IRenderTypeBuffer.getImpl(Tessellator.getInstance().getBuffer()); - MatrixStack textStack = new MatrixStack(); - textStack.translate(0.0D, 0.0D, (double)zLevel); - Matrix4f textLocation = textStack.getLast().getMatrix(); + mStack.translate(0.0D, 0.0D, zLevel); int tooltipTop = tooltipY; for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) { - String line = textLines.get(lineNumber); + ITextProperties line = textLines.get(lineNumber); if (line != null) - font.renderString(line, (float)tooltipX, (float)tooltipY, -1, true, textLocation, renderType, false, 0, 15728880); + font.func_238416_a_(line, (float)tooltipX, (float)tooltipY, -1, true, mat, renderType, false, 0, 15728880); if (lineNumber + 1 == titleLinesCount) tooltipY += 2; @@ -411,6 +414,7 @@ public class GuiUtils } renderType.finish(); + mStack.pop(); MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, textLines, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight)); @@ -419,7 +423,7 @@ public class GuiUtils } } - public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) + public static void drawGradientRect(Matrix4f mat, int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) { float startAlpha = (float)(startColor >> 24 & 255) / 255.0F; float startRed = (float)(startColor >> 16 & 255) / 255.0F; @@ -430,33 +434,32 @@ public class GuiUtils float endGreen = (float)(endColor >> 8 & 255) / 255.0F; float endBlue = (float)(endColor & 255) / 255.0F; + RenderSystem.enableDepthTest(); RenderSystem.disableTexture(); RenderSystem.enableBlend(); - RenderSystem.disableAlphaTest(); RenderSystem.defaultBlendFunc(); RenderSystem.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - buffer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); - buffer.pos( left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); - buffer.pos( left, bottom, zLevel).color( endRed, endGreen, endBlue, endAlpha).endVertex(); - buffer.pos(right, bottom, zLevel).color( endRed, endGreen, endBlue, endAlpha).endVertex(); + buffer.pos(mat, right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); + buffer.pos(mat, left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); + buffer.pos(mat, left, bottom, zLevel).color( endRed, endGreen, endBlue, endAlpha).endVertex(); + buffer.pos(mat, right, bottom, zLevel).color( endRed, endGreen, endBlue, endAlpha).endVertex(); tessellator.draw(); RenderSystem.shadeModel(GL11.GL_FLAT); RenderSystem.disableBlend(); - RenderSystem.enableAlphaTest(); RenderSystem.enableTexture(); } - public static void drawInscribedRect(int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight) + public static void drawInscribedRect(MatrixStack mStack, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight) { - drawInscribedRect(x, y, boundsWidth, boundsHeight, rectWidth, rectHeight, true, true); + drawInscribedRect(mStack, x, y, boundsWidth, boundsHeight, rectWidth, rectHeight, true, true); } - public static void drawInscribedRect(int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight, boolean centerX, boolean centerY) + public static void drawInscribedRect(MatrixStack mStack, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight, boolean centerX, boolean centerY) { if (rectWidth * boundsHeight > rectHeight * boundsWidth) { int h = boundsHeight; @@ -468,6 +471,6 @@ public class GuiUtils if (centerX) x += (w - boundsWidth) / 2; } - AbstractGui.blit(x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight); + AbstractGui.func_238466_a_(mStack, x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight); } } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/HoverChecker.java b/src/main/java/net/minecraftforge/fml/client/gui/HoverChecker.java deleted file mode 100644 index 8e2bef738..000000000 --- a/src/main/java/net/minecraftforge/fml/client/gui/HoverChecker.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.gui; - -import net.minecraft.client.gui.widget.Widget; - -/** - * This class implements an easy way to check if the mouse has hovered within a certain region of the screen for a given - * period of time. The region can be defined manually or by supplying a GuiButton object. - * - * @author bspkrs - */ -public class HoverChecker -{ - private int top, bottom, left, right, threshold; - private Widget widget; - private long hoverStart; - - public HoverChecker(int top, int bottom, int left, int right, int threshold) - { - this.top = top; - this.bottom = bottom; - this.left = left; - this.right = right; - this.threshold = threshold; - this.hoverStart = -1; - } - - public HoverChecker(Widget widget, int threshold) - { - this.widget = widget; - this.threshold = threshold; - } - - /** - * Call this method if the intended region has changed such as if the region must follow a scrolling list. - * It is not necessary to call this method if a GuiButton defines the hover region. - */ - public void updateBounds(int top, int bottom, int left, int right) - { - this.top = top; - this.bottom = bottom; - this.left = left; - this.right = right; - } - - /** - * Checks if the mouse is in the hover region. If the specified time period has elapsed the method returns true. - * The hover timer is reset if the mouse is not within the region. - */ - public boolean checkHover(int mouseX, int mouseY) - { - return checkHover(mouseX, mouseY, true); - } - - /** - * Checks if the mouse is in the hover region. If the specified time period has elapsed the method returns true. - * The hover timer is reset if the mouse is not within the region. - */ - public boolean checkHover(int mouseX, int mouseY, boolean canHover) - { - if (this.widget != null) - { - this.top = widget.y; - this.bottom = widget.y + widget.getHeight(); - this.left = widget.x; - this.right = widget.x + widget.getWidth(); - canHover = canHover && widget.visible; - } - - if (canHover && hoverStart == -1 && mouseY >= top && mouseY <= bottom && mouseX >= left && mouseX <= right) - hoverStart = System.currentTimeMillis(); - else if (!canHover || mouseY < top || mouseY > bottom || mouseX < left || mouseX > right) - resetHoverTimer(); - - return canHover && hoverStart != -1 && System.currentTimeMillis() - hoverStart >= threshold; - } - - /** - * Manually resets the hover timer. - */ - public void resetHoverTimer() - { - hoverStart = -1; - } -} diff --git a/src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java b/src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java index 140b7cb5a..cb6ea9bdb 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java @@ -19,6 +19,8 @@ package net.minecraftforge.fml.client.gui.screen; import net.minecraft.client.gui.widget.button.Button; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.fml.ForgeI18n; import net.minecraftforge.fml.StartupQuery; @@ -32,16 +34,16 @@ public class ConfirmationScreen extends NotificationScreen @Override protected void addConfirmationButtons() { - this.addButton(new Button(this.width / 2 - 104, this.height - PADDING - 20, 100, 20, ForgeI18n.parseMessage("gui.yes"), b -> + this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 104, this.field_230709_l_ - PADDING - 20, 100, 20, new StringTextComponent(ForgeI18n.parseMessage("gui.yes")), b -> { - ConfirmationScreen.this.minecraft.currentScreen = null; + ConfirmationScreen.this.field_230706_i_.currentScreen = null; query.setResult(true); query.finish(); } )); - this.addButton(new Button(this.width / 2 + 4, this.height - PADDING - 20, 100, 20, ForgeI18n.parseMessage("gui.no"), b -> + this.func_230480_a_(new Button(this.field_230708_k_ / 2 + 4, this.field_230709_l_ - PADDING - 20, 100, 20, new StringTextComponent(ForgeI18n.parseMessage("gui.no")), b -> { - ConfirmationScreen.this.minecraft.currentScreen = null; + ConfirmationScreen.this.field_230706_i_.currentScreen = null; query.setResult(false); query.finish(); } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/screen/LoadingErrorScreen.java b/src/main/java/net/minecraftforge/fml/client/gui/screen/LoadingErrorScreen.java index 544e56866..4e44bfe0e 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/screen/LoadingErrorScreen.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/screen/LoadingErrorScreen.java @@ -20,11 +20,14 @@ package net.minecraftforge.fml.client.gui.screen; import com.google.common.base.Strings; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.screen.ErrorScreen; import net.minecraft.client.gui.widget.list.ExtendedList; import net.minecraft.util.Util; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.ITextProperties; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.ForgeI18n; @@ -50,8 +53,8 @@ public class LoadingErrorScreen extends ErrorScreen { private final List modLoadErrors; private final List modLoadWarnings; private LoadingEntryList entryList; - private String errorHeader; - private String warningHeader; + private ITextComponent errorHeader; + private ITextComponent warningHeader; public LoadingErrorScreen(LoadingFailedException loadingException, List warnings) { @@ -63,95 +66,95 @@ public class LoadingErrorScreen extends ErrorScreen { } @Override - public void init() + public void func_231160_c_() { - super.init(); - this.buttons.clear(); - this.children.clear(); + super.func_231160_c_(); + this.field_230710_m_.clear(); + this.field_230705_e_.clear(); - this.errorHeader = TextFormatting.RED + ForgeI18n.parseMessage("fml.loadingerrorscreen.errorheader", this.modLoadErrors.size()) + TextFormatting.RESET; - this.warningHeader = TextFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadErrors.size()) + TextFormatting.RESET; + this.errorHeader = new StringTextComponent(TextFormatting.RED + ForgeI18n.parseMessage("fml.loadingerrorscreen.errorheader", this.modLoadErrors.size()) + TextFormatting.RESET); + this.warningHeader = new StringTextComponent(TextFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadErrors.size()) + TextFormatting.RESET); int yOffset = this.modLoadErrors.isEmpty() ? 46 : 38; - this.addButton(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, ForgeI18n.parseMessage("fml.button.open.mods.folder"), b -> Util.getOSType().openFile(modsDir.toFile()))); - this.addButton(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName()), b -> Util.getOSType().openFile(logFile.toFile()))); + this.func_230480_a_(new ExtendedButton(50, this.field_230709_l_ - yOffset, this.field_230708_k_ / 2 - 55, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.open.mods.folder")), b -> Util.getOSType().openFile(modsDir.toFile()))); + this.func_230480_a_(new ExtendedButton(this.field_230708_k_ / 2 + 5, this.field_230709_l_ - yOffset, this.field_230708_k_ / 2 - 55, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), b -> Util.getOSType().openFile(logFile.toFile()))); if (this.modLoadErrors.isEmpty()) { - this.addButton(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, ForgeI18n.parseMessage("fml.button.continue.launch"), b -> { + this.func_230480_a_(new ExtendedButton(this.field_230708_k_ / 4, this.field_230709_l_ - 24, this.field_230708_k_ / 2, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.continue.launch")), b -> { ClientHooks.logMissingTextureErrors(); - this.minecraft.displayGuiScreen(null); + this.field_230706_i_.displayGuiScreen(null); })); } this.entryList = new LoadingEntryList(this, this.modLoadErrors, this.modLoadWarnings); - this.children.add(this.entryList); - this.setFocused(this.entryList); + this.field_230705_e_.add(this.entryList); + this.func_231035_a_(this.entryList); } @Override - public void render(int mouseX, int mouseY, float partialTicks) + public void func_230430_a_(MatrixStack mStack, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(); - this.entryList.render(mouseX, mouseY, partialTicks); - drawMultiLineCenteredString(font, this.modLoadErrors.isEmpty() ? warningHeader : errorHeader, this.width / 2, 10); - this.buttons.forEach(button -> button.render(mouseX, mouseY, partialTicks)); + this.func_230446_a_(mStack); + this.entryList.func_230430_a_(mStack, mouseX, mouseY, partialTicks); + drawMultiLineCenteredString(mStack, field_230712_o_, this.modLoadErrors.isEmpty() ? warningHeader : errorHeader, this.field_230708_k_ / 2, 10); + this.field_230710_m_.forEach(button -> button.func_230430_a_(mStack, mouseX, mouseY, partialTicks)); } - private void drawMultiLineCenteredString(FontRenderer fr, String str, int x, int y) { - for (String s : fr.listFormattedStringToWidth(str, this.width)) { - fr.drawStringWithShadow(s, (float) (x - fr.getStringWidth(s) / 2.0), y, 0xFFFFFF); + private void drawMultiLineCenteredString(MatrixStack mStack, FontRenderer fr, ITextComponent str, int x, int y) { + for (ITextProperties s : fr.func_238425_b_(str, this.field_230708_k_)) { + fr.func_238407_a_(mStack, s, (float) (x - fr.func_238414_a_(s) / 2.0), y, 0xFFFFFF); y+=fr.FONT_HEIGHT; } } public static class LoadingEntryList extends ExtendedList { LoadingEntryList(final LoadingErrorScreen parent, final List errors, final List warnings) { - super(parent.minecraft, parent.width, parent.height, 35, parent.height - 50, 2 * parent.minecraft.fontRenderer.FONT_HEIGHT + 8); + super(parent.field_230706_i_, parent.field_230708_k_, parent.field_230709_l_, 35, parent.field_230709_l_ - 50, 2 * parent.field_230706_i_.fontRenderer.FONT_HEIGHT + 8); boolean both = !errors.isEmpty() && !warnings.isEmpty(); if (both) - addEntry(new LoadingMessageEntry(parent.errorHeader, true)); - errors.forEach(e->addEntry(new LoadingMessageEntry(e.formatToString()))); + func_230513_b_(new LoadingMessageEntry(parent.errorHeader, true)); + errors.forEach(e->func_230513_b_(new LoadingMessageEntry(new StringTextComponent(e.formatToString())))); if (both) { - int maxChars = (this.width - 10) / parent.minecraft.fontRenderer.getStringWidth("-"); - addEntry(new LoadingMessageEntry("\n" + Strings.repeat("-", maxChars) + "\n")); - addEntry(new LoadingMessageEntry(parent.warningHeader, true)); + int maxChars = (this.field_230670_d_ - 10) / parent.field_230706_i_.fontRenderer.getStringWidth("-"); + func_230513_b_(new LoadingMessageEntry(new StringTextComponent("\n" + Strings.repeat("-", maxChars) + "\n"))); + func_230513_b_(new LoadingMessageEntry(parent.warningHeader, true)); } - warnings.forEach(w->addEntry(new LoadingMessageEntry(w.formatToString()))); + warnings.forEach(w->func_230513_b_(new LoadingMessageEntry(new StringTextComponent(w.formatToString())))); } @Override - protected int getScrollbarPosition() + protected int func_230952_d_() { return this.getRight() - 6; } @Override - public int getRowWidth() + public int func_230949_c_() { - return this.width; + return this.field_230670_d_; } public class LoadingMessageEntry extends ExtendedList.AbstractListEntry { - private final String message; + private final ITextComponent message; private final boolean center; - LoadingMessageEntry(final String message) { + LoadingMessageEntry(final ITextComponent message) { this(message, false); } - LoadingMessageEntry(final String message, final boolean center) { + LoadingMessageEntry(final ITextComponent message, final boolean center) { this.message = Objects.requireNonNull(message); this.center = center; } @Override - public void render(int entryIdx, int top, int left, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean p_194999_5_, final float partialTicks) { + public void func_230432_a_(MatrixStack mStack, int entryIdx, int top, int left, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean p_194999_5_, final float partialTicks) { FontRenderer font = Minecraft.getInstance().fontRenderer; - final List strings = font.listFormattedStringToWidth(message, LoadingEntryList.this.width); + final List strings = font.func_238425_b_(message, LoadingEntryList.this.field_230670_d_); int y = top + 2; for (int i = 0; i < Math.min(strings.size(), 2); i++) { if (center) - font.drawString(strings.get(i), left + (width / 2F) - font.getStringWidth(strings.get(i)) / 2F, y, 0xFFFFFF); + font.func_238422_b_(mStack, strings.get(i), left + (field_230670_d_) - font.func_238414_a_(strings.get(i)) / 2F, y, 0xFFFFFF); else - font.drawString(strings.get(i), left + 5, y, 0xFFFFFF); + font.func_238422_b_(mStack, strings.get(i), left + 5, y, 0xFFFFFF); y += font.FONT_HEIGHT; } } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/screen/ModListScreen.java b/src/main/java/net/minecraftforge/fml/client/gui/screen/ModListScreen.java index bac0083fd..dc3397cdf 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/screen/ModListScreen.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/screen/ModListScreen.java @@ -30,6 +30,8 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; +import com.mojang.blaze3d.matrix.MatrixStack; +import net.minecraft.util.text.*; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -51,9 +53,6 @@ import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.I18n; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Util; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.client.gui.ScrollPanel; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.util.Size2i; @@ -91,8 +90,8 @@ public class ModListScreen extends Screen return compare(name1, name2); } - String getButtonText() { - return I18n.format("fml.menu.mods."+StringUtils.toLowerCase(name())); + ITextComponent getButtonText() { + return new TranslationTextComponent("fml.menu.mods." + StringUtils.toLowerCase(name())); } } @@ -131,7 +130,7 @@ public class ModListScreen extends Screen class InfoPanel extends ScrollPanel { private ResourceLocation logoPath; private Size2i logoDims = new Size2i(0, 0); - private List lines = Collections.emptyList(); + private List lines = Collections.emptyList(); InfoPanel(Minecraft mcIn, int widthIn, int heightIn, int topIn) { @@ -152,9 +151,9 @@ public class ModListScreen extends Screen this.lines = Collections.emptyList(); } - private List resizeContent(List lines) + private List resizeContent(List lines) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (String line : lines) { if (line == null) @@ -167,7 +166,7 @@ public class ModListScreen extends Screen int maxTextLength = this.width - 12; if (maxTextLength >= 0) { - ret.addAll(RenderComponentsUtil.splitText(chat, maxTextLength, ModListScreen.this.font, false, true)); + ret.addAll(field_230712_o_.func_238420_b_().func_238362_b_(chat, maxTextLength, Style.field_240709_b_)); } } return ret; @@ -177,7 +176,7 @@ public class ModListScreen extends Screen public int getContentHeight() { int height = 50; - height += (lines.size() * font.FONT_HEIGHT); + height += (lines.size() * field_230712_o_.FONT_HEIGHT); if (height < this.bottom - this.top - 8) height = this.bottom - this.top - 8; return height; @@ -186,11 +185,11 @@ public class ModListScreen extends Screen @Override protected int getScrollAmount() { - return font.FONT_HEIGHT * 3; + return field_230712_o_.FONT_HEIGHT * 3; } @Override - protected void drawPanel(int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY) + protected void drawPanel(MatrixStack mStack, int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY) { if (logoPath != null) { Minecraft.getInstance().getTextureManager().bindTexture(logoPath); @@ -198,29 +197,29 @@ public class ModListScreen extends Screen RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); // Draw the logo image inscribed in a rectangle with width entryWidth (minus some padding) and height 50 int headerHeight = 50; - GuiUtils.drawInscribedRect(left + PADDING, relativeY, width - (PADDING * 2), headerHeight, logoDims.width, logoDims.height, false, true); + GuiUtils.drawInscribedRect(mStack, left + PADDING, relativeY, width - (PADDING * 2), headerHeight, logoDims.width, logoDims.height, false, true); relativeY += headerHeight + PADDING; } - for (ITextComponent line : lines) + for (ITextProperties line : lines) { if (line != null) { RenderSystem.enableBlend(); - ModListScreen.this.font.drawStringWithShadow(line.getFormattedText(), left + PADDING, relativeY, 0xFFFFFF); + ModListScreen.this.field_230712_o_.func_238407_a_(mStack, line, left + PADDING, relativeY, 0xFFFFFF); RenderSystem.disableAlphaTest(); RenderSystem.disableBlend(); } - relativeY += font.FONT_HEIGHT; + relativeY += field_230712_o_.FONT_HEIGHT; } - final ITextComponent component = findTextLine(mouseX, mouseY); + final Style component = findTextLine(mouseX, mouseY); if (component!=null) { - ModListScreen.this.renderComponentHoverEffect(component, mouseX, mouseY); + ModListScreen.this.func_238653_a_(mStack, component, mouseX, mouseY); } } - private ITextComponent findTextLine(final int mouseX, final int mouseY) { + private Style findTextLine(final int mouseX, final int mouseY) { double offset = (mouseY - top) + border + scrollDistance + 1; if (logoPath != null) { offset -= 50; @@ -228,35 +227,26 @@ public class ModListScreen extends Screen if (offset <= 0) return null; - int lineIdx = (int) (offset / font.FONT_HEIGHT); + int lineIdx = (int) (offset / field_230712_o_.FONT_HEIGHT); if (lineIdx >= lines.size() || lineIdx < 1) return null; - ITextComponent line = lines.get(lineIdx-1); + ITextProperties line = lines.get(lineIdx-1); if (line != null) { - int k = left + border; - for (ITextComponent part : line) { - if (!(part instanceof StringTextComponent)) - continue; - k += ModListScreen.this.font.getStringWidth(((StringTextComponent)part).getText()); - if (k >= mouseX) - { - return part; - } - } + return field_230712_o_.func_238420_b_().func_238357_a_(line, mouseX); } return null; } @Override - public boolean mouseClicked(final double mouseX, final double mouseY, final int button) { - final ITextComponent component = findTextLine((int) mouseX, (int) mouseY); + public boolean func_231044_a_(final double mouseX, final double mouseY, final int button) { + final Style component = findTextLine((int) mouseX, (int) mouseY); if (component != null) { - ModListScreen.this.handleComponentClicked(component); + ModListScreen.this.func_230455_a_(component); return true; } - return super.mouseClicked(mouseX, mouseY, button); + return super.func_231044_a_(mouseX, mouseY, button); } @Override @@ -265,50 +255,50 @@ public class ModListScreen extends Screen } @Override - public void init() + public void func_231160_c_() { for (ModInfo mod : mods) { listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getDisplayName()) + 10); listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(MavenVersionStringHelper.artifactVersionToString(mod.getVersion())) + 5); } - listWidth = Math.max(Math.min(listWidth, width/3), 100); + listWidth = Math.max(Math.min(listWidth, field_230708_k_/3), 100); listWidth += listWidth % numButtons != 0 ? (numButtons - listWidth % numButtons) : 0; - int modInfoWidth = this.width - this.listWidth - (PADDING * 3); + int modInfoWidth = this.field_230708_k_ - this.listWidth - (PADDING * 3); int doneButtonWidth = Math.min(modInfoWidth, 200); - int y = this.height - 20 - PADDING; - this.addButton(new Button(((listWidth + PADDING + this.width - doneButtonWidth) / 2), y, doneButtonWidth, 20, - I18n.format("gui.done"), b -> ModListScreen.this.onClose())); - this.addButton(this.openModsFolderButton = new Button(6, y, this.listWidth, 20, - I18n.format("fml.menu.mods.openmodsfolder"), b -> Util.getOSType().openFile(FMLPaths.MODSDIR.get().toFile()))); + int y = this.field_230709_l_ - 20 - PADDING; + this.func_230480_a_(new Button(((listWidth + PADDING + this.field_230708_k_ - doneButtonWidth) / 2), y, doneButtonWidth, 20, + new TranslationTextComponent("gui.done"), b -> ModListScreen.this.func_231175_as__())); + this.func_230480_a_(this.openModsFolderButton = new Button(6, y, this.listWidth, 20, + new TranslationTextComponent("fml.menu.mods.openmodsfolder"), b -> Util.getOSType().openFile(FMLPaths.MODSDIR.get().toFile()))); y -= 20 + PADDING; - this.addButton(this.configButton = new Button(6, y, this.listWidth, 20, - I18n.format("fml.menu.mods.config"), b -> ModListScreen.this.displayModConfig())); - this.configButton.active = false; + this.func_230480_a_(this.configButton = new Button(6, y, this.listWidth, 20, + new TranslationTextComponent("fml.menu.mods.config"), b -> ModListScreen.this.displayModConfig())); + this.configButton.field_230693_o_ = false; y -= 14 + PADDING + 1; - search = new TextFieldWidget(getFontRenderer(), PADDING + 1, y, listWidth - 2, 14, I18n.format("fml.menu.mods.search")); + search = new TextFieldWidget(getFontRenderer(), PADDING + 1, y, listWidth - 2, 14, new TranslationTextComponent("fml.menu.mods.search")); int fullButtonHeight = PADDING + 20 + PADDING; - this.modList = new ModListWidget(this, listWidth, fullButtonHeight, search.y - getFontRenderer().FONT_HEIGHT - PADDING); - this.modList.setLeftPos(6); + this.modList = new ModListWidget(this, listWidth, fullButtonHeight, search.field_230691_m_ - getFontRenderer().FONT_HEIGHT - PADDING); + this.modList.func_230959_g_(6); - this.modInfo = new InfoPanel(this.minecraft, modInfoWidth, this.height - PADDING - fullButtonHeight, PADDING); + this.modInfo = new InfoPanel(this.field_230706_i_, modInfoWidth, this.field_230709_l_ - PADDING - fullButtonHeight, PADDING); - children.add(search); - children.add(modList); - children.add(modInfo); + field_230705_e_.add(search); + field_230705_e_.add(modList); + field_230705_e_.add(modInfo); search.setFocused2(false); search.setCanLoseFocus(true); final int width = listWidth / numButtons; int x = PADDING; - addButton(SortType.NORMAL.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.NORMAL.getButtonText(), b -> resortMods(SortType.NORMAL))); + func_230480_a_(SortType.NORMAL.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.NORMAL.getButtonText(), b -> resortMods(SortType.NORMAL))); x += width + buttonMargin; - addButton(SortType.A_TO_Z.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.A_TO_Z.getButtonText(), b -> resortMods(SortType.A_TO_Z))); + func_230480_a_(SortType.A_TO_Z.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.A_TO_Z.getButtonText(), b -> resortMods(SortType.A_TO_Z))); x += width + buttonMargin; - addButton(SortType.Z_TO_A.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.Z_TO_A.getButtonText(), b -> resortMods(SortType.Z_TO_A))); + func_230480_a_(SortType.Z_TO_A.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.Z_TO_A.getButtonText(), b -> resortMods(SortType.Z_TO_A))); resortMods(SortType.NORMAL); updateCache(); } @@ -318,7 +308,7 @@ public class ModListScreen extends Screen if (selected == null) return; try { - ConfigGuiHandler.getGuiFactoryFor(selected.getInfo()).map(f->f.apply(this.minecraft, this)).ifPresent(newScreen -> this.minecraft.displayGuiScreen(newScreen)); + ConfigGuiHandler.getGuiFactoryFor(selected.getInfo()).map(f->f.apply(this.field_230706_i_, this)).ifPresent(newScreen -> this.field_230706_i_.displayGuiScreen(newScreen)); } catch (final Exception e) { @@ -327,10 +317,10 @@ public class ModListScreen extends Screen } @Override - public void tick() + public void func_231023_e_() { search.tick(); - modList.setSelected(selected); + modList.func_241215_a_(selected); if (!search.getText().equals(lastFilterText)) { @@ -345,7 +335,7 @@ public class ModListScreen extends Screen modList.refreshList(); if (selected != null) { - selected = modList.children().stream().filter(e -> e.getInfo() == selected.getInfo()).findFirst().orElse(null); + selected = modList.func_231039_at__().stream().filter(e -> e.getInfo() == selected.getInfo()).findFirst().orElse(null); updateCache(); } sorted = true; @@ -371,33 +361,33 @@ public class ModListScreen extends Screen for (SortType sort : SortType.values()) { if (sort.button != null) - sort.button.active = sortType != sort; + sort.button.field_230693_o_ = sortType != sort; } sorted = false; } @Override - public void render(int mouseX, int mouseY, float partialTicks) + public void func_230430_a_(MatrixStack mStack, int mouseX, int mouseY, float partialTicks) { - this.modList.render(mouseX, mouseY, partialTicks); + this.modList.func_230430_a_(mStack, mouseX, mouseY, partialTicks); if (this.modInfo != null) - this.modInfo.render(mouseX, mouseY, partialTicks); + this.modInfo.func_230430_a_(mStack, mouseX, mouseY, partialTicks); - String text = I18n.format("fml.menu.mods.search"); - int x = modList.getLeft() + ((modList.getRight() - modList.getLeft()) / 2) - (getFontRenderer().getStringWidth(text) / 2); - getFontRenderer().drawString(text, x, search.y - getFontRenderer().FONT_HEIGHT, 0xFFFFFF); - this.search.render(mouseX, mouseY, partialTicks); - super.render(mouseX, mouseY, partialTicks); + ITextComponent text = new TranslationTextComponent("fml.menu.mods.search"); + int x = modList.getLeft() + ((modList.getRight() - modList.getLeft()) / 2) - (getFontRenderer().func_238414_a_(text) / 2); + getFontRenderer().func_238422_b_(mStack, text, x, search.field_230691_m_ - getFontRenderer().FONT_HEIGHT, 0xFFFFFF); + this.search.func_230430_a_(mStack, mouseX , mouseY, partialTicks); + super.func_230430_a_(mStack, mouseX, mouseY, partialTicks); } public Minecraft getMinecraftInstance() { - return minecraft; + return field_230706_i_; } public FontRenderer getFontRenderer() { - return font; + return field_230712_o_; } public void setSelected(ModListWidget.ModEntry entry) @@ -409,18 +399,18 @@ public class ModListScreen extends Screen private void updateCache() { if (selected == null) { - this.configButton.active = false; + this.configButton.field_230693_o_ = false; this.modInfo.clearInfo(); return; } ModInfo selectedMod = selected.getInfo(); - this.configButton.active = ConfigGuiHandler.getGuiFactoryFor(selectedMod).isPresent(); + this.configButton.field_230693_o_ = ConfigGuiHandler.getGuiFactoryFor(selectedMod).isPresent(); List lines = new ArrayList<>(); VersionChecker.CheckResult vercheck = VersionChecker.getResult(selectedMod); Pair logoData = selectedMod.getLogoFile().map(logoFile-> { - TextureManager tm = this.minecraft.getTextureManager(); + TextureManager tm = this.field_230706_i_.getTextureManager(); final ModFileResourcePack resourcePack = ResourcePackLoader.getResourcePackFor(selectedMod.getModId()) .orElse(ResourcePackLoader.getResourcePackFor("forge"). orElseThrow(()->new RuntimeException("Can't find forge, WHAT!"))); @@ -487,12 +477,12 @@ public class ModListScreen extends Screen } @Override - public void resize(Minecraft mc, int width, int height) + public void func_231152_a_(Minecraft mc, int width, int height) { String s = this.search.getText(); SortType sort = this.sortType; ModListWidget.ModEntry selected = this.selected; - this.init(mc, width, height); + this.func_231158_b_(mc, width, height); this.search.setText(s); this.selected = selected; if (!this.search.getText().isEmpty()) @@ -503,8 +493,8 @@ public class ModListScreen extends Screen } @Override - public void onClose() + public void func_231175_as__() { - this.minecraft.displayGuiScreen(this.parentScreen); + this.field_230706_i_.displayGuiScreen(this.parentScreen); } } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java b/src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java index 94a0c91a8..cc5130728 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java @@ -19,6 +19,7 @@ package net.minecraftforge.fml.client.gui.screen; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.Minecraft; @@ -41,22 +42,22 @@ public class NotificationScreen extends Screen protected int getContentHeight() { int height = 0; - height += (textLines.length * font.FONT_HEIGHT) + 4; + height += (textLines.length * field_230712_o_.FONT_HEIGHT) + 4; if (height < this.height - 50) height = this.height - 50; return height; } @Override - protected void drawPanel(int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY) + protected void drawPanel(MatrixStack mStack, int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY) { - drawCenteredLines(relativeY, textLines); + drawCenteredLines(mStack, relativeY, textLines); } @Override protected int getScrollAmount() { - return font.FONT_HEIGHT * 3; + return field_230712_o_.FONT_HEIGHT * 3; } } @@ -80,53 +81,53 @@ public class NotificationScreen extends Screen } @Override - public void init() + public void func_231160_c_() { - super.init(); - int panelY = PADDING + headerLines.length * font.FONT_HEIGHT + PADDING; - int panelHeight = this.height - PADDING - 20 - panelY; + super.func_231160_c_(); + int panelY = PADDING + headerLines.length * field_230712_o_.FONT_HEIGHT + PADDING; + int panelHeight = this.field_230709_l_ - PADDING - 20 - panelY; if (!action.isEmpty()) { - panelHeight = panelHeight - font.FONT_HEIGHT - PADDING; + panelHeight = panelHeight - field_230712_o_.FONT_HEIGHT - PADDING; } - textPanel = new TextPanel(this.minecraft, this.width - (PADDING * 2), panelHeight, panelY, PADDING); - this.children.add(textPanel); + textPanel = new TextPanel(this.field_230706_i_, this.field_230708_k_ - (PADDING * 2), panelHeight, panelY, PADDING); + this.field_230705_e_.add(textPanel); addConfirmationButtons(); } protected void addConfirmationButtons() { - this.buttons.add(new Button(this.width / 2 - 100, this.height - PADDING - 20, 200, 20, I18n.format("gui.done"), b -> { - NotificationScreen.this.minecraft.displayGuiScreen(null); + this.field_230710_m_.add(new Button(this.field_230708_k_ / 2 - 100, this.field_230709_l_ - PADDING - 20, 200, 20, new TranslationTextComponent("gui.done"), b -> { + NotificationScreen.this.field_230706_i_.displayGuiScreen(null); query.finish(); })); } @Override - public void render(int mouseX, int mouseY, float partialTicks) + public void func_230430_a_(MatrixStack mStack, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(); + this.func_230446_a_(mStack); - drawCenteredLines(PADDING, headerLines); + drawCenteredLines(mStack, PADDING, headerLines); if (textPanel != null) { - textPanel.render(mouseX, mouseY, partialTicks); + textPanel.func_230430_a_(mStack, mouseX, mouseY, partialTicks); } if (!action.isEmpty()) { - drawCenteredString(font, action, this.width / 2, this.height - PADDING - 20 - font.FONT_HEIGHT, -1); + func_238471_a_(mStack, field_230712_o_, action, this.field_230708_k_ / 2, this.field_230709_l_ - PADDING - 20 - field_230712_o_.FONT_HEIGHT, -1); } - super.render(mouseX, mouseY, partialTicks); + super.func_230430_a_(mStack, mouseX, mouseY, partialTicks); } - protected void drawCenteredLines(int yStart, String... lines) + protected void drawCenteredLines(MatrixStack mStack, int yStart, String... lines) { for (String line : lines) { if (!line.isEmpty()) - this.drawCenteredString(font, line, this.width / 2, yStart, 0xFFFFFF); - yStart += font.FONT_HEIGHT; + this.func_238471_a_(mStack, field_230712_o_, line, this.field_230708_k_ / 2, yStart, 0xFFFFFF); + yStart += field_230712_o_.FONT_HEIGHT; } } } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/widget/ExtendedButton.java b/src/main/java/net/minecraftforge/fml/client/gui/widget/ExtendedButton.java index 312394142..925ebb793 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/widget/ExtendedButton.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/widget/ExtendedButton.java @@ -19,8 +19,12 @@ package net.minecraftforge.fml.client.gui.widget; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.widget.button.Button; +import net.minecraft.util.text.IFormattableTextComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.fml.client.gui.GuiUtils; /** @@ -35,7 +39,7 @@ import net.minecraftforge.fml.client.gui.GuiUtils; */ public class ExtendedButton extends Button { - public ExtendedButton(int xPos, int yPos, int width, int height, String displayString, IPressable handler) + public ExtendedButton(int xPos, int yPos, int width, int height, ITextComponent displayString, IPressable handler) { super(xPos, yPos, width, height, displayString, handler); } @@ -44,24 +48,25 @@ public class ExtendedButton extends Button * Draws this button to the screen. */ @Override - public void renderButton(int mouseX, int mouseY, float partial) + public void func_230431_b_(MatrixStack mStack, int mouseX, int mouseY, float partial) { - if (this.visible) + if (this.field_230694_p_) { Minecraft mc = Minecraft.getInstance(); - this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; - int k = this.getYImage(this.isHovered); - GuiUtils.drawContinuousTexturedBox(WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset()); - this.renderBg(mc, mouseX, mouseY); + this.field_230692_n_ = mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + this.field_230688_j_ && mouseY < this.field_230691_m_ + this.field_230689_k_; + int k = this.func_230989_a_(this.func_230449_g_()); + GuiUtils.drawContinuousTexturedBox(field_230687_i_, this.field_230690_l_, this.field_230691_m_, 0, 46 + k * 20, this.field_230688_j_, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_()); + this.func_230441_a_(mStack, mc, mouseX, mouseY); - String buttonText = this.getMessage(); - int strWidth = mc.fontRenderer.getStringWidth(buttonText); + ITextComponent buttonText = this.func_230442_c_(); + int strWidth = mc.fontRenderer.func_238414_a_(buttonText); int ellipsisWidth = mc.fontRenderer.getStringWidth("..."); - if (strWidth > width - 6 && strWidth > ellipsisWidth) - buttonText = mc.fontRenderer.trimStringToWidth(buttonText, width - 6 - ellipsisWidth).trim() + "..."; + if (strWidth > field_230688_j_ - 6 && strWidth > ellipsisWidth) + //TODO, srg names make it hard to figure out how to append to an ITextProperties from this trim operation, wraping this in StringTextComponent is kinda dirty. + buttonText = new StringTextComponent(mc.fontRenderer.func_238417_a_(buttonText, field_230688_j_ - 6 - ellipsisWidth).getString() + "..."); - this.drawCenteredString(mc.fontRenderer, buttonText, this.x + this.width / 2, this.y + (this.height - 8) / 2, getFGColor()); + this.func_238472_a_(mStack, mc.fontRenderer, buttonText, this.field_230690_l_ + this.field_230688_j_ / 2, this.field_230691_m_ + (this.field_230689_k_ - 8) / 2, getFGColor()); } } } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/widget/ModListWidget.java b/src/main/java/net/minecraftforge/fml/client/gui/widget/ModListWidget.java index b4150747b..e5a691990 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/widget/ModListWidget.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/widget/ModListWidget.java @@ -19,11 +19,14 @@ package net.minecraftforge.fml.client.gui.widget; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.widget.list.ExtendedList; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.fml.client.gui.screen.ModListScreen; import net.minecraftforge.versions.forge.ForgeVersion; import net.minecraftforge.fml.MavenVersionStringHelper; @@ -42,33 +45,33 @@ public class ModListWidget extends ExtendedList public ModListWidget(ModListScreen parent, int listWidth, int top, int bottom) { - super(parent.getMinecraftInstance(), listWidth, parent.height, top, bottom, parent.getFontRenderer().FONT_HEIGHT * 2 + 8); + super(parent.getMinecraftInstance(), listWidth, parent.field_230709_l_, top, bottom, parent.getFontRenderer().FONT_HEIGHT * 2 + 8); this.parent = parent; this.listWidth = listWidth; this.refreshList(); } @Override - protected int getScrollbarPosition() + protected int func_230952_d_() { return this.listWidth; } @Override - public int getRowWidth() + public int func_230949_c_() { return this.listWidth; } public void refreshList() { - this.clearEntries(); - parent.buildModList(this::addEntry, mod->new ModEntry(mod, this.parent)); + this.func_230963_j_(); + parent.buildModList(this::func_230513_b_, mod->new ModEntry(mod, this.parent)); } @Override - protected void renderBackground() + protected void func_230433_a_(MatrixStack mStack) { - this.parent.renderBackground(); + this.parent.func_230446_a_(mStack); } public class ModEntry extends ExtendedList.AbstractListEntry { @@ -81,30 +84,30 @@ public class ModListWidget extends ExtendedList } @Override - public void render(int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) + public void func_230432_a_(MatrixStack mStack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) { - String name = stripControlCodes(modInfo.getDisplayName()); - String version = stripControlCodes(MavenVersionStringHelper.artifactVersionToString(modInfo.getVersion())); + ITextComponent name = new StringTextComponent(stripControlCodes(modInfo.getDisplayName())); + ITextComponent version = new StringTextComponent(stripControlCodes(MavenVersionStringHelper.artifactVersionToString(modInfo.getVersion()))); VersionChecker.CheckResult vercheck = VersionChecker.getResult(modInfo); FontRenderer font = this.parent.getFontRenderer(); - font.drawString(font.trimStringToWidth(name, listWidth),left + 3, top + 2, 0xFFFFFF); - font.drawString(font.trimStringToWidth(version, listWidth), left + 3 , top + 2 + font.FONT_HEIGHT, 0xCCCCCC); + font.func_238422_b_(mStack, font.func_238417_a_(name, listWidth),left + 3, top + 2, 0xFFFFFF); + font.func_238422_b_(mStack, font.func_238417_a_(version, listWidth), left + 3 , top + 2 + font.FONT_HEIGHT, 0xCCCCCC); if (vercheck.status.shouldDraw()) { //TODO: Consider adding more icons for visualization Minecraft.getInstance().getTextureManager().bindTexture(VERSION_CHECK_ICONS); RenderSystem.color4f(1, 1, 1, 1); RenderSystem.pushMatrix(); - AbstractGui.blit(getLeft() + width - 12, top + entryHeight / 4, vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16); + AbstractGui.func_238463_a_(mStack, getLeft() + field_230670_d_ - 12, top + entryHeight / 4, vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16); RenderSystem.popMatrix(); } } @Override - public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) + public boolean func_231044_a_(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) { parent.setSelected(this); - ModListWidget.this.setSelected(this); + ModListWidget.this.func_241215_a_(this); return false; } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/widget/Slider.java b/src/main/java/net/minecraftforge/fml/client/gui/widget/Slider.java index a8d66e77a..271202873 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/widget/Slider.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/widget/Slider.java @@ -19,7 +19,10 @@ package net.minecraftforge.fml.client.gui.widget; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.Minecraft; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.fml.client.gui.GuiUtils; import javax.annotation.Nullable; @@ -34,7 +37,7 @@ public class Slider extends ExtendedButton /** The value of this slider control. */ public double sliderValue = 1.0F; - public String dispString = ""; + public ITextComponent dispString; /** Is this slider control being dragged. */ public boolean dragging = false; @@ -47,16 +50,16 @@ public class Slider extends ExtendedButton @Nullable public ISlider parent = null; - public String suffix = ""; + public ITextComponent suffix; public boolean drawString = true; - public Slider(int xPos, int yPos, int width, int height, String prefix, String suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, IPressable handler) + public Slider(int xPos, int yPos, int width, int height, ITextComponent prefix, ITextComponent suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, IPressable handler) { this(xPos, yPos, width, height, prefix, suf, minVal, maxVal, currentVal, showDec, drawStr, handler, null); } - public Slider(int xPos, int yPos, int width, int height, String prefix, String suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, IPressable handler, @Nullable ISlider par) + public Slider(int xPos, int yPos, int width, int height, ITextComponent prefix, ITextComponent suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, IPressable handler, @Nullable ISlider par) { super(xPos, yPos, width, height, prefix, handler); minValue = minVal; @@ -79,16 +82,16 @@ public class Slider extends ExtendedButton precision = 0; } - setMessage(dispString + val + suffix); + func_238482_a_(new StringTextComponent("").func_230529_a_(dispString).func_240702_b_(val).func_230529_a_(suffix)); drawString = drawStr; if(!drawString) - setMessage(""); + func_238482_a_(new StringTextComponent("")); } - public Slider(int xPos, int yPos, String displayStr, double minVal, double maxVal, double currentVal, IPressable handler, ISlider par) + public Slider(int xPos, int yPos, ITextComponent displayStr, double minVal, double maxVal, double currentVal, IPressable handler, ISlider par) { - this(xPos, yPos, 150, 20, displayStr, "", minVal, maxVal, currentVal, true, true, handler, par); + this(xPos, yPos, 150, 20, displayStr, new StringTextComponent(""), minVal, maxVal, currentVal, true, true, handler, par); } /** @@ -96,7 +99,7 @@ public class Slider extends ExtendedButton * this button. */ @Override - public int getYImage(boolean par1) + public int func_230989_a_(boolean par1) { return 0; } @@ -105,17 +108,17 @@ public class Slider extends ExtendedButton * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e). */ @Override - protected void renderBg(Minecraft par1Minecraft, int par2, int par3) + protected void func_230441_a_(MatrixStack mStack, Minecraft par1Minecraft, int par2, int par3) { - if (this.visible) + if (this.field_230694_p_) { if (this.dragging) { - this.sliderValue = (par2 - (this.x + 4)) / (float)(this.width - 8); + this.sliderValue = (par2 - (this.field_230690_l_ + 4)) / (float)(this.field_230688_j_ - 8); updateSlider(); } - GuiUtils.drawContinuousTexturedBox(WIDGETS_LOCATION, this.x + (int)(this.sliderValue * (float)(this.width - 8)), this.y, 0, 66, 8, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset()); + GuiUtils.drawContinuousTexturedBox(field_230687_i_, this.field_230690_l_ + (int)(this.sliderValue * (float)(this.field_230688_j_ - 8)), this.field_230691_m_, 0, 66, 8, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_()); } } @@ -124,9 +127,9 @@ public class Slider extends ExtendedButton * e). */ @Override - public void onClick(double mouseX, double mouseY) + public void func_230982_a_(double mouseX, double mouseY) { - this.sliderValue = (mouseX - (this.x + 4)) / (this.width - 8); + this.sliderValue = (mouseX - (this.field_230690_l_ + 4)) / (this.field_230688_j_ - 8); updateSlider(); this.dragging = true; } @@ -173,7 +176,7 @@ public class Slider extends ExtendedButton if(drawString) { - setMessage(dispString + val + suffix); + func_238482_a_(new StringTextComponent("").func_230529_a_(dispString).func_240702_b_(val).func_230529_a_(suffix)); } if (parent != null) @@ -186,7 +189,7 @@ public class Slider extends ExtendedButton * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e). */ @Override - public void onRelease(double mouseX, double mouseY) + public void func_231000_a__(double mouseX, double mouseY) { this.dragging = false; } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/widget/UnicodeGlyphButton.java b/src/main/java/net/minecraftforge/fml/client/gui/widget/UnicodeGlyphButton.java index 046adad55..989e17955 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/widget/UnicodeGlyphButton.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/widget/UnicodeGlyphButton.java @@ -19,10 +19,12 @@ package net.minecraftforge.fml.client.gui.widget; -import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.widget.button.Button; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.fml.client.gui.GuiUtils; /** @@ -35,7 +37,7 @@ public class UnicodeGlyphButton extends ExtendedButton public String glyph; public float glyphScale; - public UnicodeGlyphButton(int xPos, int yPos, int width, int height, String displayString, String glyph, float glyphScale, IPressable handler) + public UnicodeGlyphButton(int xPos, int yPos, int width, int height, ITextComponent displayString, String glyph, float glyphScale, IPressable handler) { super(xPos, yPos, width, height, displayString, handler); this.glyph = glyph; @@ -43,37 +45,38 @@ public class UnicodeGlyphButton extends ExtendedButton } @Override - public void render(int mouseX, int mouseY, float partial) + public void func_230430_a_(MatrixStack mStack, int mouseX, int mouseY, float partial) { - if (this.visible) + if (this.field_230694_p_) { Minecraft mc = Minecraft.getInstance(); - this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; - int k = this.getYImage(this.isHovered); - GuiUtils.drawContinuousTexturedBox(Button.WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset()); - this.renderBg(mc, mouseX, mouseY); + this.field_230692_n_ = mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + this.field_230688_j_ && mouseY < this.field_230691_m_ + this.field_230689_k_; + int k = this.func_230989_a_(this.field_230692_n_); + GuiUtils.drawContinuousTexturedBox(Button.field_230687_i_, this.field_230690_l_, this.field_230691_m_, 0, 46 + k * 20, this.field_230688_j_, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_()); + this.func_230441_a_(mStack, mc, mouseX, mouseY); - String buttonText = this.getMessage(); + ITextComponent buttonText = this.func_230442_c_(); int glyphWidth = (int) (mc.fontRenderer.getStringWidth(glyph) * glyphScale); - int strWidth = mc.fontRenderer.getStringWidth(buttonText); + int strWidth = mc.fontRenderer.func_238414_a_(buttonText); int ellipsisWidth = mc.fontRenderer.getStringWidth("..."); int totalWidth = strWidth + glyphWidth; - if (totalWidth > width - 6 && totalWidth > ellipsisWidth) - buttonText = mc.fontRenderer.trimStringToWidth(buttonText, width - 6 - ellipsisWidth).trim() + "..."; + if (totalWidth > field_230688_j_ - 6 && totalWidth > ellipsisWidth) + buttonText = new StringTextComponent(mc.fontRenderer.func_238417_a_(buttonText, field_230688_j_ - 6 - ellipsisWidth).getString().trim() + "...") ; - strWidth = mc.fontRenderer.getStringWidth(buttonText); + strWidth = mc.fontRenderer.func_238414_a_(buttonText); totalWidth = glyphWidth + strWidth; - RenderSystem.pushMatrix(); - RenderSystem.scalef(glyphScale, glyphScale, 1.0F); - this.drawCenteredString(mc.fontRenderer, glyph, - (int) (((this.x + (this.width / 2) - (strWidth / 2)) / glyphScale) - (glyphWidth / (2 * glyphScale)) + 2), - (int) (((this.y + ((this.height - 8) / glyphScale) / 2) - 1) / glyphScale), getFGColor()); - RenderSystem.popMatrix(); + mStack.push(); + mStack.scale(glyphScale, glyphScale, 1.0F); + this.func_238472_a_(mStack, mc.fontRenderer, new StringTextComponent(glyph), + (int) (((this.field_230690_l_ + (this.field_230688_j_ / 2) - (strWidth / 2)) / glyphScale) - (glyphWidth / (2 * glyphScale)) + 2), + (int) (((this.field_230691_m_ + ((this.field_230689_k_ - 8) / glyphScale) / 2) - 1) / glyphScale), getFGColor()); + mStack.pop(); + + this.func_238472_a_(mStack, mc.fontRenderer, buttonText, (int) (this.field_230690_l_ + (this.field_230688_j_ / 2) + (glyphWidth / glyphScale)), + this.field_230691_m_ + (this.field_230689_k_ - 8) / 2, getFGColor()); - this.drawCenteredString(mc.fontRenderer, buttonText, (int) (this.x + (this.width / 2) + (glyphWidth / glyphScale)), - this.y + (this.height - 8) / 2, getFGColor()); } } } diff --git a/src/main/java/net/minecraftforge/fml/hooks/BasicEventHooks.java b/src/main/java/net/minecraftforge/fml/hooks/BasicEventHooks.java index 1cac280e0..af4c72a8b 100644 --- a/src/main/java/net/minecraftforge/fml/hooks/BasicEventHooks.java +++ b/src/main/java/net/minecraftforge/fml/hooks/BasicEventHooks.java @@ -24,7 +24,6 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.client.model.animation.Animation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerEvent; @@ -33,10 +32,11 @@ import net.minecraftforge.event.TickEvent; public class BasicEventHooks { - public static void firePlayerChangedDimensionEvent(PlayerEntity player, DimensionType fromDim, DimensionType toDim) - { - MinecraftForge.EVENT_BUS.post(new PlayerEvent.PlayerChangedDimensionEvent(player, fromDim, toDim)); - } + //TODO Dimensions.. +// public static void firePlayerChangedDimensionEvent(PlayerEntity player, DimensionType fromDim, DimensionType toDim) +// { +// MinecraftForge.EVENT_BUS.post(new PlayerEvent.PlayerChangedDimensionEvent(player, fromDim, toDim)); +// } public static void firePlayerLoggedIn(PlayerEntity player) { diff --git a/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java b/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java index 6e7e4b859..0794329e5 100644 --- a/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java +++ b/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java @@ -32,11 +32,9 @@ import net.minecraft.inventory.container.ContainerType; import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraft.world.biome.FuzzedBiomeMagnifier; -import net.minecraft.world.dimension.DimensionType; -import net.minecraftforge.common.ModDimension; import net.minecraftforge.fml.LogicalSidedProvider; import net.minecraft.util.registry.Registry; import net.minecraft.util.text.ITextComponent; @@ -79,7 +77,7 @@ public class FMLPlayMessages this.pitch = (byte) MathHelper.floor(e.rotationPitch * 256.0F / 360.0F); this.yaw = (byte) MathHelper.floor(e.rotationYaw * 256.0F / 360.0F); this.headYaw = (byte) (e.getRotationYawHead() * 256.0F / 360.0F); - Vec3d vec3d = e.getMotion(); + Vector3d vec3d = e.getMotion(); double d1 = MathHelper.clamp(vec3d.x, -3.9D, 3.9D); double d2 = MathHelper.clamp(vec3d.y, -3.9D, 3.9D); double d3 = MathHelper.clamp(vec3d.z, -3.9D, 3.9D); @@ -311,7 +309,8 @@ public class FMLPlayMessages } } - public static class DimensionInfoMessage + //TODO Dimensions.. + /*public static class DimensionInfoMessage { private ResourceLocation dimName; private boolean skylight; @@ -365,5 +364,5 @@ public class FMLPlayMessages contextSupplier.get().enqueueWork(()-> NetworkHooks.addCachedDimensionType(message.makeDummyDimensionType(), message.dimName)); return true; } - } + }*/ } diff --git a/src/main/java/net/minecraftforge/fml/network/NetworkHooks.java b/src/main/java/net/minecraftforge/fml/network/NetworkHooks.java index 348efba2a..d1ca457fe 100644 --- a/src/main/java/net/minecraftforge/fml/network/NetworkHooks.java +++ b/src/main/java/net/minecraftforge/fml/network/NetworkHooks.java @@ -26,13 +26,8 @@ import java.util.function.Consumer; import java.util.function.Supplier; import java.util.stream.Collectors; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.minecraft.util.registry.Registry; import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.fml.common.thread.EffectiveSide; -import net.minecraftforge.registries.ClearableRegistry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -112,13 +107,14 @@ public class NetworkHooks FMLMCRegisterPacketHandler.INSTANCE.sendRegistry(manager, NetworkDirection.valueOf(direction)); } - public synchronized static void sendDimensionDataPacket(NetworkManager manager, ServerPlayerEntity player) { + //TODO Dimensions.. +/* public synchronized static void sendDimensionDataPacket(NetworkManager manager, ServerPlayerEntity player) { // don't send vanilla dims if (player.dimension.isVanilla()) return; // don't sent to local - we already have a valid dim registry locally if (manager.isLocalChannel()) return; FMLNetworkConstants.playChannel.sendTo(new FMLPlayMessages.DimensionInfoMessage(player.dimension), manager, NetworkDirection.PLAY_TO_CLIENT); - } + }*/ public static void handleClientLoginSuccess(NetworkManager manager) { if (manager == null || manager.channel() == null) throw new NullPointerException("ARGH! Network Manager is null (" + manager != null ? "CHANNEL" : "MANAGER"+")" ); @@ -212,16 +208,4 @@ public class NetworkHooks player.openContainer.addListener(player); MinecraftForge.EVENT_BUS.post(new PlayerContainerEvent.Open(player, c)); } - - // internal tracking map for custom dimensions received from servers for use on client. - private static Int2ObjectMap trackingMap = new Int2ObjectOpenHashMap<>(); - public static DimensionType getDummyDimType(final int dimension) { - return trackingMap.computeIfAbsent(dimension, id -> DimensionType.getById(id)); - } - - static void addCachedDimensionType(final DimensionType dimensionType, final ResourceLocation dimName) { - trackingMap.put(dimensionType.getId(), dimensionType); - final ClearableRegistry dimtypereg = (ClearableRegistry) Registry.DIMENSION_TYPE; - dimtypereg.register(dimensionType.getId(), dimName, dimensionType); - } } diff --git a/src/main/java/net/minecraftforge/fml/network/NetworkInitialization.java b/src/main/java/net/minecraftforge/fml/network/NetworkInitialization.java index f93ae8c73..aaac9cb7a 100644 --- a/src/main/java/net/minecraftforge/fml/network/NetworkInitialization.java +++ b/src/main/java/net/minecraftforge/fml/network/NetworkInitialization.java @@ -98,11 +98,12 @@ class NetworkInitialization { consumer(FMLPlayMessages.OpenContainer::handle). add(); - playChannel.messageBuilder(FMLPlayMessages.DimensionInfoMessage.class, 2) - .decoder(FMLPlayMessages.DimensionInfoMessage::decode) - .encoder(FMLPlayMessages.DimensionInfoMessage::encode) - .consumer(FMLPlayMessages.DimensionInfoMessage::handle) - .add(); + //TODO Dimensions.. +// playChannel.messageBuilder(FMLPlayMessages.DimensionInfoMessage.class, 2) +// .decoder(FMLPlayMessages.DimensionInfoMessage::decode) +// .encoder(FMLPlayMessages.DimensionInfoMessage::encode) +// .consumer(FMLPlayMessages.DimensionInfoMessage::handle) +// .add(); return playChannel; } diff --git a/src/main/java/net/minecraftforge/fml/network/PacketDistributor.java b/src/main/java/net/minecraftforge/fml/network/PacketDistributor.java index 90c13bae8..1119ba781 100644 --- a/src/main/java/net/minecraftforge/fml/network/PacketDistributor.java +++ b/src/main/java/net/minecraftforge/fml/network/PacketDistributor.java @@ -25,9 +25,10 @@ import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.network.NetworkManager; import net.minecraft.network.IPacket; import net.minecraft.server.MinecraftServer; +import net.minecraft.util.RegistryKey; +import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.server.ServerChunkProvider; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.LogicalSidedProvider; @@ -55,7 +56,7 @@ public class PacketDistributor { *
* {@link #with(Supplier)} DimensionType */ - public static final PacketDistributor DIMENSION = new PacketDistributor<>(PacketDistributor::playerListDimConsumer, NetworkDirection.PLAY_TO_CLIENT); + public static final PacketDistributor> DIMENSION = new PacketDistributor<>(PacketDistributor::playerListDimConsumer, NetworkDirection.PLAY_TO_CLIENT); /** * Send to everyone near the {@link TargetPoint} specified in the Supplier *
@@ -106,7 +107,7 @@ public class PacketDistributor { private final double y; private final double z; private final double r2; - private final DimensionType dim; + private final RegistryKey dim; /** * A target point with excluded entity @@ -118,7 +119,7 @@ public class PacketDistributor { * @param r2 Radius * @param dim DimensionType */ - public TargetPoint(final ServerPlayerEntity excluded, final double x, final double y, final double z, final double r2, final DimensionType dim) { + public TargetPoint(final ServerPlayerEntity excluded, final double x, final double y, final double z, final double r2, final RegistryKey dim) { this.excluded = excluded; this.x = x; this.y = y; @@ -135,7 +136,7 @@ public class PacketDistributor { * @param r2 Radius * @param dim DimensionType */ - public TargetPoint(final double x, final double y, final double z, final double r2, final DimensionType dim) { + public TargetPoint(final double x, final double y, final double z, final double r2, final RegistryKey dim) { this.excluded = null; this.x = x; this.y = y; @@ -153,7 +154,7 @@ public class PacketDistributor { * @param dim DimensionType * @return A TargetPoint supplier */ - public static Supplier p(double x, double y, double z, double r2, DimensionType dim) { + public static Supplier p(double x, double y, double z, double r2, RegistryKey dim) { TargetPoint tp = new TargetPoint(x, y, z, r2, dim); return ()->tp; } @@ -215,8 +216,8 @@ public class PacketDistributor { private Consumer> playerConsumer(final Supplier entityPlayerMPSupplier) { return p -> entityPlayerMPSupplier.get().connection.netManager.sendPacket(p); } - private Consumer> playerListDimConsumer(final Supplier dimensionTypeSupplier) { - return p->getServer().getPlayerList().sendPacketToAllPlayersInDimension(p, dimensionTypeSupplier.get()); + private Consumer> playerListDimConsumer(final Supplier> dimensionTypeSupplier) { + return p->getServer().getPlayerList().func_232642_a_(p, dimensionTypeSupplier.get()); } private Consumer> playerListAll(final Supplier voidSupplier) { diff --git a/src/main/java/net/minecraftforge/fml/packs/DelegatingResourcePack.java b/src/main/java/net/minecraftforge/fml/packs/DelegatingResourcePack.java index cd4aa3684..5dc01d40c 100644 --- a/src/main/java/net/minecraftforge/fml/packs/DelegatingResourcePack.java +++ b/src/main/java/net/minecraftforge/fml/packs/DelegatingResourcePack.java @@ -104,7 +104,7 @@ public class DelegatingResourcePack extends ResourcePack } @Override - public void close() throws IOException + public void close() { synchronized(delegates) { diff --git a/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java b/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java index 558c90b8e..99575216c 100644 --- a/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java +++ b/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java @@ -134,7 +134,7 @@ public class ModFileResourcePack extends DelegatableResourcePack } @Override - public void close() throws IOException + public void close() { } diff --git a/src/main/java/net/minecraftforge/fml/packs/ResourcePackLoader.java b/src/main/java/net/minecraftforge/fml/packs/ResourcePackLoader.java index 2d0dd2e44..fd2762277 100644 --- a/src/main/java/net/minecraftforge/fml/packs/ResourcePackLoader.java +++ b/src/main/java/net/minecraftforge/fml/packs/ResourcePackLoader.java @@ -19,7 +19,6 @@ package net.minecraftforge.fml.packs; -import java.io.Serializable; import java.util.ArrayList; import java.util.Comparator; import java.util.LinkedHashMap; @@ -29,6 +28,7 @@ import java.util.Objects; import java.util.Optional; import java.util.function.BiConsumer; import java.util.function.BiFunction; +import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; @@ -92,7 +92,7 @@ public class ResourcePackLoader } public interface IPackInfoFinder { - void addPackInfosToMap(Map packList, ResourcePackInfo.IFactory factory); + void addPackInfos(Consumer consumer, ResourcePackInfo.IFactory factory); } // SO GROSS - DON'T @ me bro @@ -105,9 +105,9 @@ public class ResourcePackLoader } @Override - public void addPackInfosToMap(Map packList, ResourcePackInfo.IFactory factory) + public void func_230230_a_(Consumer consumer, ResourcePackInfo.IFactory factory) { - wrapped.addPackInfosToMap(packList, factory); + wrapped.addPackInfos(consumer, factory); } } } diff --git a/src/main/java/net/minecraftforge/fml/server/LanguageHook.java b/src/main/java/net/minecraftforge/fml/server/LanguageHook.java index 9926ae6f2..16b5ff9c5 100644 --- a/src/main/java/net/minecraftforge/fml/server/LanguageHook.java +++ b/src/main/java/net/minecraftforge/fml/server/LanguageHook.java @@ -80,15 +80,16 @@ public class LanguageHook private static void loadLanguage(String langName, MinecraftServer server) { String langFile = String.format("lang/%s.json", langName); - server.getResourceManager().getResourceNamespaces().forEach(namespace -> { - try { - ResourceLocation langResource = new ResourceLocation(namespace, langFile); - loadLocaleData(server.getResourceManager().getAllResources(langResource)); - } catch (FileNotFoundException fnfe) { - } catch (Exception exception) { - LOGGER.warn("Skipped language file: {}:{}", namespace, langFile, exception); - } - }); + //TODO +// server.getResourceManager().getResourceNamespaces().forEach(namespace -> { +// try { +// ResourceLocation langResource = new ResourceLocation(namespace, langFile); +// loadLocaleData(server.getResourceManager().getAllResources(langResource)); +// } catch (FileNotFoundException fnfe) { +// } catch (Exception exception) { +// LOGGER.warn("Skipped language file: {}:{}", namespace, langFile, exception); +// } +// }); } diff --git a/src/main/java/net/minecraftforge/fml/server/ServerLifecycleHooks.java b/src/main/java/net/minecraftforge/fml/server/ServerLifecycleHooks.java index 031efb409..f365873e4 100644 --- a/src/main/java/net/minecraftforge/fml/server/ServerLifecycleHooks.java +++ b/src/main/java/net/minecraftforge/fml/server/ServerLifecycleHooks.java @@ -28,7 +28,10 @@ import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.BiConsumer; +import java.util.function.Consumer; +import net.minecraft.resources.IPackNameDecorator; +import net.minecraft.world.storage.FolderNames; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; @@ -70,12 +73,13 @@ public class ServerLifecycleHooks { private static final Logger LOGGER = LogManager.getLogger(); private static final Marker SERVERHOOKS = MarkerManager.getMarker("SERVERHOOKS"); + private static final FolderNames SERVERCONFIG = new FolderNames("serverconfig"); private static volatile CountDownLatch exitLatch = null; private static MinecraftServer currentServer; private static Path getServerConfigPath(final MinecraftServer server) { - final Path serverConfig = server.getActiveAnvilConverter().getFile(server.getFolderName(), "serverconfig").toPath(); + final Path serverConfig = server.func_240776_a_(SERVERCONFIG); FileUtils.getOrCreateDirectory(serverConfig, "serverconfig"); return serverConfig; } @@ -207,13 +211,13 @@ public class ServerLifecycleHooks return (packList, factory) -> serverPackFinder(modResourcePacks, packSetter, packList, factory); } - private static void serverPackFinder(Map modResourcePacks, BiConsumer packSetter, Map packList, ResourcePackInfo.IFactory factory) { + private static void serverPackFinder(Map modResourcePacks, BiConsumer packSetter, Consumer consumer, ResourcePackInfo.IFactory factory) { for (Entry e : modResourcePacks.entrySet()) { IModInfo mod = e.getKey().getModInfos().get(0); if (Objects.equals(mod.getModId(), "minecraft")) continue; // skip the minecraft "mod" final String name = "mod:" + mod.getModId(); - final T packInfo = ResourcePackInfo.createResourcePack(name, true, e::getValue, factory, ResourcePackInfo.Priority.BOTTOM); + final T packInfo = ResourcePackInfo.createResourcePack(name, true, e::getValue, factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.field_232625_a_); if (packInfo == null) { // Vanilla only logs an error, instead of propagating, so handle null and warn that something went wrong ModLoader.get().addWarning(new ModLoadingWarning(mod, ModLoadingStage.ERROR, "fml.modloading.brokenresources", e.getKey())); @@ -221,7 +225,7 @@ public class ServerLifecycleHooks } packSetter.accept(e.getValue(), packInfo); LOGGER.debug(CORE, "Generating PackInfo named {} for mod file {}", name, e.getKey().getFilePath()); - packList.put(name, packInfo); + consumer.accept(packInfo); } } diff --git a/src/main/java/net/minecraftforge/registries/ClearableRegistry.java b/src/main/java/net/minecraftforge/registries/ClearableRegistry.java deleted file mode 100644 index dae88ca3b..000000000 --- a/src/main/java/net/minecraftforge/registries/ClearableRegistry.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.registries; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Random; -import java.util.Set; - -import javax.annotation.Nullable; - -import org.apache.commons.lang3.Validate; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.Marker; -import org.apache.logging.log4j.MarkerManager; - -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; - -import net.minecraft.util.IntIdentityHashBiMap; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.registry.MutableRegistry; - -/** - * A IRegistry implementation that allows for removing of objects. This is a internal helper - * class used by Forge for managing things that reset during Server initialization. - */ -public class ClearableRegistry extends MutableRegistry -{ - private static final Logger LOGGER = LogManager.getLogger(); - private static final Marker REGISTRY = MarkerManager.getMarker("REGISTRY"); - - private final IntIdentityHashBiMap ids = new IntIdentityHashBiMap<>(256); - private final BiMap map = HashBiMap.create(); - private final Set keys = Collections.unmodifiableSet(map.keySet()); - private List values = new ArrayList<>(); - private Map> known = new HashMap<>(); - private final ResourceLocation name; - private final boolean isDelegated; - private int nextId = 0; - - public ClearableRegistry(ResourceLocation name) { this(name, null); } - public ClearableRegistry(ResourceLocation name, Class superType) - { - this.name = name; - this.isDelegated = superType != null && ForgeRegistryEntry.class.isAssignableFrom(superType); //TODO: Make this IDelegatedRegistryEntry? - } - - @Override - @Nullable - public ResourceLocation getKey(T value) - { - return map.inverse().get(value); - } - - @Override - @Nullable - public int getId(T value) - { - return ids.getId(value); - } - - @Override - @Nullable - public T getByValue(int id) - { - return ids.getByValue(id); - } - - @Override - public Iterator iterator() - { - return ids.iterator(); - } - - @Override - @Nullable - public T getOrDefault(ResourceLocation key) - { - return map.get(key); - } - - @Override - public V register(int id, ResourceLocation key, V value) - { - Validate.isTrue(id >= 0, "Invalid ID, can not be < 0"); - Validate.notNull(key); - Validate.notNull(value); - - T old = map.get(key); - if (old != null) - { - LOGGER.debug(REGISTRY, "{}: Adding duplicate key '{}' to registry. Old: {} New: {}", name, key, old, value); - values.remove(old); - if (isDelegated) - { - Set others = known.computeIfAbsent(key, k -> new HashSet<>()); - others.add(old); - others.forEach(e -> getDelegate(e).changeReference(value)); - } - } - - map.put(key, value); - ids.put(value, id); - values.add(value); - if (nextId <= id) - nextId = id + 1; - - if (isDelegated) - getDelegate(value).setName(key); - - return value; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private RegistryDelegate getDelegate(T thing) - { - if (isDelegated) - return (RegistryDelegate)((ForgeRegistryEntry)thing).delegate; - else - throw new IllegalStateException("Tried to get existing delegate from registry that is not delegated."); - } - - @Override - public V register(ResourceLocation key, V value) - { - return register(nextId, key, value); - } - - @Override - public Set keySet() - { - return keys; - } - - @Override - public boolean isEmpty() - { - return map.isEmpty(); - } - - @Override - @Nullable - public T getRandom(Random random) - { - return values.isEmpty() ? null : values.get(random.nextInt(values.size())); - } - - @Override - public boolean containsKey(ResourceLocation key) - { - return map.containsKey(key); - } - - public void clear() - { - LOGGER.debug(REGISTRY, "{}: Clearing registry", name); - if (isDelegated) - { - known.values().forEach(s -> { - s.forEach(e -> getDelegate(e).changeReference(e)); - s.clear(); - }); - known.clear(); - } - map.clear(); - values.clear(); - ids.clear(); - nextId = 0; - } - - public int getNextId() - { - return nextId; - } - - @Override - public Optional getValue(ResourceLocation key) - { - return Optional.ofNullable(map.get(key)); - } -} diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistries.java b/src/main/java/net/minecraftforge/registries/ForgeRegistries.java index 6467b46b6..b98e64c55 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistries.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistries.java @@ -41,9 +41,7 @@ import net.minecraft.stats.StatType; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.SoundEvent; import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.provider.BiomeProviderType; import net.minecraft.world.chunk.ChunkStatus; -import net.minecraft.world.gen.ChunkGeneratorType; import net.minecraft.world.gen.blockplacer.BlockPlacerType; import net.minecraft.world.gen.blockstateprovider.BlockStateProviderType; import net.minecraft.world.gen.carver.WorldCarver; @@ -52,7 +50,6 @@ import net.minecraft.world.gen.foliageplacer.FoliagePlacerType; import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; import net.minecraft.world.gen.treedecorator.TreeDecoratorType; -import net.minecraftforge.common.ModDimension; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.fml.common.registry.GameRegistry; @@ -95,8 +92,8 @@ public class ForgeRegistries public static final IForgeRegistry> SURFACE_BUILDERS = RegistryManager.ACTIVE.getRegistry(SurfaceBuilder.class); public static final IForgeRegistry> FEATURES = RegistryManager.ACTIVE.getRegistry(Feature.class); public static final IForgeRegistry> DECORATORS = RegistryManager.ACTIVE.getRegistry(Placement.class); - public static final IForgeRegistry> BIOME_PROVIDER_TYPES = RegistryManager.ACTIVE.getRegistry(BiomeProviderType.class); - public static final IForgeRegistry> CHUNK_GENERATOR_TYPES = RegistryManager.ACTIVE.getRegistry(ChunkGeneratorType.class); +// public static final IForgeRegistry> BIOME_PROVIDER_TYPES = RegistryManager.ACTIVE.getRegistry(BiomeProviderType.class); +// public static final IForgeRegistry> CHUNK_GENERATOR_TYPES = RegistryManager.ACTIVE.getRegistry(ChunkGeneratorType.class); public static final IForgeRegistry CHUNK_STATUS = RegistryManager.ACTIVE.getRegistry(ChunkStatus.class); public static final IForgeRegistry> BLOCK_STATE_PROVIDER_TYPES = RegistryManager.ACTIVE.getRegistry(BlockStateProviderType.class); public static final IForgeRegistry> BLOCK_PLACER_TYPES = RegistryManager.ACTIVE.getRegistry(BlockPlacerType.class); @@ -104,7 +101,7 @@ public class ForgeRegistries public static final IForgeRegistry> TREE_DECORATOR_TYPES = RegistryManager.ACTIVE.getRegistry(TreeDecoratorType.class); // Custom forge registries - public static final IForgeRegistry MOD_DIMENSIONS = RegistryManager.ACTIVE.getRegistry(ModDimension.class); + //public static final IForgeRegistry MOD_DIMENSIONS = RegistryManager.ACTIVE.getRegistry(ModDimension.class); //TODO Dimensions.. public static final IForgeRegistry DATA_SERIALIZERS = RegistryManager.ACTIVE.getRegistry(DataSerializerEntry.class); public static final IForgeRegistry> LOOT_MODIFIER_SERIALIZERS = RegistryManager.ACTIVE.getRegistry(GlobalLootModifierSerializer.class); diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index 9e14ed1b0..0a5dd0bc1 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -53,9 +53,7 @@ import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.SimpleRegistry; import net.minecraft.village.PointOfInterestType; import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.provider.BiomeProviderType; import net.minecraft.world.chunk.ChunkStatus; -import net.minecraft.world.gen.ChunkGeneratorType; import net.minecraft.world.gen.blockplacer.BlockPlacerType; import net.minecraft.world.gen.blockstateprovider.BlockStateProviderType; import net.minecraft.world.gen.carver.WorldCarver; @@ -66,7 +64,6 @@ import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; import net.minecraft.world.gen.treedecorator.TreeDecoratorType; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.ModDimension; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent.MissingMappings; @@ -109,7 +106,7 @@ public class GameData // Vanilla registries // Names used here match those in net.minecraft.util.Registry - + // Game objects public static final ResourceLocation BLOCKS = new ResourceLocation("block"); public static final ResourceLocation FLUIDS = new ResourceLocation("fluid"); @@ -126,7 +123,7 @@ public class GameData public static final ResourceLocation PAINTING_TYPES = new ResourceLocation("motive"); // sic public static final ResourceLocation RECIPE_SERIALIZERS = new ResourceLocation("recipe_serializer"); public static final ResourceLocation STAT_TYPES = new ResourceLocation("stat_type"); - + // Villages public static final ResourceLocation PROFESSIONS = new ResourceLocation("villager_profession"); public static final ResourceLocation POI_TYPES = new ResourceLocation("point_of_interest_type"); @@ -158,7 +155,7 @@ public class GameData private static final ResourceLocation BLOCK_TO_ITEM = new ResourceLocation("minecraft:blocktoitemmap"); private static final ResourceLocation BLOCKSTATE_TO_ID = new ResourceLocation("minecraft:blockstatetoid"); private static final ResourceLocation SERIALIZER_TO_ENTRY = new ResourceLocation("forge:serializer_to_entry"); - private static final ResourceLocation STRUCTURE_FEATURES = new ResourceLocation("minecraft:structure_feature"); + //private static final ResourceLocation STRUCTURE_FEATURES = new ResourceLocation("minecraft:structure_feature"); private static final ResourceLocation STRUCTURES = new ResourceLocation("minecraft:structures"); private static boolean hasInit = false; @@ -180,7 +177,7 @@ public class GameData if (hasInit) return; hasInit = true; - + // Game objects makeRegistry(BLOCKS, Block.class, new ResourceLocation("air")).addCallback(BlockCallbacks.INSTANCE).legacyName("blocks").create(); makeRegistry(FLUIDS, Fluid.class, new ResourceLocation("empty")).create(); @@ -197,7 +194,7 @@ public class GameData makeRegistry(PAINTING_TYPES, PaintingType.class, new ResourceLocation("kebab")).create(); makeRegistry(RECIPE_SERIALIZERS, IRecipeSerializer.class).disableSaving().create(); makeRegistry(STAT_TYPES, StatType.class).create(); - + // Villagers makeRegistry(PROFESSIONS, VillagerProfession.class, new ResourceLocation("none")).create(); makeRegistry(POI_TYPES, PointOfInterestType.class, new ResourceLocation("unemployed")).disableSync().create(); @@ -211,8 +208,8 @@ public class GameData makeRegistry(SURFACE_BUILDERS, SurfaceBuilder.class).disableSaving().disableSync().create(); makeRegistry(FEATURES, Feature.class).addCallback(FeatureCallbacks.INSTANCE).disableSaving().create(); makeRegistry(DECORATORS, Placement.class).disableSaving().disableSync().create(); - makeRegistry(BIOME_PROVIDER_TYPES, BiomeProviderType.class).disableSaving().disableSync().create(); - makeRegistry(CHUNK_GENERATOR_TYPES, ChunkGeneratorType.class).disableSaving().disableSync().create(); +// makeRegistry(BIOME_PROVIDER_TYPES, BiomeProviderType.class).disableSaving().disableSync().create(); +// makeRegistry(CHUNK_GENERATOR_TYPES, ChunkGeneratorType.class).disableSaving().disableSync().create(); makeRegistry(CHUNK_STATUS, ChunkStatus.class, new ResourceLocation("empty")).disableSaving().disableSync().create(); makeRegistry(BLOCK_STATE_PROVIDER_TYPES, BlockStateProviderType.class).disableSaving().disableSync().create(); makeRegistry(BLOCK_PLACER_TYPES, BlockPlacerType.class).disableSaving().disableSync().create(); @@ -220,7 +217,7 @@ public class GameData makeRegistry(TREE_DECORATOR_TYPES, TreeDecoratorType.class).disableSaving().disableSync().create(); // Custom forge registries - makeRegistry(MODDIMENSIONS, ModDimension.class ).disableSaving().create(); + //makeRegistry(MODDIMENSIONS, ModDimension.class ).disableSaving().create(); //TODO Dimensions makeRegistry(SERIALIZERS, DataSerializerEntry.class, 256 /*vanilla space*/, MAX_VARINT).disableSaving().disableOverrides().addCallback(SerializerCallbacks.INSTANCE).create(); makeRegistry(LOOT_MODIFIER_SERIALIZERS, GlobalLootModifierSerializer.class).disableSaving().disableSync().create(); } @@ -275,13 +272,15 @@ public class GameData { return RegistryManager.ACTIVE.getRegistry(DataSerializerEntry.class).getSlaveMap(SERIALIZER_TO_ENTRY, Map.class); } - + + /* @SuppressWarnings("unchecked") public static Registry> getStructureFeatures() { return (Registry>) RegistryManager.ACTIVE.getRegistry(Feature.class).getSlaveMap(STRUCTURE_FEATURES, Registry.class); } - + */ + @SuppressWarnings("unchecked") public static BiMap> getStructureMap() { @@ -629,41 +628,43 @@ public class GameData owner.setSlaveMap(SERIALIZER_TO_ENTRY, new IdentityHashMap<>()); } } - + private static class FeatureCallbacks implements IForgeRegistry.AddCallback>, IForgeRegistry.ClearCallback>, IForgeRegistry.CreateCallback> { static final FeatureCallbacks INSTANCE = new FeatureCallbacks(); - + @Override public void onAdd(IForgeRegistryInternal> owner, RegistryManager stage, int id, Feature obj, Feature oldObj) { + /*TODO, Structures arent Features anymore. if (obj instanceof Structure) { Structure structure = (Structure) obj; String key = structure.getStructureName().toLowerCase(Locale.ROOT); - + @SuppressWarnings("unchecked") Registry> reg = owner.getSlaveMap(STRUCTURE_FEATURES, Registry.class); Registry.register(reg, key, structure); - + @SuppressWarnings("unchecked") BiMap> map = owner.getSlaveMap(STRUCTURES, BiMap.class); if (oldObj != null && oldObj instanceof Structure) map.remove(((Structure)oldObj).getStructureName()); map.put(key, structure); } + */ } - + @Override public void onClear(IForgeRegistryInternal> owner, RegistryManager stage) { - owner.getSlaveMap(STRUCTURE_FEATURES, ClearableRegistry.class).clear(); + //owner.getSlaveMap(STRUCTURE_FEATURES, ClearableRegistry.class).clear(); owner.getSlaveMap(STRUCTURES, BiMap.class).clear(); } @Override public void onCreate(IForgeRegistryInternal> owner, RegistryManager stage) { - owner.setSlaveMap(STRUCTURE_FEATURES, new ClearableRegistry<>(owner.getRegistryName())); + //owner.setSlaveMap(STRUCTURE_FEATURES, new ClearableRegistry<>(owner.getRegistryName())); owner.setSlaveMap(STRUCTURES, HashBiMap.create()); } } @@ -715,7 +716,7 @@ public class GameData RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.validateContent(name)); RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.dump(name)); RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.resetDelegates()); - + // Update legacy names snapshot = snapshot.entrySet().stream() .sorted(Map.Entry.comparingByKey()) // FIXME Registries need dependency ordering, this makes sure blocks are done before items (for ItemCallbacks) but it's lazy as hell diff --git a/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java b/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java index 03b13fc65..4a0b16f92 100644 --- a/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java +++ b/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java @@ -29,11 +29,14 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.Validate; +import net.minecraft.util.RegistryKey; import net.minecraft.util.ResourceLocation; import net.minecraft.util.registry.DefaultedRegistry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.mojang.serialization.Lifecycle; + class NamespacedDefaultedWrapper> extends DefaultedRegistry implements ILockableRegistry { private static final Logger LOGGER = LogManager.getLogger(); @@ -42,19 +45,19 @@ class NamespacedDefaultedWrapper> extends Defau private NamespacedDefaultedWrapper(ForgeRegistry owner) { - super(owner.getRegistryName().toString()); + super("empty", RegistryKey.func_240904_a_(owner.getRegistryName()), Lifecycle.experimental()); this.delegate = owner; } @Override - public V register(int id, ResourceLocation key, V value) + public V register(int id, RegistryKey key, V value) { if (locked) throw new IllegalStateException("Can not register to a locked registry. Modder should use Forge Register methods."); Validate.notNull(value); if (value.getRegistryName() == null) - value.setRegistryName(key); + value.setRegistryName(key.func_240901_a_()); int realId = this.delegate.add(id, value); if (realId != id && id != -1) @@ -64,7 +67,7 @@ class NamespacedDefaultedWrapper> extends Defau } @Override - public V register(ResourceLocation key, V value) + public V register(RegistryKey key, V value) { return register(-1, key, value); } @@ -109,6 +112,12 @@ class NamespacedDefaultedWrapper> extends Defau return this.delegate.getValue(id); } + @Override + public boolean func_230518_b_(int id) + { + return this.getByValue(id) != null; + } + @Override public Iterator iterator() { @@ -135,12 +144,6 @@ class NamespacedDefaultedWrapper> extends Defau return this.delegate.getDefaultKey(); } - @Override - public boolean isEmpty() - { - return this.delegate.isEmpty(); - } - //internal @Override public void lock(){ this.locked = true; } diff --git a/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java b/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java index 68a9c7811..1d8c26a57 100644 --- a/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java +++ b/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java @@ -25,12 +25,16 @@ import java.util.Optional; import java.util.Random; import java.util.Set; import javax.annotation.Nullable; + +import net.minecraft.util.RegistryKey; import net.minecraft.util.ResourceLocation; import net.minecraft.util.registry.SimpleRegistry; import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.mojang.serialization.Lifecycle; + class NamespacedWrapper> extends SimpleRegistry implements ILockableRegistry { private static final Logger LOGGER = LogManager.getLogger(); @@ -39,11 +43,12 @@ class NamespacedWrapper> extends SimpleRegistry public NamespacedWrapper(ForgeRegistry owner) { + super(RegistryKey.func_240904_a_(owner.getRegistryName()), Lifecycle.experimental()); this.delegate = owner; } @Override - public V register(int id, ResourceLocation key, V value) + public V register(int id, RegistryKey key, V value) { if (locked) throw new IllegalStateException("Can not register to a locked registry. Modder should use Forge Register methods."); @@ -51,7 +56,7 @@ class NamespacedWrapper> extends SimpleRegistry Validate.notNull(value); if (value.getRegistryName() == null) - value.setRegistryName(key); + value.setRegistryName(key.func_240901_a_()); int realId = this.delegate.add(id, value); if (realId != id && id != -1) @@ -60,7 +65,7 @@ class NamespacedWrapper> extends SimpleRegistry } @Override - public R register(ResourceLocation key, R value) + public R register(RegistryKey key, R value) { return register(-1, key, value); } @@ -125,11 +130,13 @@ class NamespacedWrapper> extends SimpleRegistry return values.stream().skip(random.nextInt(values.size())).findFirst().orElse(null); } + /* @Override public boolean isEmpty() { return this.delegate.isEmpty(); } + */ //internal @Override diff --git a/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java b/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java index debb9d319..832575c79 100644 --- a/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java +++ b/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java @@ -27,10 +27,9 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponent; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.server.ServerWorld; +import net.minecraft.world.DimensionType; import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.chunk.IChunk; -import net.minecraft.world.dimension.DimensionType; -import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.WorldWorkerManager.IWorker; public class ChunkGenWorker implements IWorker @@ -38,7 +37,7 @@ public class ChunkGenWorker implements IWorker private final CommandSource listener; protected final BlockPos start; protected final int total; - private final DimensionType dim; + private final ServerWorld dim; private final Queue queue; private final int notificationFrequency; private int lastNotification = 0; @@ -46,7 +45,7 @@ public class ChunkGenWorker implements IWorker private int genned = 0; private Boolean keepingLoaded; - public ChunkGenWorker(CommandSource listener, BlockPos start, int total, DimensionType dim, int interval) + public ChunkGenWorker(CommandSource listener, BlockPos start, int total, ServerWorld dim, int interval) { this.listener = listener; this.start = start; @@ -97,6 +96,7 @@ public class ChunkGenWorker implements IWorker @Override public boolean doWork() { + /* ServerWorld world = DimensionManager.getWorld(listener.getServer(), dim, false, false); if (world == null) { @@ -121,7 +121,7 @@ public class ChunkGenWorker implements IWorker } return false; } - */ + * / BlockPos next = queue.poll(); @@ -161,6 +161,7 @@ public class ChunkGenWorker implements IWorker } return false; } + */ return true; } } diff --git a/src/main/java/net/minecraftforge/server/command/CommandDimensions.java b/src/main/java/net/minecraftforge/server/command/CommandDimensions.java index 07ae6edd3..87d38e803 100644 --- a/src/main/java/net/minecraftforge/server/command/CommandDimensions.java +++ b/src/main/java/net/minecraftforge/server/command/CommandDimensions.java @@ -23,7 +23,6 @@ import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.dimension.DimensionType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -40,6 +39,7 @@ public class CommandDimensions .requires(cs->cs.hasPermissionLevel(0)) //permission .executes(ctx -> { ctx.getSource().sendFeedback(new TranslationTextComponent("commands.forge.dimensions.list"), true); + /* Map> types = new HashMap<>(); for (DimensionType dim : DimensionType.getAll()) { String key = dim.getModType() == null ? "Vanilla" : dim.getModType().getRegistryName().toString(); @@ -49,6 +49,10 @@ public class CommandDimensions types.keySet().stream().sorted().forEach(key -> { ctx.getSource().sendFeedback(new StringTextComponent(key + ": " + types.get(key).stream().sorted().collect(Collectors.joining(", "))), false); }); + */ + ctx.getSource().getServer().func_240770_D_().stream().sorted().forEach(key -> { + ctx.getSource().sendFeedback(new StringTextComponent(key.func_240901_a_().toString()), false); + }); return 0; }); } diff --git a/src/main/java/net/minecraftforge/server/command/CommandEntity.java b/src/main/java/net/minecraftforge/server/command/CommandEntity.java index 3bd168feb..bad048a43 100644 --- a/src/main/java/net/minecraftforge/server/command/CommandEntity.java +++ b/src/main/java/net/minecraftforge/server/command/CommandEntity.java @@ -38,13 +38,14 @@ import net.minecraft.command.Commands; import net.minecraft.command.ISuggestionProvider; import net.minecraft.command.arguments.DimensionArgument; import net.minecraft.entity.Entity; +import net.minecraft.util.RegistryKey; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.DimensionType; +import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.dimension.DimensionType; -import net.minecraftforge.common.DimensionManager; import net.minecraftforge.registries.ForgeRegistries; import org.apache.commons.lang3.tuple.MutablePair; @@ -70,14 +71,14 @@ class CommandEntity .then(Commands.argument("filter", StringArgumentType.string()) .suggests((ctx, builder) -> ISuggestionProvider.suggest(ForgeRegistries.ENTITIES.getKeys().stream().map(ResourceLocation::toString), builder)) .then(Commands.argument("dim", DimensionArgument.getDimension()) - .executes(ctx -> execute(ctx.getSource(), StringArgumentType.getString(ctx, "filter"), DimensionArgument.getDimensionArgument(ctx, "dim"))) + .executes(ctx -> execute(ctx.getSource(), StringArgumentType.getString(ctx, "filter"), DimensionArgument.getDimensionArgument(ctx, "dim").func_234923_W_())) ) - .executes(ctx -> execute(ctx.getSource(), StringArgumentType.getString(ctx, "filter"), ctx.getSource().getWorld().dimension.getType())) + .executes(ctx -> execute(ctx.getSource(), StringArgumentType.getString(ctx, "filter"), ctx.getSource().getWorld().func_234923_W_())) ) - .executes(ctx -> execute(ctx.getSource(), "*", ctx.getSource().getWorld().dimension.getType())); + .executes(ctx -> execute(ctx.getSource(), "*", ctx.getSource().getWorld().func_234923_W_())); } - private static int execute(CommandSource sender, String filter, DimensionType dim) throws CommandSyntaxException + private static int execute(CommandSource sender, String filter, RegistryKey dim) throws CommandSyntaxException { final String cleanFilter = filter.replace("?", ".?").replace("*", ".*?"); @@ -86,14 +87,14 @@ class CommandEntity if (names.isEmpty()) throw INVALID_FILTER.create(); - ServerWorld world = DimensionManager.getWorld(sender.getServer(), dim, false, false); + ServerWorld world = sender.getServer().getWorld(dim); //TODO: DimensionManager so we can hotload? DimensionManager.getWorld(sender.getServer(), dim, false, false); if (world == null) throw INVALID_DIMENSION.create(dim); Map>> list = Maps.newHashMap(); world.getEntities().forEach(e -> { MutablePair> info = list.computeIfAbsent(e.getType().getRegistryName(), k -> MutablePair.of(0, Maps.newHashMap())); - ChunkPos chunk = new ChunkPos(e.getPosition()); + ChunkPos chunk = new ChunkPos(e.func_233580_cy_()); info.left++; info.right.put(chunk, info.right.getOrDefault(chunk, 0) + 1); }); diff --git a/src/main/java/net/minecraftforge/server/command/CommandGenerate.java b/src/main/java/net/minecraftforge/server/command/CommandGenerate.java index e87f32596..110894dda 100644 --- a/src/main/java/net/minecraftforge/server/command/CommandGenerate.java +++ b/src/main/java/net/minecraftforge/server/command/CommandGenerate.java @@ -29,7 +29,7 @@ import net.minecraft.command.Commands; import net.minecraft.command.arguments.BlockPosArgument; import net.minecraft.command.arguments.DimensionArgument; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.dimension.DimensionType; +import net.minecraft.world.server.ServerWorld; import net.minecraftforge.common.WorldWorkerManager; class CommandGenerate @@ -46,7 +46,7 @@ class CommandGenerate ) .executes(ctx -> execute(ctx.getSource(), BlockPosArgument.getBlockPos(ctx, "pos"), getInt(ctx, "count"), DimensionArgument.getDimensionArgument(ctx, "dim"), -1)) ) - .executes(ctx -> execute(ctx.getSource(), BlockPosArgument.getBlockPos(ctx, "pos"), getInt(ctx, "count"), ctx.getSource().getWorld().dimension.getType(), -1)) + .executes(ctx -> execute(ctx.getSource(), BlockPosArgument.getBlockPos(ctx, "pos"), getInt(ctx, "count"), ctx.getSource().getWorld(), -1)) ) ); } @@ -56,7 +56,7 @@ class CommandGenerate return IntegerArgumentType.getInteger(ctx, name); } - private static int execute(CommandSource source, BlockPos pos, int count, DimensionType dim, int interval) throws CommandException + private static int execute(CommandSource source, BlockPos pos, int count, ServerWorld dim, int interval) throws CommandException { BlockPos chunkpos = new BlockPos(pos.getX() >> 4, 0, pos.getZ() >> 4); diff --git a/src/main/java/net/minecraftforge/server/command/CommandSetDimension.java b/src/main/java/net/minecraftforge/server/command/CommandSetDimension.java index b06b81a31..676a35d03 100644 --- a/src/main/java/net/minecraftforge/server/command/CommandSetDimension.java +++ b/src/main/java/net/minecraftforge/server/command/CommandSetDimension.java @@ -27,7 +27,6 @@ import net.minecraft.command.arguments.EntityArgument; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.common.util.ITeleporter; @@ -56,8 +55,8 @@ public class CommandSetDimension ) ); } - - private static int execute(CommandSource sender, Collection entities, DimensionType dim, BlockPos pos) throws CommandSyntaxException + + private static int execute(CommandSource sender, Collection entities, ServerWorld dim, BlockPos pos) throws CommandSyntaxException { entities.removeIf(e -> !canEntityTeleport(e)); if (entities.isEmpty()) @@ -66,8 +65,8 @@ public class CommandSetDimension //if (!DimensionManager.isDimensionRegistered(dim)) // throw INVALID_DIMENSION.create(dim); - entities.stream().filter(e -> e.dimension == dim).forEach(e -> sender.sendFeedback(new TranslationTextComponent("commands.forge.setdim.invalid.nochange", e.getDisplayName().getFormattedText(), dim), true)); - entities.stream().filter(e -> e.dimension != dim).forEach(e -> e.changeDimension(dim, new ITeleporter() + entities.stream().filter(e -> e.world == dim).forEach(e -> sender.sendFeedback(new TranslationTextComponent("commands.forge.setdim.invalid.nochange", e.getDisplayName().getString(), dim), true)); + entities.stream().filter(e -> e.world != dim).forEach(e -> e.func_241206_a_(dim/* TODO: Custom Teleporters , new ITeleporter() { @Override public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destWorld, float yaw, Function repositionEntity) @@ -76,7 +75,8 @@ public class CommandSetDimension repositionedEntity.setPositionAndUpdate(pos.getX(), pos.getY(), pos.getZ()); return repositionedEntity; } - })); + }*/)); + return 0; } diff --git a/src/main/java/net/minecraftforge/server/command/CommandTps.java b/src/main/java/net/minecraftforge/server/command/CommandTps.java index e0e5132bd..50239d454 100644 --- a/src/main/java/net/minecraftforge/server/command/CommandTps.java +++ b/src/main/java/net/minecraftforge/server/command/CommandTps.java @@ -26,7 +26,7 @@ import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraft.command.arguments.DimensionArgument; import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.dimension.DimensionType; +import net.minecraft.world.server.ServerWorld; class CommandTps { @@ -41,7 +41,7 @@ class CommandTps .executes(ctx -> sendTime(ctx.getSource(), DimensionArgument.getDimensionArgument(ctx, "dim"))) ) .executes(ctx -> { - for (DimensionType dim : DimensionType.getAll()) + for (ServerWorld dim : ctx.getSource().getServer().getWorlds()) sendTime(ctx.getSource(), dim); double meanTickTime = mean(ctx.getSource().getServer().tickTimeArray) * 1.0E-6D; @@ -53,16 +53,16 @@ class CommandTps ); } - private static int sendTime(CommandSource cs, DimensionType dim) throws CommandSyntaxException + private static int sendTime(CommandSource cs, ServerWorld dim) throws CommandSyntaxException { - long[] times = cs.getServer().getTickTime(dim); + long[] times = cs.getServer().getTickTime(dim.func_234923_W_()); if (times == null) // Null means the world is unloaded. Not invalid. That's taken car of by DimensionArgument itself. times = UNLOADED; double worldTickTime = mean(times) * 1.0E-6D; double worldTPS = Math.min(1000.0 / worldTickTime, 20); - cs.sendFeedback(new TranslationTextComponent("commands.forge.tps.summary.named", dim.getId(), DimensionType.getKey(dim), TIME_FORMATTER.format(worldTickTime), TIME_FORMATTER.format(worldTPS)), false); + cs.sendFeedback(new TranslationTextComponent("commands.forge.tps.summary.named", dim.func_234923_W_().toString(), dim.func_234922_V_().toString(), TIME_FORMATTER.format(worldTickTime), TIME_FORMATTER.format(worldTPS)), false); return 1; } diff --git a/src/main/java/net/minecraftforge/server/command/CommandTrack.java b/src/main/java/net/minecraftforge/server/command/CommandTrack.java index 1cc389b5e..1c769831f 100644 --- a/src/main/java/net/minecraftforge/server/command/CommandTrack.java +++ b/src/main/java/net/minecraftforge/server/command/CommandTrack.java @@ -36,7 +36,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.server.timings.ForgeTimings; import net.minecraftforge.server.timings.TimeTracker; @@ -154,11 +153,11 @@ class CommandTrack if (entity == null) return new TranslationTextComponent("commands.forge.tracking.invalid"); - BlockPos pos = entity.getPosition(); + BlockPos pos = entity.func_233580_cy_(); double averageTimings = data.getAverageTimings(); String tickTime = (averageTimings > 1000 ? TIME_FORMAT.format(averageTimings / 1000) : TIME_FORMAT.format(averageTimings)) + (averageTimings < 1000 ? "\u03bcs" : "ms"); - return new TranslationTextComponent("commands.forge.tracking.timing_entry", entity.getType().getRegistryName(), DimensionType.getKey(entity.world.dimension.getType()), pos.getX(), pos.getY(), pos.getZ(), tickTime); + return new TranslationTextComponent("commands.forge.tracking.timing_entry", entity.getType().getRegistryName(), entity.world.func_234923_W_().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime); }) ); } @@ -178,7 +177,7 @@ class CommandTrack double averageTimings = data.getAverageTimings(); String tickTime = (averageTimings > 1000 ? TIME_FORMAT.format(averageTimings / 1000) : TIME_FORMAT.format(averageTimings)) + (averageTimings < 1000 ? "\u03bcs" : "ms"); - return new TranslationTextComponent("commands.forge.tracking.timing_entry", te.getType().getRegistryName(), DimensionType.getKey(te.getWorld().dimension.getType()), pos.getX(), pos.getY(), pos.getZ(), tickTime); + return new TranslationTextComponent("commands.forge.tracking.timing_entry", te.getType().getRegistryName(), te.getWorld().func_234923_W_().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime); }) ); } diff --git a/src/main/java/net/minecraftforge/server/command/ConfigCommand.java b/src/main/java/net/minecraftforge/server/command/ConfigCommand.java index ccea6c2b5..389c82144 100644 --- a/src/main/java/net/minecraftforge/server/command/ConfigCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ConfigCommand.java @@ -60,8 +60,8 @@ public class ConfigCommand { File f = new File(configFileName); context.getSource().sendFeedback(new TranslationTextComponent("commands.config.getwithtype", modId, type, - new StringTextComponent(f.getName()).applyTextStyle(TextFormatting.UNDERLINE). - applyTextStyle((style) -> style.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, f.getAbsolutePath()))) + new StringTextComponent(f.getName()).func_240701_a_(TextFormatting.UNDERLINE). + func_240700_a_((style) -> style.func_240715_a_(new ClickEvent(ClickEvent.Action.OPEN_FILE, f.getAbsolutePath()))) ), true); } else { context.getSource().sendFeedback(new TranslationTextComponent("commands.config.noconfig", modId, type), diff --git a/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java b/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java index 6042c81e5..8b2f25f01 100644 --- a/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java +++ b/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java @@ -41,7 +41,7 @@ public class TextComponentHelper { if (isVanillaClient(source)) { - return new StringTextComponent(String.format(LanguageMap.getInstance().translateKey(translation), args)); + return new StringTextComponent(String.format(LanguageMap.getInstance().func_230503_a_(translation), args)); } return new TranslationTextComponent(translation, args); } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 86e9e0b69..625a6b77d 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -6,18 +6,20 @@ public net.minecraft.block.Block$Properties func_200947_a(Lnet/minecraft/block/S public net.minecraft.block.Block$Properties func_200951_a(I)Lnet/minecraft/block/Block$Properties; # lightValue public net.minecraft.block.Block$Properties func_208770_d()Lnet/minecraft/block/Block$Properties; # variableOpacity public net.minecraft.block.Block$Properties func_222380_e()Lnet/minecraft/block/Block$Properties; # noDrops +public net.minecraft.block.FireBlock func_220274_q(Lnet/minecraft/block/BlockState;)I # func_220274_q +public net.minecraft.block.FireBlock func_220275_r(Lnet/minecraft/block/BlockState;)I # func_220275_r public-f net.minecraft.client.GameSettings field_74324_K # keyBindings public net.minecraft.client.Minecraft field_71446_o # textureManager public net.minecraft.client.Minecraft func_184119_a(Lnet/minecraft/item/ItemStack;Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/item/ItemStack; # storeTEInStack public net.minecraft.client.Minecraft func_193986_ar()V # populateSearchTreeManager public net.minecraft.client.audio.SoundEngine field_148622_c #sndHandler protected net.minecraft.client.gui.IngameGui * -protected net.minecraft.client.gui.IngameGui func_194798_c()V # renderAttackIndicator -protected net.minecraft.client.gui.IngameGui func_194802_a(Lnet/minecraft/scoreboard/ScoreObjective;)V +protected net.minecraft.client.gui.IngameGui func_238456_d_(Lcom/mojang/blaze3d/matrix/MatrixStack;)V # renderAttackIndicator +protected net.minecraft.client.gui.IngameGui func_238447_a_(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/scoreboard/ScoreObjective;)V protected net.minecraft.client.gui.IngameGui func_194805_e(F)V protected net.minecraft.client.gui.IngameGui func_194808_p()V protected net.minecraft.client.gui.IngameGui func_212303_b(Lnet/minecraft/entity/Entity;)V -protected net.minecraft.client.gui.IngameGui func_212909_a(Lnet/minecraft/client/gui/FontRenderer;II)V # renderTextBackground +protected net.minecraft.client.gui.IngameGui func_238448_a_(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/gui/FontRenderer;III)V # renderTextBackground public net.minecraft.client.gui.ScreenManager func_216911_a(Lnet/minecraft/inventory/container/ContainerType;Lnet/minecraft/client/gui/ScreenManager$IScreenFactory;)V # registerFactory public net.minecraft.client.gui.ScreenManager$IScreenFactory protected net.minecraft.client.gui.overlay.DebugOverlayGui field_211537_g # rayTraceBlock @@ -128,11 +130,12 @@ public-f net.minecraft.item.crafting.Ingredient protected net.minecraft.item.crafting.Ingredient (Ljava/util/stream/Stream;)V public+f net.minecraft.item.crafting.Ingredient func_199564_a(Lnet/minecraft/network/PacketBuffer;)V public net.minecraft.item.crafting.Ingredient func_209357_a(Ljava/util/stream/Stream;)Lnet/minecraft/item/crafting/Ingredient; +public net.minecraft.item.crafting.Ingredient func_199803_a(Lcom/google/gson/JsonObject;)Lnet/minecraft/item/crafting/Ingredient$IItemList; # deserializeItemList public net.minecraft.item.crafting.Ingredient$IItemList public net.minecraft.item.crafting.Ingredient$SingleItemList public net.minecraft.item.crafting.Ingredient$SingleItemList (Lnet/minecraft/item/ItemStack;)V public net.minecraft.item.crafting.Ingredient$TagList -public net.minecraft.item.crafting.Ingredient$TagList (Lnet/minecraft/tags/Tag;)V +public net.minecraft.item.crafting.Ingredient$TagList (Lnet/minecraft/tags/ITag;)V public net.minecraft.item.crafting.TippedArrowRecipe public net.minecraft.nbt.NumberNBT public net.minecraft.network.status.server.SServerInfoPacket field_149297_a # GSON @@ -180,4 +183,6 @@ private-f net.minecraft.world.server.ChunkHolder field_219320_o # block update l public net.minecraft.world.server.ServerChunkProvider field_186029_c # chunkGenerator public net.minecraft.world.server.ServerChunkProvider field_73251_h # worldObj private-f net.minecraft.world.storage.loot.LootPool field_186455_c # rolls -private-f net.minecraft.world.storage.loot.LootPool field_186456_d # bonusRolls \ No newline at end of file +private-f net.minecraft.world.storage.loot.LootPool field_186456_d # bonusRolls +public net.minecraft.world.storage.FolderNames (Ljava/lang/String;)V # constructor +protected net.minecraft.data.TagsProvider field_200434_b # tagToBuilder diff --git a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java index e92b3300b..3128f94d2 100644 --- a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java +++ b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java @@ -32,6 +32,7 @@ import java.util.function.Consumer; import java.util.stream.Collectors; import java.util.stream.Stream; +import net.minecraft.block.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jline.utils.InputStreamReader; @@ -49,19 +50,6 @@ import com.google.gson.JsonObject; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.FrameType; -import net.minecraft.block.BarrelBlock; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.block.DoorBlock; -import net.minecraft.block.FenceBlock; -import net.minecraft.block.FenceGateBlock; -import net.minecraft.block.FurnaceBlock; -import net.minecraft.block.LogBlock; -import net.minecraft.block.PaneBlock; -import net.minecraft.block.SlabBlock; -import net.minecraft.block.StairsBlock; -import net.minecraft.block.TrapDoorBlock; -import net.minecraft.block.WallBlock; import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.model.ItemTransformVec3f; import net.minecraft.client.renderer.model.Variant; @@ -200,9 +188,9 @@ public class DataGeneratorTest @Override protected void registerTags() { - getBuilder(new BlockTags.Wrapper(new ResourceLocation(MODID, "test"))) - .add(Blocks.DIAMOND_BLOCK) - .add(BlockTags.STONE_BRICKS) + func_240522_a_(BlockTags.makeWrapperTag(new ResourceLocation(MODID, "test").toString())) + .func_240532_a_(Blocks.DIAMOND_BLOCK) + .func_240531_a_(BlockTags.STONE_BRICKS) .addOptional(BlockTags.getCollection(), new ResourceLocation("chisel", "marble/raw")) .addOptionalTag(new ResourceLocation("forge", "storage_blocks/ruby")); @@ -409,7 +397,7 @@ public class DataGeneratorTest models().getBuilder("cube") .parent(block) .element() - .allFaces((dir, face) -> face.texture("#" + dir.getName()).cullface(dir)); + .allFaces((dir, face) -> face.texture("#" + dir.func_176610_l()).cullface(dir)); ModelFile furnace = models().orientable("furnace", mcLoc("block/furnace_side"), mcLoc("block/furnace_front"), mcLoc("block/furnace_top")); ModelFile furnaceLit = models().orientable("furnace_on", mcLoc("block/furnace_side"), mcLoc("block/furnace_front_on"), mcLoc("block/furnace_top")); @@ -425,7 +413,7 @@ public class DataGeneratorTest ModelFile barrelOpen = models().cubeBottomTop("barrel_open", mcLoc("block/barrel_side"), mcLoc("block/barrel_bottom"), mcLoc("block/barrel_top_open")); directionalBlock(Blocks.BARREL, state -> state.get(BarrelBlock.PROPERTY_OPEN) ? barrelOpen : barrel); // Testing custom state interpreter - logBlock((LogBlock) Blocks.ACACIA_LOG); + logBlock((RotatedPillarBlock) Blocks.ACACIA_LOG); stairsBlock((StairsBlock) Blocks.ACACIA_STAIRS, "acacia", mcLoc("block/acacia_planks")); slabBlock((SlabBlock) Blocks.ACACIA_SLAB, Blocks.ACACIA_PLANKS.getRegistryName(), mcLoc("block/acacia_planks")); diff --git a/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java b/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java index fc6b75fe7..e20fee99b 100644 --- a/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java +++ b/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java @@ -93,11 +93,11 @@ public class PistonEventTest { if (pistonHelper.canMove()) { - player.sendMessage(new StringTextComponent(String.format("Piston will extend moving %d blocks and destroy %d blocks", pistonHelper.getBlocksToMove().size(), pistonHelper.getBlocksToDestroy().size()))); + player.sendMessage(new StringTextComponent(String.format("Piston will extend moving %d blocks and destroy %d blocks", pistonHelper.getBlocksToMove().size(), pistonHelper.getBlocksToDestroy().size())), player.getUniqueID()); } else { - player.sendMessage(new StringTextComponent("Piston won't extend")); + player.sendMessage(new StringTextComponent("Piston won't extend"), player.getUniqueID()); } } @@ -138,11 +138,11 @@ public class PistonEventTest BlockPos targetPos = event.getFaceOffsetPos().offset(event.getDirection()); boolean canPush = PistonBlock.canPush(event.getWorld().getBlockState(targetPos), (World) event.getWorld(), event.getFaceOffsetPos(), event.getDirection().getOpposite(), false, event.getDirection()); boolean isAir = event.getWorld().isAirBlock(targetPos); - player.sendMessage(new StringTextComponent(String.format("Piston will retract moving %d blocks", !isAir && canPush ? 1 : 0))); + player.sendMessage(new StringTextComponent(String.format("Piston will retract moving %d blocks", !isAir && canPush ? 1 : 0)), player.getUniqueID()); } else { - player.sendMessage(new StringTextComponent("Piston will retract")); + player.sendMessage(new StringTextComponent("Piston will retract"), player.getUniqueID()); } } // Offset twice to see if retraction will pull cobblestone diff --git a/src/test/java/net/minecraftforge/debug/chat/CommandEventTest.java b/src/test/java/net/minecraftforge/debug/chat/CommandEventTest.java index 7968daf97..9477d3d85 100644 --- a/src/test/java/net/minecraftforge/debug/chat/CommandEventTest.java +++ b/src/test/java/net/minecraftforge/debug/chat/CommandEventTest.java @@ -56,7 +56,7 @@ public class CommandEventTest if (nodes.size() > 0 && nodes.get(0).getNode() == dispatcher.getRoot().getChild("give")) { String msg = source.getName() + " used the give command: " + event.getParseResults().getReader().getString(); - source.getServer().getPlayerList().getPlayers().forEach(PlayerEntityMP -> PlayerEntityMP.sendMessage(new StringTextComponent(msg))); + source.getServer().getPlayerList().getPlayers().forEach(player -> player.sendMessage(new StringTextComponent(msg), player.getUniqueID())); return; } diff --git a/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java b/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java index 15e3f02ae..7c06d687a 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java @@ -29,9 +29,6 @@ import com.google.common.collect.ImmutableList; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.Quaternion; -import net.minecraft.client.renderer.TransformationMatrix; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ItemOverrideList; @@ -41,6 +38,9 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.vector.Quaternion; +import net.minecraft.util.math.vector.TransformationMatrix; +import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.model.data.IDynamicBakedModel; diff --git a/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java b/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java index 2cbc639f4..b4837f645 100644 --- a/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java @@ -33,6 +33,7 @@ import com.google.common.collect.Multimap; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.ai.attributes.Attribute; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier.Operation; import net.minecraft.entity.ai.attributes.IAttributeInstance; @@ -132,12 +133,12 @@ public class GravityAttributeTest } @Override - public Multimap getAttributeModifiers(EquipmentSlotType slot) + public Multimap getAttributeModifiers(EquipmentSlotType slot) { @SuppressWarnings("deprecation") - Multimap multimap = super.getAttributeModifiers(slot); + Multimap multimap = super.getAttributeModifiers(slot); if (slot == EquipmentSlotType.MAINHAND) - multimap.put(LivingEntity.ENTITY_GRAVITY.getName(), new AttributeModifier(GRAVITY_MODIFIER, "More Gravity", 1.0D, Operation.ADDITION)); + multimap.put(LivingEntity.ENTITY_GRAVITY.func_233754_c_(), new AttributeModifier(GRAVITY_MODIFIER, "More Gravity", 1.0D, Operation.ADDITION)); return multimap; } diff --git a/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java b/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java index de4085168..628b58b4a 100644 --- a/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java +++ b/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java @@ -21,7 +21,7 @@ package net.minecraftforge.debug.fluid; import net.minecraft.block.*; import net.minecraft.block.material.Material; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.item.*; import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer; @@ -133,7 +133,7 @@ public class NewFluidTest } @Override - public boolean receiveFluid(IWorld worldIn, BlockPos pos, BlockState state, IFluidState fluidStateIn) { + public boolean receiveFluid(IWorld worldIn, BlockPos pos, BlockState state, FluidState fluidStateIn) { if (canContainFluid(worldIn, pos, state, fluidStateIn.getFluid())) { if (!worldIn.isRemote()) { worldIn.setBlockState(pos, state.with(FLUIDLOGGED, true), 3); @@ -157,7 +157,7 @@ public class NewFluidTest } @Override - public IFluidState getFluidState(BlockState state) + public FluidState getFluidState(BlockState state) { return state.get(FLUIDLOGGED) ? test_fluid.get().getDefaultState() : Fluids.EMPTY.getDefaultState(); } diff --git a/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java b/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java index e124b2a96..29efcee7c 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java @@ -37,13 +37,13 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipe; import net.minecraft.item.crafting.IRecipeType; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootParameterSets; +import net.minecraft.loot.LootParameters; +import net.minecraft.loot.LootTable; +import net.minecraft.loot.conditions.ILootCondition; import net.minecraft.util.JSONUtils; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.storage.loot.LootContext; -import net.minecraft.world.storage.loot.LootParameterSets; -import net.minecraft.world.storage.loot.LootParameters; -import net.minecraft.world.storage.loot.LootTable; -import net.minecraft.world.storage.loot.conditions.ILootCondition; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.common.loot.LootModifier; import net.minecraftforge.event.RegistryEvent; diff --git a/src/test/java/net/minecraftforge/debug/world/MarkDimensionForDeletionTest.java b/src/test/java/net/minecraftforge/debug/world/MarkDimensionForDeletionTest.java index 7c3d7ace1..8a1f35761 100644 --- a/src/test/java/net/minecraftforge/debug/world/MarkDimensionForDeletionTest.java +++ b/src/test/java/net/minecraftforge/debug/world/MarkDimensionForDeletionTest.java @@ -1,4 +1,5 @@ package net.minecraftforge.debug.world; +/* import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; @@ -184,3 +185,4 @@ public class MarkDimensionForDeletionTest } } } +*/ \ No newline at end of file