From 1933d05e36245ef7461b29853b4854fa769a807f Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 11 Dec 2019 03:27:07 +0100 Subject: [PATCH] Update to 1.15 Due to the massive rendering changes, certain features, such as emissive item rendering and the forge block rendering/lighting pipeline are currently disabled. Co-authored-by: David Quintana Co-authored-by: tterrag Co-authored-by: Unnoen --- build.gradle | 34 +- .../mojang/blaze3d/platform/GLX.java.patch | 24 - .../platform/GlStateManager.java.patch | 20 + .../blaze3d/vertex/IVertexBuilder.java.patch | 11 + .../criterion/ItemPredicate.java.patch | 8 +- .../block/AbstractRailBlock.java.patch | 8 +- .../net/minecraft/block/BedBlock.java.patch | 14 +- .../net/minecraft/block/Block.java.patch | 77 +- .../net/minecraft/block/Blocks.java.patch | 14 +- .../net/minecraft/block/BushBlock.java.patch | 4 +- .../minecraft/block/CactusBlock.java.patch | 26 +- .../minecraft/block/CampfireBlock.java.patch | 11 + .../block/ChorusFlowerBlock.java.patch | 32 +- .../net/minecraft/block/CocoaBlock.java.patch | 12 +- .../block/ComparatorBlock.java.patch | 4 +- .../net/minecraft/block/CropsBlock.java.patch | 28 +- .../block/DetectorRailBlock.java.patch | 2 +- .../block/EnchantingTableBlock.java.patch | 2 +- .../minecraft/block/FallingBlock.java.patch | 20 +- .../minecraft/block/FarmlandBlock.java.patch | 6 +- .../net/minecraft/block/FireBlock.java.patch | 60 +- .../minecraft/block/FlowerPotBlock.java.patch | 20 +- .../block/FlowingFluidBlock.java.patch | 20 +- .../minecraft/block/JigsawBlock.java.patch | 2 +- .../minecraft/block/KelpTopBlock.java.patch | 14 +- .../minecraft/block/LadderBlock.java.patch | 6 +- .../minecraft/block/LeavesBlock.java.patch | 2 +- .../minecraft/block/MushroomBlock.java.patch | 6 +- .../block/NetherWartBlock.java.patch | 16 +- .../net/minecraft/block/NoteBlock.java.patch | 23 +- .../minecraft/block/PistonBlock.java.patch | 16 +- .../PistonBlockStructureHelper.java.patch | 81 + .../net/minecraft/block/RailState.java.patch | 4 +- .../block/RedstoneOreBlock.java.patch | 2 +- .../block/RedstoneWireBlock.java.patch | 8 +- .../minecraft/block/SaplingBlock.java.patch | 18 +- .../block/ScaffoldingBlock.java.patch | 2 +- .../minecraft/block/SeaGrassBlock.java.patch | 4 +- .../minecraft/block/SpawnerBlock.java.patch | 2 +- .../block/SpreadableSnowyDirtBlock.java.patch | 12 +- .../minecraft/block/StairsBlock.java.patch | 4 +- .../net/minecraft/block/StemBlock.java.patch | 46 +- .../minecraft/block/SugarCaneBlock.java.patch | 22 +- .../block/SweetBerryBushBlock.java.patch | 16 +- .../net/minecraft/block/TNTBlock.java.patch | 26 +- .../minecraft/block/TallGrassBlock.java.patch | 4 +- .../minecraft/block/TrapDoorBlock.java.patch | 2 +- .../minecraft/block/TurtleEggBlock.java.patch | 2 +- .../net/minecraft/block/VineBlock.java.patch | 41 +- .../net/minecraft/block/WebBlock.java.patch | 2 +- .../PistonBlockStructureHelper.java.patch | 53 - .../block/trees/JungleTree.java.patch | 13 +- .../minecraft/client/GameSettings.java.patch | 31 +- .../client/KeyboardListener.java.patch | 14 +- .../net/minecraft/client/Minecraft.java.patch | 218 +- .../minecraft/client/MouseHelper.java.patch | 43 +- .../client/audio/SoundEngine.java.patch | 10 +- .../client/audio/SoundHandler.java.patch | 2 +- .../AbstractClientPlayerEntity.java.patch | 4 +- .../player/ClientPlayerEntity.java.patch | 45 +- .../gui/DisplayEffectsScreen.java.patch | 8 +- .../minecraft/client/gui/IngameGui.java.patch | 32 +- .../client/gui/MapItemRenderer.java.patch | 10 +- .../gui/ResourceLoadProgressGui.java.patch | 6 +- .../minecraft/client/gui/SlotGui.java.patch | 26 +- .../advancements/AdvancementTabGui.java.patch | 2 +- .../AdvancementsScreen.java.patch | 18 +- .../gui/overlay/BossOverlayGui.java.patch | 8 +- .../gui/overlay/DebugOverlayGui.java.patch | 6 +- .../gui/recipebook/RecipeBookGui.java.patch | 4 +- .../gui/screen/ControlsScreen.java.patch | 10 +- .../gui/screen/CreateWorldScreen.java.patch | 13 +- .../client/gui/screen/DeathScreen.java.patch | 6 +- .../gui/screen/EnchantmentScreen.java.patch | 4 +- .../gui/screen/LanguageScreen.java.patch | 6 +- .../gui/screen/MainMenuScreen.java.patch | 18 +- .../gui/screen/ResourcePacksScreen.java.patch | 2 +- .../client/gui/screen/Screen.java.patch | 24 +- .../gui/screen/ServerSelectionList.java.patch | 2 +- .../inventory/ContainerScreen.java.patch | 70 +- .../inventory/CreativeScreen.java.patch | 84 +- .../client/gui/toasts/RecipeToast.java.patch | 8 +- .../client/gui/widget/Widget.java.patch | 24 +- .../gui/widget/list/AbstractList.java.patch | 6 +- .../ClientChunkProvider.java.patch | 6 +- .../multiplayer/PlayerController.java.patch | 64 +- .../play/ClientPlayNetHandler.java.patch | 32 +- .../particle/DiggingParticle.java.patch | 4 +- .../particle/ParticleManager.java.patch | 24 +- .../renderer/ActiveRenderInfo.java.patch | 18 +- .../renderer/BlockModelRenderer.java.patch | 130 +- .../renderer/BlockModelShapes.java.patch | 3 +- .../BlockRendererDispatcher.java.patch | 72 +- .../client/renderer/BufferBuilder.java.patch | 51 +- .../client/renderer/ChestRenderer.java.patch | 11 - .../renderer/FirstPersonRenderer.java.patch | 115 +- .../renderer/FluidBlockRenderer.java.patch | 135 +- .../client/renderer/FogRenderer.java.patch | 82 +- .../client/renderer/GameRenderer.java.patch | 153 +- .../renderer/ItemModelMesher.java.patch | 4 +- .../client/renderer/ItemRenderer.java.patch | 93 +- .../client/renderer/LightTexture.java.patch | 17 +- .../client/renderer/Matrix4f.java.patch | 94 +- .../renderer/OverlayRenderer.java.patch | 48 + .../client/renderer/Quaternion.java.patch | 15 + .../renderer/RenderTypeLookup.java.patch | 97 + .../renderer/TransformationMatrix.java.patch | 45 + .../client/renderer/Vector3f.java.patch | 17 + .../client/renderer/Vector4f.java.patch | 24 + .../client/renderer/ViewFrustum.java.patch | 12 + .../client/renderer/WorldRenderer.java.patch | 181 +- .../WorldVertexBufferUploader.java.patch | 59 - .../renderer/chunk/ChunkRender.java.patch | 75 - .../chunk/ChunkRenderDispatcher.java.patch | 174 +- .../renderer/chunk/ChunkRenderTask.java.patch | 27 - .../renderer/color/BlockColors.java.patch | 14 +- .../entity/EntityRendererManager.java.patch | 16 +- .../entity/FallingBlockRenderer.java.patch | 17 + .../renderer/entity/FishRenderer.java.patch | 4 +- .../entity/ItemFrameRenderer.java.patch | 54 +- .../renderer/entity/ItemRenderer.java.patch | 93 +- .../renderer/entity/LivingRenderer.java.patch | 71 +- .../renderer/entity/PlayerRenderer.java.patch | 22 +- .../entity/layers/ArmorLayer.java.patch | 67 +- .../entity/layers/BipedArmorLayer.java.patch | 2 +- .../entity/layers/HeldItemLayer.java.patch | 16 - .../layers/WitchHeldItemLayer.java.patch | 11 - .../entity/model/SkeletonModel.java.patch | 14 +- .../renderer/model/BakedQuad.java.patch | 28 +- .../model/BakedQuadRetextured.java.patch | 30 - .../renderer/model/BlockModel.java.patch | 91 +- .../model/BlockModelDefinition.java.patch | 19 - .../renderer/model/FaceBakery.java.patch | 103 +- .../renderer/model/IModelTransform.java.patch | 11 + .../renderer/model/IUnbakedModel.java.patch | 17 +- .../model/ItemCameraTransforms.java.patch | 19 +- .../model/ItemOverrideList.java.patch | 6 +- .../model/ItemTransformVec3f.java.patch | 9 +- .../renderer/model/ModelBakery.java.patch | 123 +- .../renderer/model/ModelManager.java.patch | 41 +- .../renderer/model/ModelRotation.java.patch | 21 - .../model/SimpleBakedModel.java.patch | 14 +- .../client/renderer/model/Variant.java.patch | 19 - .../renderer/model/VariantList.java.patch | 20 - .../model/multipart/Multipart.java.patch | 17 - .../renderer/texture/AtlasTexture.java.patch | 128 +- .../renderer/texture/ISprite.java.patch | 20 - .../LayeredColorMaskTexture.java.patch | 12 - .../texture/LayeredTexture.java.patch | 11 + .../renderer/texture/NativeImage.java.patch | 20 +- .../renderer/texture/Stitcher.java.patch | 14 +- .../renderer/texture/Texture.java.patch | 14 + .../texture/TextureAtlasSprite.java.patch | 51 +- .../texture/TextureManager.java.patch | 17 +- .../PistonTileEntityRenderer.java.patch | 12 +- .../tileentity/TileEntityRenderer.java.patch | 11 - .../TileEntityRendererDispatcher.java.patch | 78 +- .../renderer/vertex/VertexFormat.java.patch | 40 +- .../vertex/VertexFormatElement.java.patch | 21 - .../client/settings/KeyBinding.java.patch | 11 +- .../client/world/ClientWorld.java.patch | 24 +- .../net/minecraft/command/Commands.java.patch | 2 +- .../arguments/EntitySelectorParser.java.patch | 7 +- .../data/LootTableProvider.java.patch | 28 +- .../net/minecraft/data/Main.java.patch | 13 +- .../minecraft/data/RecipeProvider.java.patch | 2 +- .../data/loot/BlockLootTables.java.patch | 12 +- .../data/loot/EntityLootTables.java.patch | 8 +- .../IDispenseItemBehavior.java.patch | 8 +- .../enchantment/EnchantmentHelper.java.patch | 6 +- .../FrostWalkerEnchantment.java.patch | 10 +- .../net/minecraft/entity/Entity.java.patch | 159 +- .../minecraft/entity/EntityType.java.patch | 27 +- .../minecraft/entity/FlyingEntity.java.patch | 12 +- .../minecraft/entity/LivingEntity.java.patch | 222 +- .../net/minecraft/entity/MobEntity.java.patch | 14 +- .../entity/ai/brain/task/FarmTask.java.patch | 2 +- .../entity/ai/goal/MeleeAttackGoal.java.patch | 4 +- .../ai/goal/RangedBowAttackGoal.java.patch | 6 +- .../entity/boss/WitherEntity.java.patch | 18 +- .../phase/FlamingSittingPhase.java.patch | 11 - .../effect/LightningBoltEntity.java.patch | 2 +- .../entity/item/BoatEntity.java.patch | 18 +- .../entity/item/EnderPearlEntity.java.patch | 14 +- .../item/ExperienceOrbEntity.java.patch | 26 +- .../entity/item/FallingBlockEntity.java.patch | 2 +- .../entity/item/HangingEntity.java.patch | 8 +- .../entity/item/ItemEntity.java.patch | 37 +- .../entity/item/ItemFrameEntity.java.patch | 2 +- .../entity/item/LeashKnotEntity.java.patch | 8 +- .../AbstractMinecartEntity.java.patch | 95 +- .../minecart/FurnaceMinecartEntity.java.patch | 2 +- .../item/minecart/MinecartEntity.java.patch | 2 +- .../villager/VillagerEntity.java.patch | 23 +- .../villager/VillagerProfession.java.patch | 8 +- .../monster/AbstractSkeletonEntity.java.patch | 6 +- .../entity/monster/CreeperEntity.java.patch | 6 +- .../entity/monster/EndermanEntity.java.patch | 26 +- .../entity/monster/EvokerEntity.java.patch | 2 +- .../monster/IllusionerEntity.java.patch | 6 +- .../entity/monster/MagmaCubeEntity.java.patch | 4 +- .../entity/monster/ShulkerEntity.java.patch | 23 +- .../monster/SilverfishEntity.java.patch | 4 +- .../entity/monster/SlimeEntity.java.patch | 19 +- .../entity/monster/ZombieEntity.java.patch | 18 +- .../entity/passive/FoxEntity.java.patch | 15 +- .../entity/passive/IronGolemEntity.java.patch | 17 +- .../entity/passive/MooshroomEntity.java.patch | 27 +- .../entity/passive/OcelotEntity.java.patch | 2 +- .../entity/passive/ParrotEntity.java.patch | 4 +- .../entity/passive/RabbitEntity.java.patch | 2 +- .../entity/passive/SheepEntity.java.patch | 6 +- .../entity/passive/SnowGolemEntity.java.patch | 20 +- .../entity/passive/WolfEntity.java.patch | 6 +- .../horse/AbstractHorseEntity.java.patch | 21 +- .../passive/horse/HorseEntity.java.patch | 5 +- .../passive/horse/LlamaEntity.java.patch | 15 - .../entity/player/PlayerEntity.java.patch | 194 +- .../player/ServerPlayerEntity.java.patch | 61 +- .../projectile/AbstractArrowEntity.java.patch | 10 +- .../DamagingProjectileEntity.java.patch | 2 +- .../projectile/FireballEntity.java.patch | 4 +- .../projectile/FishingBobberEntity.java.patch | 22 +- .../projectile/ProjectileHelper.java.patch | 2 +- .../projectile/ShulkerBulletEntity.java.patch | 16 +- .../projectile/SmallFireballEntity.java.patch | 2 +- .../projectile/ThrowableEntity.java.patch | 2 +- .../projectile/WitherSkullEntity.java.patch | 4 +- .../net/minecraft/fluid/Fluid.java.patch | 6 +- .../minecraft/fluid/IFluidState.java.patch | 4 +- .../net/minecraft/fluid/LavaFluid.java.patch | 6 +- .../inventory/container/Container.java.patch | 2 +- .../container/PlayerContainer.java.patch | 2 +- .../inventory/container/Slot.java.patch | 70 +- .../container/StonecutterContainer.java.patch | 11 - .../net/minecraft/item/ArmorItem.java.patch | 2 +- .../minecraft/item/BoneMealItem.java.patch | 8 +- .../net/minecraft/item/BowItem.java.patch | 10 +- .../net/minecraft/item/BucketItem.java.patch | 8 +- .../net/minecraft/item/DyeColor.java.patch | 2 +- .../minecraft/item/FilledMapItem.java.patch | 2 +- .../net/minecraft/item/Item.java.patch | 20 +- .../net/minecraft/item/ItemStack.java.patch | 72 +- .../net/minecraft/item/LilyPadItem.java.patch | 2 +- .../minecraft/item/MilkBucketItem.java.patch | 6 +- .../net/minecraft/item/ShearsItem.java.patch | 2 +- .../net/minecraft/item/ShovelItem.java.patch | 20 +- .../net/minecraft/nbt/CompoundNBT.java.patch | 22 +- .../nbt/CompressedStreamTools.java.patch | 6 +- .../minecraft/nbt/NBTSizeTracker.java.patch | 12 +- .../net/minecraft/nbt/StringNBT.java.patch | 16 +- .../network/NetworkManager.java.patch | 2 +- .../network/NetworkSystem.java.patch | 11 +- .../minecraft/network/PacketBuffer.java.patch | 2 +- .../play/ServerPlayNetHandler.java.patch | 26 +- .../play/server/SJoinGamePacket.java.patch | 10 +- .../play/server/SRespawnPacket.java.patch | 10 +- .../particles/ParticleTypes.java.patch | 2 +- .../FlyingNodeProcessor.java.patch | 21 - .../pathfinding/PathNavigator.java.patch | 6 +- .../SwimmerPathNavigator.java.patch | 4 +- .../pathfinding/WalkNodeProcessor.java.patch | 73 +- .../resources/VanillaPack.java.patch | 6 +- .../server/MinecraftServer.java.patch | 42 +- .../PlayerInteractionManager.java.patch | 67 +- .../server/management/PlayerList.java.patch | 44 +- .../net/minecraft/tags/BlockTags.java.patch | 2 +- .../minecraft/tags/EntityTypeTags.java.patch | 2 +- .../net/minecraft/tags/FluidTags.java.patch | 8 +- .../net/minecraft/tags/ItemTags.java.patch | 2 +- .../net/minecraft/tags/Tag.java.patch | 18 +- .../tileentity/BannerPattern.java.patch | 4 +- .../tileentity/ChestTileEntity.java.patch | 7 +- .../tileentity/HopperTileEntity.java.patch | 8 +- .../tileentity/LockableTileEntity.java.patch | 5 +- .../tileentity/PistonTileEntity.java.patch | 10 +- .../ShulkerBoxTileEntity.java.patch | 2 +- .../tileentity/TileEntity.java.patch | 10 +- .../tileentity/TileEntityType.java.patch | 11 +- .../minecraft/util/ActionResult.java.patch | 12 - .../util/ScreenShotHelper.java.patch | 45 +- .../shapes/EntitySelectionContext.java.patch | 6 +- .../palette/PalettedContainer.java.patch} | 18 +- .../util/registry/Registry.java.patch | 17 +- .../{translation => }/LanguageMap.java.patch | 9 +- .../text/TranslationTextComponent.java.patch | 2 +- .../village/PointOfInterestType.java.patch | 4 +- .../net/minecraft/world/Explosion.java.patch | 40 +- .../net/minecraft/world/IWorld.java.patch | 2 +- .../minecraft/world/IWorldReader.java.patch | 6 +- .../minecraft/world/TrackedEntity.java.patch | 4 +- .../net/minecraft/world/World.java.patch | 234 +- .../net/minecraft/world/WorldType.java.patch | 5 +- .../minecraft/world/biome/Biome.java.patch | 14 +- .../biome/DefaultBiomeFeatures.java.patch | 49 + .../provider/BiomeProviderType.java.patch | 8 +- .../minecraft/world/chunk/Chunk.java.patch | 58 +- .../minecraft/world/chunk/IChunk.java.patch | 2 +- .../chunk/storage/ChunkSerializer.java.patch | 18 +- .../world/chunk/storage/RegionFile.java.patch | 189 +- .../chunk/storage/RegionFileCache.java.patch | 11 + .../world/dimension/Dimension.java.patch | 8 +- .../world/dimension/DimensionType.java.patch | 39 +- .../world/dimension/EndDimension.java.patch | 2 +- .../dimension/NetherDimension.java.patch | 2 +- .../dimension/OverworldDimension.java.patch | 2 +- .../world/end/DragonFightManager.java.patch | 2 +- .../world/gen/ChunkGenerator.java.patch | 2 +- .../world/gen/WorldGenRegion.java.patch | 24 +- .../world/gen/carver/WorldCarver.java.patch | 2 +- .../AbstractBigMushroomFeature.java.patch | 29 + .../AbstractSmallTreeFeature.java.patch | 29 + .../feature/AbstractTreeFeature.java.patch | 84 +- .../gen/feature/AcaciaFeature.java.patch | 11 + .../feature/BaseTreeFeatureConfig.java.patch | 58 + .../BigBrownMushroomFeature.java.patch | 45 +- .../feature/BigRedMushroomFeature.java.patch | 34 +- .../gen/feature/BigTreeFeature.java.patch | 20 - .../gen/feature/BirchTreeFeature.java.patch | 39 - .../gen/feature/BonusChestFeature.java.patch | 11 - .../world/gen/feature/BushFeature.java.patch | 11 - .../gen/feature/DarkOakTreeFeature.java.patch | 47 +- .../gen/feature/DeadBushFeature.java.patch | 11 - .../gen/feature/DoublePlantFeature.java.patch | 11 - .../world/gen/feature/Feature.java.patch | 43 +- .../gen/feature/FlowersFeature.java.patch | 11 + .../feature/HugeTreeFeatureConfig.java.patch | 46 + .../gen/feature/HugeTreesFeature.java.patch | 38 +- .../gen/feature/IceSpikeFeature.java.patch | 12 +- .../gen/feature/JungleGrassFeature.java.patch | 11 - .../gen/feature/JungleTreeFeature.java.patch | 10 - .../gen/feature/MegaJungleFeature.java.patch | 15 +- .../world/gen/feature/MegaPineTree.java.patch | 24 +- .../feature/NetherSpringFeature.java.patch | 11 - .../feature/PointyTaigaTreeFeature.java.patch | 39 - .../gen/feature/SavannaTreeFeature.java.patch | 31 - .../world/gen/feature/ShrubFeature.java.patch | 19 +- .../gen/feature/SpringFeature.java.patch | 6 +- .../gen/feature/SwampTreeFeature.java.patch | 31 - .../gen/feature/TaigaGrassFeature.java.patch | 11 - .../feature/TallTaigaTreeFeature.java.patch | 39 - .../world/gen/feature/TreeFeature.java.patch | 38 +- .../gen/feature/TreeFeatureConfig.java.patch | 45 + .../world/gen/feature/VinesFeature.java.patch | 8 +- .../jigsaw/SingleJigsawPiece.java.patch | 10 +- .../structure/MineshaftPieces.java.patch | 2 +- .../structure/StructurePiece.java.patch | 2 +- .../structure/StructureStart.java.patch | 4 +- .../feature/structure/Structures.java.patch | 2 +- .../gen/feature/template/Template.java.patch | 19 +- .../world/gen/layer/BiomeLayer.java.patch | 20 +- .../world/gen/layer/LayerUtil.java.patch | 34 +- .../world/gen/placement/Placement.java.patch | 6 +- .../world/lighting/LevelBasedGraph.java.patch | 10 +- .../world/lighting/LightEngine.java.patch | 2 +- .../lighting/SectionLightStorage.java.patch | 14 - .../world/server/ChunkHolder.java.patch | 8 +- .../world/server/ChunkManager.java.patch | 12 +- .../{ => server}/ServerMultiWorld.java.patch | 7 +- .../world/server/ServerWorld.java.patch | 99 +- .../world/spawner/AbstractSpawner.java.patch | 8 +- .../spawner/WorldEntitySpawner.java.patch | 36 +- .../world/storage/WorldInfo.java.patch | 2 +- .../world/storage/loot/LootContext.java.patch | 2 +- .../storage/loot/LootParameterSets.java.patch | 16 +- .../world/storage/loot/LootPool.java.patch | 22 +- .../world/storage/loot/LootTable.java.patch | 14 +- .../net/minecraft/block/Block.java.patch | 11 - .../net/minecraft/block/ChestBlock.java.patch | 11 - .../multiplayer/PlayerController.java.patch | 116 - .../client/renderer/GameRenderer.java.patch | 21 - .../renderer/texture/AtlasTexture.java.patch | 53 - .../texture/TextureManager.java.patch | 28 - .../client/shader/Framebuffer.java.patch | 57 - .../net/minecraft/entity/Entity.java.patch | 63 - .../entity/item/EnderPearlEntity.java.patch | 18 - .../entity/item/ItemEntity.java.patch | 15 - .../player/ServerPlayerEntity.java.patch | 29 - .../minecraft/item/ItemSeedFood.java.patch | 35 - .../net/minecraft/item/ItemSeeds.java.patch | 35 - ...SimpleReloadableResourceManager.java.patch | 27 - .../minecraft/world/ServerWorld.java.patch | 11 - .../net/minecraft/world/World.java.patch | 151 -- .../world/gen/feature/OreFeature.java.patch | 11 - .../storage/loot/EmptyLootEntry.java.patch | 21 - .../storage/loot/ILootGenerator.java.patch | 55 - .../storage/loot/ItemLootEntry.java.patch | 30 - .../world/storage/loot/LootPool.java.patch | 100 - .../world/storage/loot/LootTable.java.patch | 57 - .../storage/loot/LootTableManager.java.patch | 11 - .../storage/loot/TableLootEntry.java.patch | 21 - .../fml/loading/RuntimeDistCleaner.java | 2 +- .../moddiscovery/ModAnnotationVisitor.java | 2 +- .../loading/moddiscovery/ModClassVisitor.java | 2 +- .../loading/moddiscovery/ModFieldVisitor.java | 2 +- .../moddiscovery/ModMethodVisitor.java | 2 +- .../minecraftforge/client/CloudRenderer.java | 205 +- .../client/ForgeHooksClient.java | 308 +-- .../client/MinecraftForgeClient.java | 7 +- .../client/event/EntityViewRenderEvent.java | 45 +- .../event/PlayerSPPushOutOfBlocksEvent.java | 20 +- .../client/event/RenderBlockOverlayEvent.java | 15 +- .../client/event/RenderHandEvent.java | 13 +- .../client/event/RenderLivingEvent.java | 26 +- .../client/event/RenderPlayerEvent.java | 19 +- .../client/event/RenderSpecificHandEvent.java | 15 +- .../client/event/RenderWorldLastEvent.java | 12 +- .../client/event/ScreenshotEvent.java | 4 + .../client/extensions/IForgeBakedModel.java | 17 +- .../extensions/IForgeModelTransform.java} | 11 +- .../IForgeTransformationMatrix.java | 97 + .../extensions/IForgeUnbakedModel.java} | 25 +- .../extensions/IForgeVertexBuilder.java | 92 + .../client/{ => gui}/ForgeIngameGui.java | 137 +- .../gui/NotificationModUpdateScreen.java | 9 +- .../client/gui/ScrollPanel.java | 63 +- .../client/model/Attributes.java | 27 +- .../client/model/BakedItemModel.java | 36 +- .../client/model/BakedModelWrapper.java | 15 +- .../client/model/BlockModelConfiguration.java | 174 ++ .../client/model/BlockStateLoader.java | 244 -- ...{BasicState.java => DummyAtlasSprite.java} | 35 +- .../client/model/FancyMissingModel.java | 70 +- .../client/model/ForgeBlockStateV1.java | 978 -------- .../minecraftforge/client/model/IModel.java | 102 - .../client/model/IModelBuilder.java | 70 + .../client/model/IModelConfiguration.java | 91 + .../client/model/IModelLoader.java | 53 + .../client/model/ItemLayerModel.java | 130 +- .../model/ItemTextureQuadConverter.java | 19 +- .../client/model/ModelDynBucket.java | 387 ++- .../client/model/ModelFluid.java | 110 +- .../client/model/ModelLoader.java | 685 +----- .../client/model/ModelLoaderRegistry.java | 478 ++-- ...ariant.java => ModelLoadingException.java} | 17 +- ...on.java => ModelTransformComposition.java} | 46 +- .../client/model/MultiLayerModel.java | 77 +- .../client/model/MultiModel.java | 287 --- .../client/model/MultiModelState.java | 156 -- .../client/model/PerspectiveMapWrapper.java | 121 +- .../client/model/QuadTransformer.java | 200 ++ .../client/model/SimpleModelFontRenderer.java | 27 +- .../client/model/SimpleModelState.java | 35 +- .../client/model/SimpleModelTransform.java | 64 + .../animation/AnimationItemOverrideList.java | 38 +- .../model/animation/AnimationModelBase.java | 1 - .../model/animation/ModelBlockAnimation.java | 70 +- .../TileEntityRendererAnimation.java | 29 +- .../animation/TileEntityRendererFast.java | 95 - .../client/model/b3d/B3DClip.java | 17 +- .../client/model/b3d/B3DLoader.java | 236 +- .../client/model/b3d/B3DModel.java | 7 +- .../model/composite/CompositeModel.java | 267 +++ .../model/composite/package-info.java} | 13 +- .../model/generators/BlockModelProvider.java | 19 + .../model/generators/ConfiguredModel.java | 19 + .../model/generators/ExistingFileHelper.java | 21 +- .../generators/IGeneratedBlockstate.java | 19 + .../model/generators/ItemModelProvider.java | 19 + .../MultiPartBlockStateBuilder.java | 19 + .../client/model/geometry/IModelGeometry.java | 51 + .../model/geometry/IModelGeometryPart.java | 48 + .../geometry/IMultipartModelGeometry.java | 60 + .../model/geometry/ISimpleModelGeometry.java | 51 + .../client/model/obj/MaterialLibrary.java | 125 + .../client/model/obj/OBJLoader.java | 253 +- .../client/model/obj/OBJModel.java | 2103 +++++------------ .../client/model/pipeline/BlockInfo.java | 16 +- .../pipeline/ForgeBlockModelRenderer.java | 21 +- .../model/pipeline/IVertexConsumer.java | 4 +- .../client/model/pipeline/LightUtil.java | 58 +- .../pipeline/QuadGatheringTransformer.java | 6 +- .../model/pipeline/TRSRTransformer.java | 12 +- .../model/pipeline/UnpackedBakedQuad.java | 20 +- .../model/pipeline/VertexBufferConsumer.java | 21 +- .../model/pipeline/VertexLighterFlat.java | 27 +- .../common/DimensionManager.java | 9 +- .../net/minecraftforge/common/ForgeHooks.java | 14 +- .../common/ForgeInternalHandler.java | 5 +- .../minecraftforge/common/ModDimension.java | 6 + .../common/data/ForgeBlockTagsProvider.java | 2 +- .../common/data/LanguageProvider.java | 1 + .../common/extensions/IForgeBlock.java | 46 +- .../common/extensions/IForgeBlockState.java | 53 +- .../common/extensions/IForgeDimension.java | 54 +- .../extensions/IForgeEffectInstance.java | 57 + .../extensions/IForgeEntityMinecart.java | 8 +- .../common/extensions/IForgeFluid.java | 5 +- .../common/extensions/IForgeFluidState.java | 4 +- .../common/extensions/IForgeItem.java | 2 +- .../common/extensions/IForgeItemStack.java | 13 + .../common/extensions/IForgeWorldType.java | 2 +- .../common/model/HiddenModelPart.java | 2 +- .../minecraftforge/common/model/Models.java | 4 +- .../common/model/TRSRTransformation.java | 865 ------- .../common/model/TransformationHelper.java | 436 ++++ .../animation/AnimationStateMachine.java | 16 +- .../common/model/animation/Clips.java | 41 +- .../animation/IAnimationStateMachine.java | 4 +- .../common/model/animation/IJoint.java | 7 +- .../common/model/animation/IJointClip.java | 4 +- .../common/model/animation/JointClips.java | 8 +- .../common/property/Properties.java | 4 +- .../common/util/ChunkCoordComparator.java | 4 +- .../net/minecraftforge/common/util/Lazy.java | 108 + .../common/util/NonNullLazy.java | 109 + .../energy/CapabilityEnergy.java | 2 +- .../event/ForgeEventFactory.java | 25 +- .../event/entity/living/LivingSpawnEvent.java | 2 +- .../entity/player/PlayerPickupXpEvent.java | 39 - .../entity/player/PlayerWakeUpEvent.java | 11 +- .../event/world/PistonEvent.java | 4 +- .../fluids/FluidAttributes.java | 75 +- .../net/minecraftforge/fluids/FluidUtil.java | 8 +- .../fluids/ForgeFlowingFluid.java | 15 +- .../fml/client/ClientModLoader.java | 9 +- .../fml/client/EarlyLoaderGUI.java | 35 +- .../fml/client/config/GuiButtonExt.java | 5 +- .../fml/client/config/GuiSlider.java | 4 +- .../client/config/GuiUnicodeGlyphButton.java | 12 +- .../fml/client/config/GuiUtils.java | 97 +- .../fml/client/gui/GuiModList.java | 12 +- .../fml/client/gui/GuiSlotModList.java | 8 +- .../fml/client/registry/ClientRegistry.java | 6 +- .../client/registry/RenderingRegistry.java | 9 +- .../fml/network/FMLPlayMessages.java | 9 +- .../fml/packs/DelegatableResourcePack.java | 19 + .../fml/packs/DelegatingResourcePack.java | 23 +- .../fml/packs/ModFileResourcePack.java | 3 +- .../items/ItemHandlerHelper.java | 5 +- .../registries/ForgeRegistry.java | 2 +- .../server/command/TextComponentHelper.java | 2 +- .../resources/META-INF/accesstransformer.cfg | 66 +- .../assets/forge/models/block/default.json | 3 + .../assets/forge/models/item/bucket.json | 5 +- .../assets/forge/models/item/bucket_drip.json | 7 + .../forge/models/item/default-tool.json | 24 + .../assets/forge/models/item/default.json | 28 + src/main/resources/forge.exc | 17 +- src/main/resources/forge.sas | 13 +- .../debug/block/CustomTNTTest.java | 11 +- .../debug/block/FarmlandTrampleEventTest.java | 2 +- .../debug/block/PathNodeTypeTest.java | 7 +- .../debug/block/PistonEventTest.java | 2 +- .../client/model/BlockstateRetextureTest.java | 81 - .../model/ForgeBlockStatesLoaderTest.java | 61 - .../debug/client/model/ModelDataTest.java | 4 +- .../client/model/ModelLoaderRegistryTest.java | 10 +- .../client/model/NewModelLoaderTest.java | 112 + .../debug/entity/GravityAttributeTest.java | 2 +- .../entity/player/PlayerXpEventTest.java | 27 +- .../debug/fluid/NewFluidTest.java | 9 +- .../testmods/TestOBJModelMod.java | 70 - src/test/resources/META-INF/mods.toml | 12 +- .../blockstates/test_fluid_block.json | 5 + .../models/block/test_fluid.json | 5 + .../models/item/test_fluid_bucket.json | 31 + .../models/item/concept_item.json | 14 + .../models/item/custom_transforms.json | 13 + .../models/item/custom_vanilla_loader.json | 56 + .../models/item/item_direction.mtl | 7 + .../models/item/item_direction.obj | 650 +++++ .../models/item/obj_item.json | 50 + .../models/item/sugar_glider.mtl | 46 + .../models/item/sugar_glider.obj | 579 +++++ 565 files changed, 11114 insertions(+), 13142 deletions(-) delete mode 100644 patches/minecraft/com/mojang/blaze3d/platform/GLX.java.patch create mode 100644 patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch create mode 100644 patches/minecraft/com/mojang/blaze3d/vertex/IVertexBuilder.java.patch create mode 100644 patches/minecraft/net/minecraft/block/CampfireBlock.java.patch create mode 100644 patches/minecraft/net/minecraft/block/PistonBlockStructureHelper.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/state/PistonBlockStructureHelper.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/ChestRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/Quaternion.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/TransformationMatrix.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/Vector3f.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/Vector4f.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRender.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderTask.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/model/BakedQuadRetextured.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/model/BlockModelDefinition.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/model/IModelTransform.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/model/ModelRotation.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/model/Variant.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/model/multipart/Multipart.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/ISprite.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/LayeredTexture.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/passive/horse/LlamaEntity.java.patch delete mode 100644 patches/minecraft/net/minecraft/inventory/container/StonecutterContainer.java.patch delete mode 100644 patches/minecraft/net/minecraft/pathfinding/FlyingNodeProcessor.java.patch delete mode 100644 patches/minecraft/net/minecraft/util/ActionResult.java.patch rename patches/minecraft/net/minecraft/{world/chunk/BlockStateContainer.java.patch => util/palette/PalettedContainer.java.patch} (67%) rename patches/minecraft/net/minecraft/util/text/{translation => }/LanguageMap.java.patch (60%) create mode 100644 patches/minecraft/net/minecraft/world/biome/DefaultBiomeFeatures.java.patch create mode 100644 patches/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/AbstractSmallTreeFeature.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/AcaciaFeature.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/BigTreeFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/BirchTreeFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/BonusChestFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/BushFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/DeadBushFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/DoublePlantFeature.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/FlowersFeature.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/JungleGrassFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/JungleTreeFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/NetherSpringFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/SavannaTreeFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/SwampTreeFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/TaigaGrassFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/TreeFeatureConfig.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/lighting/SectionLightStorage.java.patch rename patches/minecraft/net/minecraft/world/{ => server}/ServerMultiWorld.java.patch (89%) delete mode 100644 patches_old/minecraft/net/minecraft/block/Block.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/block/ChestBlock.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/client/shader/Framebuffer.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/entity/Entity.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/entity/item/ItemEntity.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/item/ItemSeedFood.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/item/ItemSeeds.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/world/ServerWorld.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/world/World.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/world/gen/feature/OreFeature.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/world/storage/loot/EmptyLootEntry.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/world/storage/loot/ILootGenerator.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/world/storage/loot/ItemLootEntry.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/world/storage/loot/TableLootEntry.java.patch rename src/main/java/net/minecraftforge/{common/model/IModelState.java => client/extensions/IForgeModelTransform.java} (82%) create mode 100644 src/main/java/net/minecraftforge/client/extensions/IForgeTransformationMatrix.java rename src/main/java/net/minecraftforge/{common/model/ITransformation.java => client/extensions/IForgeUnbakedModel.java} (63%) create mode 100644 src/main/java/net/minecraftforge/client/extensions/IForgeVertexBuilder.java rename src/main/java/net/minecraftforge/client/{ => gui}/ForgeIngameGui.java (86%) create mode 100644 src/main/java/net/minecraftforge/client/model/BlockModelConfiguration.java delete mode 100644 src/main/java/net/minecraftforge/client/model/BlockStateLoader.java rename src/main/java/net/minecraftforge/client/model/{BasicState.java => DummyAtlasSprite.java} (53%) delete mode 100644 src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java delete mode 100644 src/main/java/net/minecraftforge/client/model/IModel.java create mode 100644 src/main/java/net/minecraftforge/client/model/IModelBuilder.java create mode 100644 src/main/java/net/minecraftforge/client/model/IModelConfiguration.java create mode 100644 src/main/java/net/minecraftforge/client/model/IModelLoader.java rename src/main/java/net/minecraftforge/client/model/{ISmartVariant.java => ModelLoadingException.java} (72%) rename src/main/java/net/minecraftforge/client/model/{ModelStateComposition.java => ModelTransformComposition.java} (58%) delete mode 100644 src/main/java/net/minecraftforge/client/model/MultiModel.java delete mode 100644 src/main/java/net/minecraftforge/client/model/MultiModelState.java create mode 100644 src/main/java/net/minecraftforge/client/model/QuadTransformer.java create mode 100644 src/main/java/net/minecraftforge/client/model/SimpleModelTransform.java delete mode 100644 src/main/java/net/minecraftforge/client/model/animation/TileEntityRendererFast.java create mode 100644 src/main/java/net/minecraftforge/client/model/composite/CompositeModel.java rename src/main/java/net/minecraftforge/{common/model/IModelPart.java => client/model/composite/package-info.java} (76%) create mode 100644 src/main/java/net/minecraftforge/client/model/geometry/IModelGeometry.java create mode 100644 src/main/java/net/minecraftforge/client/model/geometry/IModelGeometryPart.java create mode 100644 src/main/java/net/minecraftforge/client/model/geometry/IMultipartModelGeometry.java create mode 100644 src/main/java/net/minecraftforge/client/model/geometry/ISimpleModelGeometry.java create mode 100644 src/main/java/net/minecraftforge/client/model/obj/MaterialLibrary.java delete mode 100644 src/main/java/net/minecraftforge/common/model/TRSRTransformation.java create mode 100644 src/main/java/net/minecraftforge/common/model/TransformationHelper.java create mode 100644 src/main/java/net/minecraftforge/common/util/Lazy.java create mode 100644 src/main/java/net/minecraftforge/common/util/NonNullLazy.java delete mode 100644 src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java create mode 100644 src/main/resources/assets/forge/models/block/default.json create mode 100644 src/main/resources/assets/forge/models/item/bucket_drip.json create mode 100644 src/main/resources/assets/forge/models/item/default-tool.json create mode 100644 src/main/resources/assets/forge/models/item/default.json delete mode 100644 src/test/java/net/minecraftforge/debug/client/model/BlockstateRetextureTest.java delete mode 100644 src/test/java/net/minecraftforge/debug/client/model/ForgeBlockStatesLoaderTest.java create mode 100644 src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java delete mode 100644 src/test/java/net/minecraftforge/testmods/TestOBJModelMod.java create mode 100644 src/test/resources/assets/new_fluid_test/blockstates/test_fluid_block.json create mode 100644 src/test/resources/assets/new_fluid_test/models/block/test_fluid.json create mode 100644 src/test/resources/assets/new_fluid_test/models/item/test_fluid_bucket.json create mode 100644 src/test/resources/assets/new_model_loader_test/models/item/concept_item.json create mode 100644 src/test/resources/assets/new_model_loader_test/models/item/custom_transforms.json create mode 100644 src/test/resources/assets/new_model_loader_test/models/item/custom_vanilla_loader.json create mode 100644 src/test/resources/assets/new_model_loader_test/models/item/item_direction.mtl create mode 100644 src/test/resources/assets/new_model_loader_test/models/item/item_direction.obj create mode 100644 src/test/resources/assets/new_model_loader_test/models/item/obj_item.json create mode 100644 src/test/resources/assets/new_model_loader_test/models/item/sugar_glider.mtl create mode 100644 src/test/resources/assets/new_model_loader_test/models/item/sugar_glider.obj diff --git a/build.gradle b/build.gradle index 175f18b37..bb33aaf73 100644 --- a/build.gradle +++ b/build.gradle @@ -7,8 +7,8 @@ buildscript { } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:3.+' - classpath 'org.ow2.asm:asm:7.1' - classpath 'org.ow2.asm:asm-tree:7.1' + classpath 'org.ow2.asm:asm:7.2' + classpath 'org.ow2.asm:asm-tree:7.2' } } import groovy.json.JsonSlurper @@ -59,8 +59,8 @@ ext { } MAPPING_CHANNEL = 'snapshot' MAPPING_VERSION = '20190719-1.14.3' - MC_VERSION = '1.14.4' - MCP_VERSION = '20190829.143755' + MC_VERSION = '1.15' + MCP_VERSION = '20191212.203412' } project(':mcp') { @@ -82,7 +82,7 @@ project(':clean') { } dependencies { - implementation 'net.minecraftforge:forgespi:1.1.+' + implementation 'net.minecraftforge:forgespi:2.0.+' } patcher { parent = project(':mcp') @@ -185,7 +185,7 @@ project(':forge') { } ext { - SPEC_VERSION = '28.1' // This is overwritten by git tag, but here so dev time doesnt explode + SPEC_VERSION = '29.0' // This is overwritten by git tag, but here so dev time doesnt explode // The new versioning sceme is -.. // ForgeMC is a unique identifier for every MC version we have supported. // Essentially, the same as the old, except dropping the first number, and the builds are no longer unique. @@ -402,21 +402,21 @@ project(':forge') { fmllauncherImplementation.extendsFrom(installer) } dependencies { - installer 'org.ow2.asm:asm:6.2' - installer 'org.ow2.asm:asm-commons:6.2' - installer 'org.ow2.asm:asm-tree:6.2' - installer 'cpw.mods:modlauncher:4.1.+' + installer 'org.ow2.asm:asm:7.2' + installer 'org.ow2.asm:asm-commons:7.2' + installer 'org.ow2.asm:asm-tree:7.2' + installer 'cpw.mods:modlauncher:5.0.+' installer 'cpw.mods:grossjava9hacks:1.1.+' - installer 'net.minecraftforge:accesstransformers:1.0.+:shadowed' - installer 'net.minecraftforge:eventbus:1.0.+:service' - installer 'net.minecraftforge:forgespi:1.5.+' - installer 'net.minecraftforge:coremods:1.0.+' + installer 'net.minecraftforge:accesstransformers:2.0.+:shadowed' + installer 'net.minecraftforge:eventbus:2.0.+:service' + installer 'net.minecraftforge:forgespi:2.0.+' + installer 'net.minecraftforge:coremods:2.0.+' installer 'net.minecraftforge:unsafe:0.2.+' - installer 'com.electronwill.night-config:core:3.6.0' - installer 'com.electronwill.night-config:toml:3.6.0' + installer 'com.electronwill.night-config:core:3.6.2' + installer 'com.electronwill.night-config:toml:3.6.2' installer 'org.jline:jline:3.12.+' installer 'org.apache.maven:maven-artifact:3.6.0' - installer 'net.jodah:typetools:0.6.0' + installer 'net.jodah:typetools:0.6.1' installer 'java3d:vecmath:1.5.2' installer 'org.apache.logging.log4j:log4j-api:2.11.2' installer 'org.apache.logging.log4j:log4j-core:2.11.2' diff --git a/patches/minecraft/com/mojang/blaze3d/platform/GLX.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/GLX.java.patch deleted file mode 100644 index f7359a16e..000000000 --- a/patches/minecraft/com/mojang/blaze3d/platform/GLX.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/com/mojang/blaze3d/platform/GLX.java -+++ b/com/mojang/blaze3d/platform/GLX.java -@@ -115,6 +115,10 @@ - p_212906_0_.put(1286, "Operation on incomplete framebuffer"); - }); - -+ /* Stores the last values sent into glMultiTexCoord2f */ -+ public static float lastBrightnessX = 0.0f; -+ public static float lastBrightnessY = 0.0f; -+ - public static void populateSnooperWithOpenGL(IDataHolder p_populateSnooperWithOpenGL_0_) { - p_populateSnooperWithOpenGL_0_.setFixedData("opengl_version", GlStateManager.getString(7938)); - p_populateSnooperWithOpenGL_0_.setFixedData("opengl_vendor", GlStateManager.getString(7936)); -@@ -913,6 +917,10 @@ - GL13.glMultiTexCoord2f(p_glMultiTexCoord2f_0_, p_glMultiTexCoord2f_1_, p_glMultiTexCoord2f_2_); - } - -+ if (p_glMultiTexCoord2f_0_ == GL_TEXTURE1) { -+ lastBrightnessX = p_glMultiTexCoord2f_1_; -+ lastBrightnessY = p_glMultiTexCoord2f_2_; -+ } - } - - public static void glBlendFuncSeparate(int p_glBlendFuncSeparate_0_, int p_glBlendFuncSeparate_1_, int p_glBlendFuncSeparate_2_, int p_glBlendFuncSeparate_3_) { diff --git a/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch new file mode 100644 index 000000000..5c0ae79ab --- /dev/null +++ b/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch @@ -0,0 +1,20 @@ +--- a/com/mojang/blaze3d/platform/GlStateManager.java ++++ b/com/mojang/blaze3d/platform/GlStateManager.java +@@ -578,10 +578,17 @@ + GL13.glClientActiveTexture(p_227747_0_); + } + ++ /* Stores the last values sent into glMultiTexCoord2f */ ++ public static float lastBrightnessX = 0.0f; ++ public static float lastBrightnessY = 0.0f; + @Deprecated + public static void func_227640_a_(int p_227640_0_, float p_227640_1_, float p_227640_2_) { + RenderSystem.assertThread(RenderSystem::isOnRenderThread); + GL13.glMultiTexCoord2f(p_227640_0_, p_227640_1_, p_227640_2_); ++ if (p_227640_0_ == GL13.GL_TEXTURE1) { ++ lastBrightnessX = p_227640_1_; ++ lastBrightnessY = p_227640_2_; ++ } + } + + public static void func_227706_d_(int p_227706_0_, int p_227706_1_, int p_227706_2_, int p_227706_3_) { diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/IVertexBuilder.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/IVertexBuilder.java.patch new file mode 100644 index 000000000..1824e1927 --- /dev/null +++ b/patches/minecraft/com/mojang/blaze3d/vertex/IVertexBuilder.java.patch @@ -0,0 +1,11 @@ +--- a/com/mojang/blaze3d/vertex/IVertexBuilder.java ++++ b/com/mojang/blaze3d/vertex/IVertexBuilder.java +@@ -17,7 +17,7 @@ + import org.lwjgl.system.MemoryStack; + + @OnlyIn(Dist.CLIENT) +-public interface IVertexBuilder { ++public interface IVertexBuilder extends net.minecraftforge.client.extensions.IForgeVertexBuilder { + Logger field_227884_f_ = LogManager.getLogger(); + + IVertexBuilder func_225582_a_(double p_225582_1_, double p_225582_3_, double p_225582_5_); diff --git a/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch b/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch index 3267ad078..f9b2a3da6 100644 --- a/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch +++ b/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/advancements/criterion/ItemPredicate.java +++ b/net/minecraft/advancements/criterion/ItemPredicate.java -@@ -25,6 +25,8 @@ +@@ -26,6 +26,8 @@ import net.minecraft.util.registry.Registry; public class ItemPredicate { @@ -9,7 +9,7 @@ public static final ItemPredicate field_192495_a = new ItemPredicate(); @Nullable private final Tag field_200018_b; -@@ -93,6 +95,11 @@ +@@ -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"); @@ -21,7 +21,7 @@ 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")) { -@@ -181,6 +188,14 @@ +@@ -204,6 +211,14 @@ } } @@ -35,4 +35,4 @@ + public static class Builder { private final List field_200312_a = Lists.newArrayList(); - @Nullable + private final List field_226657_b_ = Lists.newArrayList(); diff --git a/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch b/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch index 5837d4464..746bbfbe3 100644 --- a/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/AbstractRailBlock.java +++ b/net/minecraft/block/AbstractRailBlock.java -@@ -35,7 +35,7 @@ +@@ -36,7 +36,7 @@ } public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { @@ -9,7 +9,7 @@ return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a; } -@@ -57,7 +57,7 @@ +@@ -56,7 +56,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) { @@ -27,8 +27,8 @@ p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this); } -@@ -127,5 +127,66 @@ - } +@@ -134,5 +134,66 @@ + 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 diff --git a/patches/minecraft/net/minecraft/block/BedBlock.java.patch b/patches/minecraft/net/minecraft/block/BedBlock.java.patch index de8f72a7e..ef1ae354f 100644 --- a/patches/minecraft/net/minecraft/block/BedBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/BedBlock.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/block/BedBlock.java +++ b/net/minecraft/block/BedBlock.java -@@ -85,7 +85,9 @@ +@@ -88,7 +88,9 @@ } } -- if (p_220051_2_.field_73011_w.func_76567_e() && p_220051_2_.func_180494_b(p_220051_3_) != Biomes.field_76778_j) { -+ net.minecraftforge.common.extensions.IForgeDimension.SleepResult sleepResult = p_220051_2_.field_73011_w.canSleepAt(p_220051_4_, p_220051_3_); +- if (p_225533_2_.field_73011_w.func_76567_e() && p_225533_2_.func_226691_t_(p_225533_3_) != Biomes.field_76778_j) { ++ net.minecraftforge.common.extensions.IForgeDimension.SleepResult sleepResult = p_225533_2_.field_73011_w.canSleepAt(p_225533_4_, p_225533_3_); + if (sleepResult != net.minecraftforge.common.extensions.IForgeDimension.SleepResult.BED_EXPLODES) { -+ if (sleepResult == net.minecraftforge.common.extensions.IForgeDimension.SleepResult.DENY) return true; - if (p_220051_1_.func_177229_b(field_176471_b)) { - p_220051_4_.func_146105_b(new TranslationTextComponent("block.minecraft.bed.occupied"), true); - return true; ++ if (sleepResult == net.minecraftforge.common.extensions.IForgeDimension.SleepResult.DENY) return ActionResultType.SUCCESS; + if (p_225533_1_.func_177229_b(field_176471_b)) { + if (!this.func_226861_a_(p_225533_2_, p_225533_3_)) { + p_225533_4_.func_146105_b(new TranslationTextComponent("block.minecraft.bed.occupied"), true); diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 4aaad007c..62a310d62 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -14,17 +14,17 @@ private static final LoadingCache field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader() { public Boolean load(VoxelShape p_load_1_) { @@ -246,6 +247,10 @@ - this.field_149765_K = p_i48440_1_.field_200961_i; - this.field_208621_p = p_i48440_1_.field_208772_j; - this.field_220085_g = p_i48440_1_.field_222381_j; + 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_176227_L = builder.func_206893_a(BlockState::new); - this.func_180632_j(this.field_176227_L.func_177621_b()); - } -@@ -291,7 +296,7 @@ + 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_) { @@ -33,7 +33,7 @@ } @Deprecated -@@ -303,8 +308,9 @@ +@@ -314,8 +319,9 @@ return this.field_149789_z; } @@ -44,16 +44,7 @@ } @Deprecated -@@ -315,7 +321,7 @@ - @Deprecated - @OnlyIn(Dist.CLIENT) - public int func_220058_a(BlockState p_220058_1_, IEnviromentBlockReader p_220058_2_, BlockPos p_220058_3_) { -- return p_220058_2_.func_217338_b(p_220058_3_, p_220058_1_.func_185906_d()); -+ return p_220058_2_.func_217338_b(p_220058_3_, p_220058_1_.getLightValue(p_220058_2_, p_220058_3_)); - } - - @OnlyIn(Dist.CLIENT) -@@ -460,10 +466,9 @@ +@@ -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_) { @@ -65,7 +56,7 @@ } @Deprecated -@@ -472,8 +477,8 @@ +@@ -483,8 +488,8 @@ if (f == -1.0F) { return 0.0F; } else { @@ -76,7 +67,7 @@ } } -@@ -483,8 +488,7 @@ +@@ -494,8 +499,7 @@ public ResourceLocation func_220068_i() { if (this.field_220085_g == null) { @@ -86,7 +77,7 @@ } return this.field_220085_g; -@@ -553,7 +557,7 @@ +@@ -555,7 +559,7 @@ } public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { @@ -95,7 +86,7 @@ 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; -@@ -565,7 +569,7 @@ +@@ -567,7 +571,7 @@ } public void func_180637_b(World p_180637_1_, BlockPos p_180637_2_, int p_180637_3_) { @@ -104,7 +95,7 @@ while(p_180637_3_ > 0) { int i = ExperienceOrbEntity.func_70527_a(p_180637_3_); p_180637_3_ -= i; -@@ -575,6 +579,7 @@ +@@ -577,6 +581,7 @@ } @@ -112,7 +103,7 @@ public float func_149638_a() { return this.field_149781_w; } -@@ -677,6 +682,7 @@ +@@ -675,6 +680,7 @@ p_176216_2_.func_213317_d(p_176216_2_.func_213322_ci().func_216372_d(1.0D, 0.0D, 1.0D)); } @@ -120,7 +111,7 @@ public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) { return new ItemStack(this); } -@@ -690,6 +696,7 @@ +@@ -688,6 +694,7 @@ return Fluids.field_204541_a.func_207188_f(); } @@ -128,7 +119,7 @@ public float func_208618_m() { return this.field_149765_K; } -@@ -710,6 +717,7 @@ +@@ -716,6 +723,7 @@ public void func_176224_k(World p_176224_1_, BlockPos p_176224_2_) { } @@ -136,7 +127,7 @@ public boolean func_149659_a(Explosion p_149659_1_) { return true; } -@@ -754,6 +762,7 @@ +@@ -760,6 +768,7 @@ } } @@ -144,7 +135,7 @@ public SoundType func_220072_p(BlockState p_220072_1_) { return this.field_149762_H; } -@@ -763,7 +772,7 @@ +@@ -769,7 +778,7 @@ this.field_220086_i = Item.func_150898_a(this); } @@ -153,7 +144,7 @@ } public boolean func_208619_r() { -@@ -771,7 +780,7 @@ +@@ -777,13 +786,81 @@ } public String toString() { @@ -162,17 +153,7 @@ } @OnlyIn(Dist.CLIENT) -@@ -779,13 +788,81 @@ - } - - public static boolean func_196252_e(Block p_196252_0_) { -- return p_196252_0_ == Blocks.field_150348_b || p_196252_0_ == Blocks.field_196650_c || p_196252_0_ == Blocks.field_196654_e || p_196252_0_ == Blocks.field_196656_g; -+ return net.minecraftforge.common.Tags.Blocks.STONE.func_199685_a_(p_196252_0_); - } - - public static boolean func_196245_f(Block p_196245_0_) { -- return p_196245_0_ == Blocks.field_150346_d || p_196245_0_ == Blocks.field_196660_k || p_196245_0_ == Blocks.field_196661_l; -+ return net.minecraftforge.common.Tags.Blocks.DIRT.func_199685_a_(p_196245_0_); + public void func_190948_a(ItemStack p_190948_1_, @Nullable IBlockReader p_190948_2_, List p_190948_3_, ITooltipFlag p_190948_4_) { } + /* ======================================== FORGE START =====================================*/ @@ -217,10 +198,10 @@ + 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 || Block.func_196245_f(this) || this.getBlock() == Blocks.field_150458_ak; ++ 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 || Block.func_196245_f(this) || this.getBlock() == Blocks.field_150354_m; ++ 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 || @@ -246,9 +227,9 @@ public static enum OffsetType { NONE, XZ, -@@ -804,6 +881,9 @@ - private float field_200961_i = 0.6F; +@@ -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; @@ -256,16 +237,16 @@ private Properties(Material p_i48616_1_, MaterialColor p_i48616_2_) { this.field_200953_a = p_i48616_1_; -@@ -834,6 +914,8 @@ - block$properties.field_200956_d = p_200950_0_.field_149762_H; - block$properties.field_200961_i = p_200950_0_.func_208618_m(); +@@ -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; } -@@ -882,13 +964,23 @@ +@@ -901,13 +983,23 @@ return this; } diff --git a/patches/minecraft/net/minecraft/block/Blocks.java.patch b/patches/minecraft/net/minecraft/block/Blocks.java.patch index b4716e910..0b40aa831 100644 --- a/patches/minecraft/net/minecraft/block/Blocks.java.patch +++ b/patches/minecraft/net/minecraft/block/Blocks.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/block/Blocks.java +++ b/net/minecraft/block/Blocks.java -@@ -13,6 +13,7 @@ - import net.minecraft.potion.Effects; +@@ -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))); -@@ -104,7 +105,7 @@ - public static final Block field_196601_az = func_222382_a("green_bed", new BedBlock(DyeColor.GREEN, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F))); - public static final Block field_196550_aA = func_222382_a("red_bed", new BedBlock(DyeColor.RED, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F))); - public static final Block field_196551_aB = func_222382_a("black_bed", new BedBlock(DyeColor.BLACK, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F))); +@@ -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))); -@@ -694,16 +695,4 @@ +@@ -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_); } diff --git a/patches/minecraft/net/minecraft/block/BushBlock.java.patch b/patches/minecraft/net/minecraft/block/BushBlock.java.patch index fdd83e04c..81b00dcdd 100644 --- a/patches/minecraft/net/minecraft/block/BushBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/BushBlock.java.patch @@ -19,8 +19,8 @@ } @@ -33,4 +35,11 @@ - public boolean func_200123_i(BlockState p_200123_1_, IBlockReader p_200123_2_, BlockPos p_200123_3_) { - return true; + 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 diff --git a/patches/minecraft/net/minecraft/block/CactusBlock.java.patch b/patches/minecraft/net/minecraft/block/CactusBlock.java.patch index c4387245c..b38c7edc3 100644 --- a/patches/minecraft/net/minecraft/block/CactusBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/CactusBlock.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/block/CactusBlock.java +++ b/net/minecraft/block/CactusBlock.java @@ -19,7 +19,7 @@ - import net.minecraft.world.IWorldReader; import net.minecraft.world.World; + import net.minecraft.world.server.ServerWorld; -public class CactusBlock extends Block { +public class CactusBlock extends Block implements net.minecraftforge.common.IPlantable { @@ -12,30 +12,30 @@ @@ -30,6 +30,7 @@ } - public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { -+ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update - if (!p_196267_1_.func_196955_c(p_196267_2_, p_196267_3_)) { - p_196267_2_.func_175655_b(p_196267_3_, true); + 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_196267_1_.func_177229_b(field_176587_a); -+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, blockpos, p_196267_1_, true)) { + 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_196267_2_.func_175656_a(blockpos, this.func_176223_P()); - BlockState blockstate = p_196267_1_.func_206870_a(field_176587_a, Integer.valueOf(0)); + 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_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4); + 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_196267_2_, p_196267_3_, p_196267_1_); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); + } } } } -@@ -85,8 +88,8 @@ +@@ -81,8 +84,8 @@ } } @@ -46,7 +46,7 @@ } public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { -@@ -104,4 +107,14 @@ +@@ -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; } diff --git a/patches/minecraft/net/minecraft/block/CampfireBlock.java.patch b/patches/minecraft/net/minecraft/block/CampfireBlock.java.patch new file mode 100644 index 000000000..41b532400 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/CampfireBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/CampfireBlock.java ++++ b/net/minecraft/block/CampfireBlock.java +@@ -187,7 +187,7 @@ + boolean flag = p_220066_4_ instanceof AbstractFireballEntity || p_220066_4_ instanceof AbstractArrowEntity && p_220066_4_.func_70027_ad(); + if (flag) { + Entity entity = this.func_226913_a_(p_220066_4_); +- boolean flag1 = entity == null || entity instanceof PlayerEntity || p_220066_1_.func_82736_K().func_223586_b(GameRules.field_223599_b); ++ boolean flag1 = entity == null || entity instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_220066_1_, entity); + if (flag1 && !p_220066_2_.func_177229_b(field_220101_b) && !p_220066_2_.func_177229_b(field_220103_d)) { + BlockPos blockpos = p_220066_3_.func_216350_a(); + p_220066_1_.func_180501_a(blockpos, p_220066_2_.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true)), 11); diff --git a/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch b/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch index ea15121d2..c63573642 100644 --- a/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch @@ -1,36 +1,36 @@ --- a/net/minecraft/block/ChorusFlowerBlock.java +++ b/net/minecraft/block/ChorusFlowerBlock.java -@@ -30,9 +30,9 @@ - p_196267_2_.func_175655_b(p_196267_3_, true); +@@ -29,9 +29,9 @@ + p_225534_2_.func_175655_b(p_225534_3_, true); } else { - BlockPos blockpos = p_196267_3_.func_177984_a(); -- if (p_196267_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) { -+ if (p_196267_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < p_196267_2_.func_201675_m().getHeight()) { - int i = p_196267_1_.func_177229_b(field_185607_a); + 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_196267_2_, blockpos, p_196267_1_, true)) { ++ 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_196267_2_.func_180495_p(p_196267_3_.func_177977_b()); -@@ -57,7 +57,7 @@ - if (j < 2 || j <= p_196267_4_.nextInt(flag1 ? 5 : 4)) { + 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_196267_2_, p_196267_3_.func_177977_b())) { ++ } else if (blockstate.isAir(p_225534_2_, p_225534_3_.func_177977_b())) { flag = true; } -@@ -89,7 +89,7 @@ +@@ -88,7 +88,7 @@ } else { - this.func_185605_c(p_196267_2_, p_196267_3_); + this.func_185605_c(p_225534_2_, p_225534_3_); } - -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); } } } -@@ -127,7 +127,7 @@ +@@ -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) { @@ -39,7 +39,7 @@ return false; } else { boolean flag = false; -@@ -140,7 +140,7 @@ +@@ -139,7 +139,7 @@ } flag = true; diff --git a/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch b/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch index ca1e160aa..03ce2e6d2 100644 --- a/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch @@ -3,14 +3,14 @@ @@ -30,10 +30,11 @@ } - public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { -- if (p_196267_2_.field_73012_v.nextInt(5) == 0) { + public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { +- if (p_225534_2_.field_73012_v.nextInt(5) == 0) { + if (true) { - int i = p_196267_1_.func_177229_b(field_176501_a); + int i = p_225534_1_.func_177229_b(field_176501_a); - if (i < 2) { -+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_2_.field_73012_v.nextInt(5) == 0)) { - p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); ++ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_2_.field_73012_v.nextInt(5) == 0)) { + p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); } } diff --git a/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch b/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch index 95adf31b5..d22d6ae69 100644 --- a/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/ComparatorBlock.java +++ b/net/minecraft/block/ComparatorBlock.java -@@ -66,7 +66,7 @@ +@@ -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); @@ -9,7 +9,7 @@ ItemFrameEntity itemframeentity = this.func_176461_a(p_176397_1_, direction, blockpos); if (itemframeentity != null) { i = itemframeentity.func_174866_q(); -@@ -152,4 +152,16 @@ +@@ -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); } diff --git a/patches/minecraft/net/minecraft/block/CropsBlock.java.patch b/patches/minecraft/net/minecraft/block/CropsBlock.java.patch index ed34404f8..262ecdb0b 100644 --- a/patches/minecraft/net/minecraft/block/CropsBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/CropsBlock.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/block/CropsBlock.java +++ b/net/minecraft/block/CropsBlock.java -@@ -57,12 +57,14 @@ +@@ -58,12 +58,14 @@ - public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); -+ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_196267_2_.func_201669_a(p_196267_3_, 0) >= 9) { - int i = this.func_185527_x(p_196267_1_); + 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_196267_2_, p_196267_3_); -- if (p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0) { -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0)) { - p_196267_2_.func_180501_a(p_196267_3_, this.func_185528_e(i + 1), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); + 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_); } } } -@@ -91,9 +93,9 @@ +@@ -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)); @@ -28,12 +28,12 @@ f1 = 3.0F; } } -@@ -129,7 +131,7 @@ +@@ -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_175655_b(p_196262_3_, true); + p_196262_2_.func_225521_a_(p_196262_3_, true, p_196262_4_); } diff --git a/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch b/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch index 520675684..2ba96d58b 100644 --- a/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/DetectorRailBlock.java +++ b/net/minecraft/block/DetectorRailBlock.java -@@ -128,6 +128,8 @@ +@@ -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)) { diff --git a/patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch b/patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch index 2e943e574..17888d44b 100644 --- a/patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/EnchantingTableBlock.java +++ b/net/minecraft/block/EnchantingTableBlock.java -@@ -53,7 +53,7 @@ +@@ -54,7 +54,7 @@ if (p_180655_4_.nextInt(16) == 0) { for(int k = 0; k <= 1; ++k) { BlockPos blockpos = p_180655_3_.func_177982_a(i, k, j); diff --git a/patches/minecraft/net/minecraft/block/FallingBlock.java.patch b/patches/minecraft/net/minecraft/block/FallingBlock.java.patch index dcdd9f3f0..ddd32d0d6 100644 --- a/patches/minecraft/net/minecraft/block/FallingBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FallingBlock.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/block/FallingBlock.java +++ b/net/minecraft/block/FallingBlock.java -@@ -35,7 +35,7 @@ +@@ -29,7 +29,7 @@ } - private void func_176503_e(World p_176503_1_, BlockPos p_176503_2_) { -- if (func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0) { -+ if (p_176503_1_.func_175623_d(p_176503_2_.func_177977_b()) || func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0) { - if (!p_176503_1_.field_72995_K) { - FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_176503_1_, (double)p_176503_2_.func_177958_n() + 0.5D, (double)p_176503_2_.func_177956_o(), (double)p_176503_2_.func_177952_p() + 0.5D, p_176503_1_.func_180495_p(p_176503_2_)); - this.func_149829_a(fallingblockentity); -@@ -68,7 +68,7 @@ + public void func_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)((float)p_180655_3_.func_177958_n() + p_180655_4_.nextFloat()); + 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)((float)p_180655_3_.func_177952_p() + p_180655_4_.nextFloat()); + double d2 = (double)p_180655_3_.func_177952_p() + (double)p_180655_4_.nextFloat(); diff --git a/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch b/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch index 041353e43..63e203b01 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 -@@ -73,7 +73,7 @@ +@@ -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_) { @@ -9,7 +9,7 @@ func_199610_d(p_180658_1_.func_180495_p(p_180658_2_), p_180658_1_, p_180658_2_); } -@@ -84,9 +84,9 @@ +@@ -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_)); } @@ -22,7 +22,7 @@ } private static boolean func_176530_e(IWorldReader p_176530_0_, BlockPos p_176530_1_) { -@@ -96,7 +96,7 @@ +@@ -99,7 +99,7 @@ } } diff --git a/patches/minecraft/net/minecraft/block/FireBlock.java.patch b/patches/minecraft/net/minecraft/block/FireBlock.java.patch index accd9795b..36a041815 100644 --- a/patches/minecraft/net/minecraft/block/FireBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FireBlock.java.patch @@ -18,46 +18,46 @@ @@ -91,12 +91,14 @@ - public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - if (p_196267_2_.func_82736_K().func_223586_b(GameRules.field_223598_a)) { -+ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 2)) return; // Forge: prevent loading unloaded chunks when spreading fire - if (!p_196267_1_.func_196955_c(p_196267_2_, p_196267_3_)) { - p_196267_2_.func_217377_a(p_196267_3_, false); + 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); } - Block block = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_177230_c(); -- boolean flag = p_196267_2_.field_73011_w instanceof EndDimension && block == Blocks.field_150357_h || block == Blocks.field_150424_aL || block == Blocks.field_196814_hQ; -+ BlockState other = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()); -+ boolean flag = other.isFireSource(p_196267_2_, p_196267_3_.func_177977_b(), Direction.UP); - int i = p_196267_1_.func_177229_b(field_176543_a); - if (!flag && p_196267_2_.func_72896_J() && this.func_176537_d(p_196267_2_, p_196267_3_) && p_196267_4_.nextFloat() < 0.2F + (float)i * 0.03F) { - p_196267_2_.func_217377_a(p_196267_3_, false); + 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); + 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 @@ return; } -- if (i == 15 && p_196267_4_.nextInt(4) == 0 && !this.func_196446_i(p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()))) { -+ if (i == 15 && p_196267_4_.nextInt(4) == 0 && !this.canCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), Direction.UP)) { - p_196267_2_.func_217377_a(p_196267_3_, false); +- if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.func_196446_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()))) { ++ if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canCatchFire(p_225534_2_, p_225534_3_.func_177977_b(), Direction.UP)) { + p_225534_2_.func_217377_a(p_225534_3_, false); return; } @@ -126,12 +128,12 @@ - boolean flag1 = p_196267_2_.func_180502_D(p_196267_3_); + boolean flag1 = p_225534_2_.func_180502_D(p_225534_3_); int k = flag1 ? -50 : 0; -- this.func_176536_a(p_196267_2_, p_196267_3_.func_177974_f(), 300 + k, p_196267_4_, i); -- this.func_176536_a(p_196267_2_, p_196267_3_.func_177976_e(), 300 + k, p_196267_4_, i); -- this.func_176536_a(p_196267_2_, p_196267_3_.func_177977_b(), 250 + k, p_196267_4_, i); -- this.func_176536_a(p_196267_2_, p_196267_3_.func_177984_a(), 250 + k, p_196267_4_, i); -- this.func_176536_a(p_196267_2_, p_196267_3_.func_177978_c(), 300 + k, p_196267_4_, i); -- this.func_176536_a(p_196267_2_, p_196267_3_.func_177968_d(), 300 + k, p_196267_4_, i); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177974_f(), 300 + k, p_196267_4_, i, Direction.WEST); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177976_e(), 300 + k, p_196267_4_, i, Direction.EAST); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), 250 + k, p_196267_4_, i, Direction.UP); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177984_a(), 250 + k, p_196267_4_, i, Direction.DOWN); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177978_c(), 300 + k, p_196267_4_, i, Direction.SOUTH); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177968_d(), 300 + k, p_196267_4_, i, Direction.NORTH); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); +- this.func_176536_a(p_225534_2_, p_225534_3_.func_177974_f(), 300 + k, p_225534_4_, i); +- this.func_176536_a(p_225534_2_, p_225534_3_.func_177976_e(), 300 + k, p_225534_4_, i); +- this.func_176536_a(p_225534_2_, p_225534_3_.func_177977_b(), 250 + k, p_225534_4_, i); +- this.func_176536_a(p_225534_2_, p_225534_3_.func_177984_a(), 250 + k, p_225534_4_, i); +- this.func_176536_a(p_225534_2_, p_225534_3_.func_177978_c(), 300 + k, p_225534_4_, i); +- this.func_176536_a(p_225534_2_, p_225534_3_.func_177968_d(), 300 + k, p_225534_4_, i); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177974_f(), 300 + k, p_225534_4_, i, Direction.WEST); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177976_e(), 300 + k, p_225534_4_, i, Direction.EAST); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177977_b(), 250 + k, p_225534_4_, i, Direction.UP); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177984_a(), 250 + k, p_225534_4_, i, Direction.DOWN); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177978_c(), 300 + k, p_225534_4_, i, Direction.SOUTH); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177968_d(), 300 + k, p_225534_4_, i, Direction.NORTH); + BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(); for(int l = -1; l <= 1; ++l) { @@ -169,16 +171,18 @@ @@ -167,7 +167,7 @@ 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; -@@ -311,10 +312,23 @@ +@@ -307,10 +308,23 @@ } public void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) { diff --git a/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch b/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch index 845d37032..f3274952f 100644 --- a/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch @@ -19,7 +19,7 @@ + /** + * For mod use, eliminates the need to extend this class, and prevents modded + * flower pots from altering vanilla behavior. -+ * ++ * + * @param emptyPot The empty pot for this pot, or null for self. + * @param p_i48395_1_ The flower block. + * @param p_i48395_2_ @@ -41,8 +41,8 @@ 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 @@ - public boolean func_220051_a(BlockState p_220051_1_, World p_220051_2_, BlockPos p_220051_3_, PlayerEntity p_220051_4_, Hand p_220051_5_, BlockRayTraceResult p_220051_6_) { - ItemStack itemstack = p_220051_4_.func_184586_b(p_220051_5_); + 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(); - Block block = item instanceof BlockItem ? field_196451_b.getOrDefault(((BlockItem)item).func_179223_d(), Blocks.field_150350_a) : Blocks.field_150350_a; + Block block = item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(((BlockItem)item).func_179223_d().getRegistryName(), Blocks.field_150350_a.delegate).get() : Blocks.field_150350_a; @@ -50,26 +50,26 @@ boolean flag1 = this.field_196452_c == Blocks.field_150350_a; if (flag != flag1) { @@ -58,7 +85,7 @@ - p_220051_4_.func_71019_a(itemstack1, false); + p_225533_4_.func_71019_a(itemstack1, false); } -- p_220051_2_.func_180501_a(p_220051_3_, Blocks.field_150457_bL.func_176223_P(), 3); -+ p_220051_2_.func_180501_a(p_220051_3_, getEmptyPot().func_176223_P(), 3); +- p_225533_2_.func_180501_a(p_225533_3_, Blocks.field_150457_bL.func_176223_P(), 3); ++ p_225533_2_.func_180501_a(p_225533_3_, getEmptyPot().func_176223_P(), 3); } - } -@@ -78,6 +105,17 @@ + return ActionResultType.SUCCESS; +@@ -76,6 +103,17 @@ } public Block func_220276_d() { - return this.field_196452_c; + return flowerDelegate.get(); } -+ ++ + public FlowerPotBlock getEmptyPot() { + 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); diff --git a/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch b/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch index 20b6fc3b6..4b42092df 100644 --- a/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/FlowingFluidBlock.java +++ b/net/minecraft/block/FlowingFluidBlock.java -@@ -30,9 +30,11 @@ +@@ -31,9 +31,11 @@ public class FlowingFluidBlock extends Block implements IBucketPickupHandler { public static final IntegerProperty field_176367_b = BlockStateProperties.field_208132_ag; @@ -13,7 +13,7 @@ protected FlowingFluidBlock(FlowingFluid p_i49014_1_, Block.Properties p_i49014_2_) { super(p_i49014_2_); this.field_204517_c = p_i49014_1_; -@@ -45,8 +47,21 @@ +@@ -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))); @@ -32,10 +32,10 @@ + this.supplier = supplier; + } + - public void func_196265_a(BlockState p_196265_1_, World p_196265_2_, BlockPos p_196265_3_, Random p_196265_4_) { - p_196265_2_.func_204610_c(p_196265_3_).func_206891_b(p_196265_2_, p_196265_3_, p_196265_4_); + 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_); } -@@ -61,6 +76,7 @@ +@@ -62,6 +77,7 @@ public IFluidState func_204507_t(BlockState p_204507_1_) { int i = p_204507_1_.func_177229_b(field_176367_b); @@ -43,7 +43,7 @@ return this.field_212565_c.get(Math.min(i, 8)); } -@@ -121,13 +137,13 @@ +@@ -122,13 +138,13 @@ if (flag) { IFluidState ifluidstate = p_204515_1_.func_204610_c(p_204515_2_); if (ifluidstate.func_206889_d()) { @@ -59,7 +59,7 @@ this.func_180688_d(p_204515_1_, p_204515_2_); return false; } -@@ -160,4 +176,27 @@ +@@ -161,4 +177,23 @@ } } @@ -72,17 +72,13 @@ + + private boolean fluidStateCacheInitialized = false; + protected synchronized void initFluidStateCache() { -+ if (fluidStateCacheInitialized == false) -+ { ++ 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/minecraft/net/minecraft/block/JigsawBlock.java.patch b/patches/minecraft/net/minecraft/block/JigsawBlock.java.patch index 986f0f1d3..d0c8cecd7 100644 --- a/patches/minecraft/net/minecraft/block/JigsawBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/JigsawBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/JigsawBlock.java +++ b/net/minecraft/block/JigsawBlock.java -@@ -29,6 +29,13 @@ +@@ -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))); } diff --git a/patches/minecraft/net/minecraft/block/KelpTopBlock.java.patch b/patches/minecraft/net/minecraft/block/KelpTopBlock.java.patch index 6698b2f24..817d73ccd 100644 --- a/patches/minecraft/net/minecraft/block/KelpTopBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/KelpTopBlock.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/block/KelpTopBlock.java +++ b/net/minecraft/block/KelpTopBlock.java -@@ -57,8 +57,9 @@ +@@ -52,8 +52,9 @@ } else { - BlockPos blockpos = p_196267_3_.func_177984_a(); - BlockState blockstate = p_196267_2_.func_180495_p(blockpos); -- if (blockstate.func_177230_c() == Blocks.field_150355_j && p_196267_1_.func_177229_b(field_203163_a) < 25 && p_196267_4_.nextDouble() < 0.14D) { -+ if (blockstate.func_177230_c() == Blocks.field_150355_j && p_196267_1_.func_177229_b(field_203163_a) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, blockpos, p_196267_1_, p_196267_4_.nextDouble() < 0.14D)) { - p_196267_2_.func_175656_a(blockpos, p_196267_1_.func_177231_a(field_203163_a)); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); + BlockPos blockpos = p_225534_3_.func_177984_a(); + BlockState blockstate = p_225534_2_.func_180495_p(blockpos); +- if (blockstate.func_177230_c() == Blocks.field_150355_j && p_225534_1_.func_177229_b(field_203163_a) < 25 && p_225534_4_.nextDouble() < 0.14D) { ++ if (blockstate.func_177230_c() == Blocks.field_150355_j && p_225534_1_.func_177229_b(field_203163_a) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, blockpos, p_225534_1_, p_225534_4_.nextDouble() < 0.14D)) { + p_225534_2_.func_175656_a(blockpos, p_225534_1_.func_177231_a(field_203163_a)); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, blockpos, p_225534_1_); } } diff --git a/patches/minecraft/net/minecraft/block/LadderBlock.java.patch b/patches/minecraft/net/minecraft/block/LadderBlock.java.patch index 2c5165c7b..452bc5551 100644 --- a/patches/minecraft/net/minecraft/block/LadderBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/LadderBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/LadderBlock.java +++ b/net/minecraft/block/LadderBlock.java -@@ -94,6 +94,11 @@ +@@ -93,6 +93,11 @@ return null; } @@ -9,6 +9,6 @@ + return true; + } + - public BlockRenderLayer func_180664_k() { - return BlockRenderLayer.CUTOUT; + 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/minecraft/net/minecraft/block/LeavesBlock.java.patch b/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch index 70bfb160f..2c446e407 100644 --- a/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch @@ -8,4 +8,4 @@ +public class LeavesBlock extends Block implements net.minecraftforge.common.IShearable { public static final IntegerProperty field_208494_a = BlockStateProperties.field_208514_aa; public static final BooleanProperty field_208495_b = BlockStateProperties.field_208515_s; - protected static boolean field_196478_c; + diff --git a/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch b/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch index 886dca7a6..b85d7d040 100644 --- a/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/block/MushroomBlock.java +++ b/net/minecraft/block/MushroomBlock.java -@@ -62,7 +62,7 @@ +@@ -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_201669_a(p_196260_3_, 0) < 13 && this.func_200014_a_(blockstate, p_196260_2_, blockpos); -+ return p_196260_2_.func_201669_a(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this); +- 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/minecraft/net/minecraft/block/NetherWartBlock.java.patch b/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch index a430849ca..5b4e5f7a0 100644 --- a/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/block/NetherWartBlock.java @@ -31,9 +31,10 @@ - public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - int i = p_196267_1_.func_177229_b(field_176486_a); -- if (i < 3 && p_196267_4_.nextInt(10) == 0) { -+ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt(10) == 0)) { - p_196267_1_ = p_196267_1_.func_206870_a(field_176486_a, Integer.valueOf(i + 1)); - p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_, 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); + 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_); } - super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); + 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 af0f3f251..f3c839ade 100644 --- a/patches/minecraft/net/minecraft/block/NoteBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/NoteBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/NoteBlock.java +++ b/net/minecraft/block/NoteBlock.java -@@ -49,7 +49,7 @@ +@@ -50,7 +50,7 @@ } private void func_196482_a(World p_196482_1_, BlockPos p_196482_2_) { @@ -9,18 +9,17 @@ p_196482_1_.func_175641_c(p_196482_2_, this, 0, 0); } -@@ -59,7 +59,9 @@ - if (p_220051_2_.field_72995_K) { - return true; +@@ -60,6 +60,9 @@ + if (p_225533_2_.field_72995_K) { + return ActionResultType.SUCCESS; } else { -- p_220051_1_ = p_220051_1_.func_177231_a(field_196485_c); -+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_220051_2_, p_220051_3_, p_220051_1_, p_220051_1_.func_177229_b(field_196485_c), p_220051_1_.func_177231_a(field_196485_c).func_177229_b(field_196485_c)); -+ if (_new == -1) return false; -+ p_220051_1_ = (BlockState)p_220051_1_.func_206870_a(field_196485_c, _new); - p_220051_2_.func_180501_a(p_220051_3_, p_220051_1_, 3); - this.func_196482_a(p_220051_2_, p_220051_3_); - p_220051_4_.func_195066_a(Stats.field_188087_U); -@@ -75,6 +77,9 @@ ++ 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_1_ = p_225533_1_.func_177231_a(field_196485_c); + p_225533_2_.func_180501_a(p_225533_3_, p_225533_1_, 3); + this.func_196482_a(p_225533_2_, p_225533_3_); +@@ -76,6 +79,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/PistonBlock.java.patch b/patches/minecraft/net/minecraft/block/PistonBlock.java.patch index a311ebd1e..b77708e32 100644 --- a/patches/minecraft/net/minecraft/block/PistonBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/PistonBlock.java.patch @@ -4,7 +4,7 @@ } if (p_189539_4_ == 0) { -+ if(net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, true)) return false; ++ if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, true)) return false; if (!this.func_176319_a(p_189539_2_, p_189539_3_, direction, true)) { return false; } @@ -12,7 +12,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) { -+ if(net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, false)) return false; ++ if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, false)) return false; TileEntity tileentity1 = p_189539_2_.func_175625_s(p_189539_3_.func_177972_a(direction)); if (tileentity1 instanceof PistonTileEntity) { ((PistonTileEntity)tileentity1).func_145866_f(); @@ -42,16 +42,16 @@ } else { return false; } -@@ -274,7 +277,7 @@ +@@ -276,7 +279,7 @@ for(int j = list2.size() - 1; j >= 0; --j) { BlockPos blockpos2 = list2.get(j); - BlockState blockstate = p_176319_1_.func_180495_p(blockpos2); -- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? p_176319_1_.func_175625_s(blockpos2) : null; -+ TileEntity tileentity = blockstate.hasTileEntity() ? p_176319_1_.func_175625_s(blockpos2) : null; - func_220059_a(blockstate, p_176319_1_, blockpos2, tileentity); + 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; -@@ -328,6 +331,10 @@ +@@ -340,6 +343,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/PistonBlockStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/PistonBlockStructureHelper.java.patch new file mode 100644 index 000000000..97e05a576 --- /dev/null +++ b/patches/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/minecraft/net/minecraft/block/RailState.java.patch b/patches/minecraft/net/minecraft/block/RailState.java.patch index ef79476c7..59bee3cd9 100644 --- a/patches/minecraft/net/minecraft/block/RailState.java.patch +++ b/patches/minecraft/net/minecraft/block/RailState.java.patch @@ -37,7 +37,7 @@ if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) { railshape = RailShape.ASCENDING_EAST; } -@@ -298,7 +300,7 @@ +@@ -304,7 +306,7 @@ } } @@ -46,7 +46,7 @@ if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) { railshape = RailShape.ASCENDING_NORTH; } -@@ -308,7 +310,7 @@ +@@ -314,7 +316,7 @@ } } diff --git a/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch b/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch index b714ccf60..71c810df0 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 -@@ -61,11 +61,11 @@ +@@ -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_); diff --git a/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch b/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch index 34ec125c2..0bfd181fb 100644 --- a/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/RedstoneWireBlock.java +++ b/net/minecraft/block/RedstoneWireBlock.java -@@ -124,7 +124,7 @@ +@@ -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; @@ -9,7 +9,7 @@ if (blockstate.func_224756_o(p_208074_1_, blockpos)) { return RedstoneSide.UP; } -@@ -133,7 +133,7 @@ +@@ -132,7 +132,7 @@ } } @@ -18,7 +18,7 @@ } public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { -@@ -318,26 +318,18 @@ +@@ -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); @@ -49,7 +49,7 @@ Block block = p_176343_0_.func_177230_c(); if (block == Blocks.field_150488_af) { return true; -@@ -347,7 +339,7 @@ +@@ -344,7 +336,7 @@ } else if (Blocks.field_190976_dk == p_176343_0_.func_177230_c()) { return p_176343_1_ == p_176343_0_.func_177229_b(ObserverBlock.field_176387_N); } else { diff --git a/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch b/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch index 3f94dedfe..cc072f5e5 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_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); -+ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_196267_2_.func_201696_r(p_196267_3_.func_177984_a()) >= 9 && p_196267_4_.nextInt(7) == 0) { - this.func_176478_d(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_); + 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_176478_3_.func_177229_b(field_176479_b) == 0) { - p_176478_1_.func_180501_a(p_176478_2_, p_176478_3_.func_177231_a(field_176479_b), 4); + 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_176478_1_, p_176478_4_, p_176478_2_)) return; - this.field_196387_c.func_196935_a(p_176478_1_, p_176478_2_, p_176478_3_, p_176478_4_); ++ 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/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch b/patches/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch index 66374e498..a13c597eb 100644 --- a/patches/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/ScaffoldingBlock.java +++ b/net/minecraft/block/ScaffoldingBlock.java -@@ -142,6 +142,8 @@ +@@ -138,6 +138,8 @@ return i; } diff --git a/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch b/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch index c1a37307d..9e15b84f7 100644 --- a/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/block/SeaGrassBlock.java +++ b/net/minecraft/block/SeaGrassBlock.java -@@ -16,7 +16,7 @@ - import net.minecraft.world.IWorld; +@@ -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 { diff --git a/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch b/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch index fbd7a5184..646638993 100644 --- a/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/SpawnerBlock.java +++ b/net/minecraft/block/SpawnerBlock.java -@@ -19,10 +19,13 @@ +@@ -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_); diff --git a/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch b/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch index eb850d338..d46dc4046 100644 --- a/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/block/SpreadableSnowyDirtBlock.java @@ -31,6 +31,7 @@ - public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - if (!p_196267_2_.field_72995_K) { -+ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading - if (!func_220257_b(p_196267_1_, p_196267_2_, p_196267_3_)) { - p_196267_2_.func_175656_a(p_196267_3_, Blocks.field_150346_d.func_176223_P()); - } else { + 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/minecraft/net/minecraft/block/StairsBlock.java.patch b/patches/minecraft/net/minecraft/block/StairsBlock.java.patch index f47f3d6e7..5c51b0cc0 100644 --- a/patches/minecraft/net/minecraft/block/StairsBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/StairsBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/StairsBlock.java +++ b/net/minecraft/block/StairsBlock.java -@@ -83,13 +83,24 @@ +@@ -84,13 +84,24 @@ return voxelshape; } @@ -25,7 +25,7 @@ public boolean func_220074_n(BlockState p_220074_1_) { return true; } -@@ -265,4 +276,12 @@ +@@ -262,4 +273,12 @@ 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/StemBlock.java.patch b/patches/minecraft/net/minecraft/block/StemBlock.java.patch index 8100b9777..dd697331f 100644 --- a/patches/minecraft/net/minecraft/block/StemBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/StemBlock.java.patch @@ -1,40 +1,40 @@ --- a/net/minecraft/block/StemBlock.java +++ b/net/minecraft/block/StemBlock.java -@@ -39,22 +39,24 @@ +@@ -40,22 +40,24 @@ - public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); -+ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_196267_2_.func_201669_a(p_196267_3_, 0) >= 9) { - float f = CropsBlock.func_180672_a(this, p_196267_2_, p_196267_3_); -- if (p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0) { -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0)) { - int i = p_196267_1_.func_177229_b(field_176484_a); + 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); if (i < 7) { -- p_196267_1_ = p_196267_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)); -- p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_, 2); -+ p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)), 2); +- 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); } else { - Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_196267_4_); - BlockPos blockpos = p_196267_3_.func_177972_a(direction); -- Block block = p_196267_2_.func_180495_p(blockpos.func_177977_b()).func_177230_c(); -- if (p_196267_2_.func_180495_p(blockpos).func_196958_f() && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) { -+ BlockState soil = p_196267_2_.func_180495_p(blockpos.func_177977_b()); + 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_196267_2_.func_180495_p(blockpos).isAir(p_196267_2_, blockpos) && (soil.canSustainPlant(p_196267_2_, blockpos.func_177977_b(), Direction.UP, this) || block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) { - p_196267_2_.func_175656_a(blockpos, this.field_149877_a.func_176223_P()); - p_196267_2_.func_175656_a(p_196267_3_, this.field_149877_a.func_196523_e().func_176223_P().func_206870_a(HorizontalBlock.field_185512_D, direction)); ++ 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)); } } -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); } } -@@ -100,4 +102,10 @@ +@@ -101,4 +103,10 @@ public StemGrownBlock func_208486_d() { return this.field_149877_a; } -+ ++ + //FORGE START + @Override + public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) { diff --git a/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch b/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch index 6db99d042..cd26ff88d 100644 --- a/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch @@ -1,31 +1,31 @@ --- a/net/minecraft/block/SugarCaneBlock.java +++ b/net/minecraft/block/SugarCaneBlock.java -@@ -16,7 +16,7 @@ +@@ -15,7 +15,7 @@ import net.minecraft.world.IWorldReader; - import net.minecraft.world.World; + 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); -@@ -40,12 +40,15 @@ +@@ -39,12 +39,15 @@ if (i < 3) { - int j = p_196267_1_.func_177229_b(field_176355_a); -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, true)) { + 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_196267_2_.func_175656_a(p_196267_3_.func_177984_a(), this.func_176223_P()); - p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176355_a, Integer.valueOf(0)), 4); + 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_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176355_a, Integer.valueOf(j + 1)), 4); + 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_196267_2_, p_196267_3_, p_196267_1_); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); + } } } -@@ -60,6 +63,8 @@ +@@ -59,6 +62,8 @@ } public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { @@ -34,7 +34,7 @@ Block block = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_177230_c(); if (block == this) { return true; -@@ -87,4 +92,14 @@ +@@ -82,4 +87,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/SweetBerryBushBlock.java.patch b/patches/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch index 087d46583..78f5c8986 100644 --- a/patches/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/block/SweetBerryBushBlock.java +++ b/net/minecraft/block/SweetBerryBushBlock.java -@@ -47,8 +47,9 @@ - public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); - int i = p_196267_1_.func_177229_b(field_220125_a); -- if (i < 3 && p_196267_4_.nextInt(5) == 0 && p_196267_2_.func_201669_a(p_196267_3_.func_177984_a(), 0) >= 9) { -+ if (i < 3 && p_196267_2_.func_201669_a(p_196267_3_.func_177984_a(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt(5) == 0)) { - p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_220125_a, Integer.valueOf(i + 1)), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); +@@ -49,8 +49,9 @@ + 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_); + int i = p_225534_1_.func_177229_b(field_220125_a); +- if (i < 3 && p_225534_4_.nextInt(5) == 0 && p_225534_2_.func_226659_b_(p_225534_3_.func_177984_a(), 0) >= 9) { ++ if (i < 3 && p_225534_2_.func_226659_b_(p_225534_3_.func_177984_a(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_4_.nextInt(5) == 0)) { + p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_220125_a, Integer.valueOf(i + 1)), 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_); } } diff --git a/patches/minecraft/net/minecraft/block/TNTBlock.java.patch b/patches/minecraft/net/minecraft/block/TNTBlock.java.patch index 9a263980b..96361ce46 100644 --- a/patches/minecraft/net/minecraft/block/TNTBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TNTBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/TNTBlock.java +++ b/net/minecraft/block/TNTBlock.java -@@ -28,10 +28,14 @@ +@@ -29,10 +29,14 @@ this.func_180632_j(this.func_176223_P().func_206870_a(field_212569_a, Boolean.valueOf(false))); } @@ -16,7 +16,7 @@ p_220082_2_.func_217377_a(p_220082_3_, false); } -@@ -40,7 +44,7 @@ +@@ -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_)) { @@ -25,7 +25,7 @@ p_220069_2_.func_217377_a(p_220069_3_, false); } -@@ -48,7 +52,7 @@ +@@ -49,7 +53,7 @@ public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_) { if (!p_176208_1_.func_201670_d() && !p_176208_4_.func_184812_l_() && p_176208_3_.func_177229_b(field_212569_a)) { @@ -34,7 +34,7 @@ } super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_); -@@ -62,10 +66,12 @@ +@@ -63,10 +67,12 @@ } } @@ -46,17 +46,17 @@ + @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)((float)p_196535_1_.func_177958_n() + 0.5F), (double)p_196535_1_.func_177956_o(), (double)((float)p_196535_1_.func_177952_p() + 0.5F), p_196535_2_); -@@ -80,7 +86,7 @@ + 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_220051_a(p_220051_1_, p_220051_2_, p_220051_3_, p_220051_4_, p_220051_5_, p_220051_6_); + 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_220051_2_, p_220051_3_, p_220051_4_); -+ catchFire(p_220051_1_, p_220051_2_, p_220051_3_, p_220051_6_.func_216354_b(), p_220051_4_); - p_220051_2_.func_180501_a(p_220051_3_, Blocks.field_150350_a.func_176223_P(), 11); - if (item == Items.field_151033_d) { - itemstack.func_222118_a(1, p_220051_4_, (p_220287_1_) -> { -@@ -100,7 +106,7 @@ +- 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(); diff --git a/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch b/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch index 1616bfae7..9349ebe64 100644 --- a/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/block/TallGrassBlock.java +++ b/net/minecraft/block/TallGrassBlock.java -@@ -7,7 +7,7 @@ - import net.minecraft.world.IBlockReader; +@@ -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 { diff --git a/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch b/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch index 69106a3e3..2c26a8d20 100644 --- a/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/TrapDoorBlock.java +++ b/net/minecraft/block/TrapDoorBlock.java -@@ -153,6 +153,16 @@ +@@ -149,6 +149,16 @@ return super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_); } diff --git a/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch b/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch index 997a6c3f2..b3baed68a 100644 --- a/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/TurtleEggBlock.java +++ b/net/minecraft/block/TurtleEggBlock.java -@@ -146,7 +146,7 @@ +@@ -141,7 +141,7 @@ if (p_212570_2_ instanceof TurtleEntity) { return false; } else { diff --git a/patches/minecraft/net/minecraft/block/VineBlock.java.patch b/patches/minecraft/net/minecraft/block/VineBlock.java.patch index 645813757..28f301906 100644 --- a/patches/minecraft/net/minecraft/block/VineBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/VineBlock.java.patch @@ -1,24 +1,43 @@ --- a/net/minecraft/block/VineBlock.java +++ b/net/minecraft/block/VineBlock.java -@@ -20,7 +20,7 @@ +@@ -19,7 +19,7 @@ import net.minecraft.world.IWorldReader; - import net.minecraft.world.World; + import net.minecraft.world.server.ServerWorld; -public class VineBlock extends Block { +public class VineBlock extends Block implements net.minecraftforge.common.IShearable { public static final BooleanProperty field_176277_a = SixWayBlock.field_196496_z; public static final BooleanProperty field_176273_b = SixWayBlock.field_196488_a; public static final BooleanProperty field_176278_M = SixWayBlock.field_196490_b; -@@ -154,7 +154,7 @@ - p_196267_2_.func_217377_a(p_196267_3_, false); - } +@@ -152,14 +152,14 @@ + p_225534_2_.func_217377_a(p_225534_3_, false); + } -- } else if (p_196267_2_.field_73012_v.nextInt(4) == 0) { -+ } else if (p_196267_2_.field_73012_v.nextInt(4) == 0 && p_196267_2_.isAreaLoaded(p_196267_3_, 4)) { // Forge: check area to prevent loading unloaded chunks - Direction direction = Direction.func_176741_a(p_196267_4_); - BlockPos blockpos = p_196267_3_.func_177984_a(); - if (direction.func_176740_k().func_176722_c() && !p_196267_1_.func_177229_b(func_176267_a(direction))) { -@@ -329,4 +329,6 @@ +- } 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)) { + 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 @@ public static BooleanProperty func_176267_a(Direction p_176267_0_) { return field_196546_A.get(p_176267_0_); } diff --git a/patches/minecraft/net/minecraft/block/WebBlock.java.patch b/patches/minecraft/net/minecraft/block/WebBlock.java.patch index 0d8f985c9..49f30cc9e 100644 --- a/patches/minecraft/net/minecraft/block/WebBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/WebBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/block/WebBlock.java +++ b/net/minecraft/block/WebBlock.java -@@ -6,7 +6,7 @@ +@@ -5,7 +5,7 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; diff --git a/patches/minecraft/net/minecraft/block/state/PistonBlockStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/PistonBlockStructureHelper.java.patch deleted file mode 100644 index db48d38bb..000000000 --- a/patches/minecraft/net/minecraft/block/state/PistonBlockStructureHelper.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/net/minecraft/block/state/PistonBlockStructureHelper.java -+++ b/net/minecraft/block/state/PistonBlockStructureHelper.java -@@ -52,7 +52,7 @@ - } else { - for(int i = 0; i < this.field_177258_e.size(); ++i) { - BlockPos blockpos = this.field_177258_e.get(i); -- if (this.field_177261_a.func_180495_p(blockpos).func_177230_c() == Blocks.field_180399_cE && !this.func_177250_b(blockpos)) { -+ if (this.field_177261_a.func_180495_p(blockpos).isStickyBlock() && !this.func_177250_b(blockpos)) { - return false; - } - } -@@ -63,8 +63,7 @@ - - private boolean func_177251_a(BlockPos p_177251_1_, Direction p_177251_2_) { - BlockState blockstate = this.field_177261_a.func_180495_p(p_177251_1_); -- Block block = blockstate.func_177230_c(); -- if (blockstate.func_196958_f()) { -+ if (field_177261_a.func_175623_d(p_177251_1_)) { - return true; - } else if (!PistonBlock.func_185646_a(blockstate, this.field_177261_a, p_177251_1_, this.field_177257_d, false, p_177251_2_)) { - return true; -@@ -77,11 +76,10 @@ - if (i + this.field_177258_e.size() > 12) { - return false; - } else { -- while(block == Blocks.field_180399_cE) { -+ while(blockstate.isStickyBlock()) { - BlockPos blockpos = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i); - blockstate = this.field_177261_a.func_180495_p(blockpos); -- block = blockstate.func_177230_c(); -- if (blockstate.func_196958_f() || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) { -+ if (blockstate.isAir(this.field_177261_a, blockpos) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) { - break; - } - -@@ -108,7 +106,7 @@ - - for(int l = 0; l <= k + i1; ++l) { - BlockPos blockpos2 = this.field_177258_e.get(l); -- if (this.field_177261_a.func_180495_p(blockpos2).func_177230_c() == Blocks.field_180399_cE && !this.func_177250_b(blockpos2)) { -+ if (this.field_177261_a.func_180495_p(blockpos2).isStickyBlock() && !this.func_177250_b(blockpos2)) { - return false; - } - } -@@ -117,7 +115,7 @@ - } - - blockstate = this.field_177261_a.func_180495_p(blockpos1); -- if (blockstate.func_196958_f()) { -+ if (blockstate.isAir(field_177261_a, blockpos1)) { - return true; - } - diff --git a/patches/minecraft/net/minecraft/block/trees/JungleTree.java.patch b/patches/minecraft/net/minecraft/block/trees/JungleTree.java.patch index 0350e68c2..ca8b9a265 100644 --- a/patches/minecraft/net/minecraft/block/trees/JungleTree.java.patch +++ b/patches/minecraft/net/minecraft/block/trees/JungleTree.java.patch @@ -1,16 +1,11 @@ --- a/net/minecraft/block/trees/JungleTree.java +++ b/net/minecraft/block/trees/JungleTree.java -@@ -11,11 +11,11 @@ +@@ -12,7 +12,7 @@ public class JungleTree extends BigTree { @Nullable - protected AbstractTreeFeature func_196936_b(Random p_196936_1_) { -- return new TreeFeature(NoFeatureConfig::func_214639_a, true, 4 + p_196936_1_.nextInt(7), Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P(), false); -+ return new TreeFeature(NoFeatureConfig::func_214639_a, true, 4 + p_196936_1_.nextInt(7), Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P(), false).setSapling((net.minecraft.block.SaplingBlock)Blocks.field_196678_w); + protected ConfiguredFeature func_225546_b_(Random p_225546_1_) { +- return (new TreeFeature(TreeFeatureConfig::func_227338_a_)).func_225566_b_(DefaultBiomeFeatures.field_226808_c_); ++ return (new TreeFeature(TreeFeatureConfig::deserializeJungle)).func_225566_b_(DefaultBiomeFeatures.field_226808_c_); } @Nullable - protected AbstractTreeFeature func_196938_a(Random p_196938_1_) { -- return new MegaJungleFeature(NoFeatureConfig::func_214639_a, true, 10, 20, Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P()); -+ return new MegaJungleFeature(NoFeatureConfig::func_214639_a, true, 10, 20, Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P()).setSapling((net.minecraft.block.SaplingBlock)Blocks.field_196678_w); - } - } diff --git a/patches/minecraft/net/minecraft/client/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/GameSettings.java.patch index 0e9a3ce7d..78a1cb28d 100644 --- a/patches/minecraft/net/minecraft/client/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/GameSettings.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/client/GameSettings.java +++ b/net/minecraft/client/GameSettings.java -@@ -143,7 +143,7 @@ - public final KeyBinding[] field_151456_ac = new KeyBinding[]{new KeyBinding("key.hotbar.1", 49, "key.categories.inventory"), new KeyBinding("key.hotbar.2", 50, "key.categories.inventory"), new KeyBinding("key.hotbar.3", 51, "key.categories.inventory"), new KeyBinding("key.hotbar.4", 52, "key.categories.inventory"), new KeyBinding("key.hotbar.5", 53, "key.categories.inventory"), new KeyBinding("key.hotbar.6", 54, "key.categories.inventory"), new KeyBinding("key.hotbar.7", 55, "key.categories.inventory"), new KeyBinding("key.hotbar.8", 56, "key.categories.inventory"), new KeyBinding("key.hotbar.9", 57, "key.categories.inventory")}; - public final KeyBinding field_193629_ap = new KeyBinding("key.saveToolbarActivator", 67, "key.categories.creative"); - public final KeyBinding field_193630_aq = new KeyBinding("key.loadToolbarActivator", 88, "key.categories.creative"); -- public final KeyBinding[] field_74324_K = ArrayUtils.addAll(new KeyBinding[]{this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X, this.field_193629_ap, this.field_193630_aq, this.field_194146_ao}, this.field_151456_ac); -+ public KeyBinding[] field_74324_K = ArrayUtils.addAll(new KeyBinding[]{this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X, this.field_193629_ap, this.field_193630_aq, this.field_194146_ao}, this.field_151456_ac); - protected Minecraft field_74317_L; - private final File field_74354_ai; - public Difficulty field_74318_M = Difficulty.NORMAL; -@@ -162,6 +162,7 @@ +@@ -170,6 +170,7 @@ public String field_74363_ab = "en_us"; public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) { @@ -17,20 +8,20 @@ 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) { -@@ -467,7 +468,11 @@ +@@ -485,7 +486,11 @@ for(KeyBinding keybinding : this.field_74324_K) { - if (s1.equals("key_" + keybinding.func_151464_g())) { -- keybinding.func_197979_b(InputMappings.func_197955_a(s2)); -+ if (s2.indexOf(':') != -1) { -+ String[] pts = s2.split(":"); + if (s.equals("key_" + keybinding.func_151464_g())) { +- keybinding.func_197979_b(InputMappings.func_197955_a(s1)); ++ if (s.indexOf(':') != -1) { ++ String[] pts = s.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(s2)); ++ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputMappings.func_197955_a(s)); } } -@@ -515,6 +520,7 @@ +@@ -533,6 +538,7 @@ } public void func_74303_b() { @@ -38,7 +29,7 @@ try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.field_74354_ai), StandardCharsets.UTF_8))) { printwriter.println("version:" + SharedConstants.func_215069_a().getWorldVersion()); printwriter.println("autoJump:" + AbstractOption.field_216719_z.func_216741_b(this)); -@@ -589,7 +595,7 @@ +@@ -609,7 +615,7 @@ printwriter.println("glDebugVerbosity:" + this.field_209231_W); for(KeyBinding keybinding : this.field_74324_K) { @@ -47,7 +38,7 @@ } for(SoundCategory soundcategory : SoundCategory.values()) { -@@ -686,6 +692,25 @@ +@@ -706,6 +712,25 @@ } } @@ -62,7 +53,7 @@ + field_74368_y.setKeyConflictContext(inGame); + field_74366_z.setKeyConflictContext(inGame); + field_74314_A.setKeyConflictContext(inGame); -+ field_74311_E.setKeyConflictContext(inGame); ++ field_228046_af_.setKeyConflictContext(inGame); + field_151444_V.setKeyConflictContext(inGame); + field_74312_F.setKeyConflictContext(inGame); + field_74310_D.setKeyConflictContext(inGame); diff --git a/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch b/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch index 6e278597a..9b277462d 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 -@@ -252,7 +252,9 @@ +@@ -251,7 +251,9 @@ } INestedGuiEventHandler inestedguieventhandler = this.field_197972_a.field_71462_r; @@ -9,9 +9,9 @@ + if ((!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) { + if (p_197961_5_ == 1) { if (this.field_197972_a.field_71474_y.field_152395_am.func_197976_a(p_197961_3_, p_197961_4_)) { - this.field_197972_a.field_195558_d.func_198077_g(); - this.field_197972_a.field_71474_y.field_74353_u = this.field_197972_a.field_195558_d.func_198113_j(); -@@ -271,6 +273,8 @@ + 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; } @@ -20,7 +20,7 @@ } boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.getFocused() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.getFocused()).func_212955_f(); -@@ -290,10 +294,14 @@ +@@ -289,10 +293,14 @@ Screen.wrapScreenError(() -> { if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.field_197973_b)) { if (p_197961_5_ == 0) { @@ -37,7 +37,7 @@ } }, "keyPressed event handler", inestedguieventhandler.getClass().getCanonicalName()); -@@ -354,7 +362,7 @@ +@@ -353,7 +361,7 @@ } } } @@ -46,7 +46,7 @@ } } -@@ -364,12 +372,16 @@ +@@ -363,12 +371,16 @@ if (iguieventlistener != null && this.field_197972_a.func_213250_au() == null) { if (Character.charCount(p_197963_3_) == 1) { Screen.wrapScreenError(() -> { diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 2e3e9c84e..b141c727b 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,23 +1,14 @@ --- a/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java -@@ -316,6 +316,7 @@ +@@ -321,6 +321,7 @@ + public Minecraft(GameConfiguration p_i45547_1_) { super("Client"); - this.field_195556_O = p_i45547_1_.field_178743_b; field_71432_P = this; + net.minecraftforge.client.ForgeHooksClient.invalidateLog4jThreadCache(); this.field_71412_D = p_i45547_1_.field_178744_c.field_178760_a; - this.field_110446_Y = p_i45547_1_.field_178744_c.field_178759_c; + File file1 = p_i45547_1_.field_178744_c.field_178759_c; this.field_130070_K = p_i45547_1_.field_178744_c.field_178758_b; -@@ -333,7 +334,7 @@ - supplier = p_213262_2_; - } - -- return new ClientResourcePackInfo(p_213262_0_, p_213262_1_, supplier, p_213262_3_, p_213262_4_, p_213262_5_); -+ return new ClientResourcePackInfo(p_213262_0_, p_213262_1_, supplier, p_213262_3_, p_213262_4_, p_213262_5_, p_213262_3_.isHidden()); - }); - this.field_110448_aq.func_198982_a(this.field_195554_ax); - this.field_110448_aq.func_198982_a(new FolderPackFinder(this.field_130070_K)); -@@ -341,7 +342,6 @@ +@@ -335,7 +336,6 @@ this.field_152355_az = (new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString())).createMinecraftSessionService(); this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a; field_147123_G.info("Setting user: {}", (Object)this.field_71449_j.func_111285_a()); @@ -25,74 +16,79 @@ 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; -@@ -423,6 +423,7 @@ - screensize = new ScreenSize(this.field_71474_y.field_92118_B, this.field_71474_y.field_92119_C, screensize.field_216496_c, screensize.field_216497_d, screensize.field_216498_e); +@@ -367,6 +367,7 @@ + screensize = p_i45547_1_.field_178743_b; } + net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.join(); - LongSupplier longsupplier = GLX.initGlfw(); - if (longsupplier != null) { - Util.field_211180_a = longsupplier; -@@ -442,7 +443,6 @@ + Util.field_211180_a = RenderSystem.initBackendSystem(); + this.field_195557_T = new VirtualScreen(this); + this.field_195558_d = this.field_195557_T.func_217626_a(screensize, this.field_71474_y.field_198019_u, "Minecraft " + SharedConstants.func_215069_a().getName()); +@@ -382,7 +383,6 @@ 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()); - GLX.init(); -@@ -451,6 +451,7 @@ + RenderSystem.initRenderer(this.field_71474_y.field_209231_W, false); +@@ -390,6 +390,7 @@ this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F); this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, this.field_152352_aC); this.field_71474_y.func_198017_a(this.field_110448_aq); + net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax); this.field_110448_aq.func_198983_a(); - List list = this.field_110448_aq.func_198980_d().stream().map(ResourcePackInfo::func_195796_e).collect(Collectors.toList()); + this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab); + this.field_110451_am.func_219534_a(this.field_135017_as); +@@ -433,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()) { +@@ -450,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)); +- } -@@ -516,12 +517,14 @@ - this.field_110451_am.func_219534_a(this.field_193995_ae); - GlStateManager.viewport(0, 0, this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l()); - this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o); -+ 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.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); - GLX.setGlfwErrorCallback(this::func_195545_a); - if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) { -@@ -532,18 +535,20 @@ - this.field_195558_d.func_216523_b(this.field_71474_y.field_74352_v); - this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E); - this.field_195558_d.func_198112_b(); -- if (this.field_71475_ae != null) { -- this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, this.field_71475_ae, this.field_71477_af)); -- } 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_) -> { +@@ -465,6 +467,14 @@ + this.func_213256_aB(); + } - ResourceLoadProgressGui.func_212970_a(this); - this.func_213268_a(new ResourceLoadProgressGui(this, this.field_110451_am.func_219535_a(Util.func_215072_e(), this, field_223714_G), () -> { - if (SharedConstants.field_206244_b) { - this.func_213256_aB(); - } -- -+ if (net.minecraftforge.fml.client.ClientModLoader.completeModLoading()) return; // Do not overwrite the error sceen -+ // FORGE: Move opening initial screen to after startup and events are enabled. -+ // Also Fixes MC-145102 -+ if (this.field_71475_ae != null) { -+ this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, this.field_71475_ae, this.field_71477_af)); -+ } else { -+ this.func_147108_a(new MainMenuScreen(true)); -+ } - }, false)); - } - -@@ -558,7 +563,7 @@ ++ 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)); + } +@@ -545,7 +555,7 @@ return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b())); }); SearchTreeReloadable searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> { @@ -101,16 +97,24 @@ }); NonNullList nonnulllist = NonNullList.func_191196_a(); -@@ -647,7 +652,7 @@ - Bootstrap.func_179870_a(p_71377_1_.func_71502_e()); - if (p_71377_1_.func_71497_f() != null) { - Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_1_.func_71497_f()); +@@ -633,13 +643,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_1_.func_147149_a(file2)) { + } else if (p_71377_0_.func_147149_a(file2)) { Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); - System.exit(-1); -@@ -662,6 +667,7 @@ +- 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); + } + + } +@@ -648,6 +658,7 @@ return this.field_71474_y.field_211842_aO; } @@ -118,7 +122,7 @@ public CompletableFuture func_213237_g() { if (this.field_213276_aV != null) { return this.field_213276_aV; -@@ -741,16 +747,20 @@ +@@ -726,10 +737,6 @@ } public void func_147108_a(@Nullable Screen p_147108_1_) { @@ -129,7 +133,8 @@ 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) { - p_147108_1_ = new DeathScreen((ITextComponent)null, this.field_71441_e.func_72912_H().func_76093_s()); +@@ -740,6 +747,14 @@ + } } + Screen old = this.field_71462_r; @@ -143,8 +148,8 @@ 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); -@@ -875,11 +885,13 @@ - GlStateManager.enableTexture(); +@@ -862,11 +877,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); @@ -157,7 +162,7 @@ } this.field_71424_I.func_219897_b(); -@@ -1147,10 +1159,10 @@ +@@ -1121,10 +1138,10 @@ if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) { BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x; BlockPos blockpos = blockraytraceresult.func_216350_a(); @@ -170,16 +175,16 @@ this.field_71439_g.func_184609_a(Hand.MAIN_HAND); } } -@@ -1177,7 +1189,7 @@ +@@ -1151,7 +1168,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_180495_p(blockpos).isAir(field_71441_e, blockpos)) { ++ if (!this.field_71441_e.func_175623_d(blockpos)) { this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b()); break; } -@@ -1187,6 +1199,7 @@ +@@ -1161,6 +1178,7 @@ } this.field_71439_g.func_184821_cY(); @@ -187,17 +192,17 @@ } this.field_71439_g.func_184609_a(Hand.MAIN_HAND); -@@ -1236,6 +1249,9 @@ +@@ -1217,6 +1235,9 @@ } } + if (itemstack.func_190926_b() && (this.field_71476_x == null || this.field_71476_x.func_216346_c() == RayTraceResult.Type.MISS)) -+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, hand); ++ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, hand); + - if (!itemstack.func_190926_b() && this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand) == ActionResultType.SUCCESS) { - this.field_71460_t.field_78516_c.func_187460_a(hand); - return; -@@ -1255,6 +1271,8 @@ + 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_()) { +@@ -1243,6 +1264,8 @@ --this.field_71467_ac; } @@ -206,7 +211,7 @@ this.field_71424_I.func_76320_a("gui"); if (!this.field_71445_n) { this.field_71456_v.func_73831_a(); -@@ -1373,6 +1391,8 @@ +@@ -1360,6 +1383,8 @@ this.field_71424_I.func_219895_b("keyboard"); this.field_195559_v.func_204870_b(); this.field_71424_I.func_76319_b(); @@ -215,7 +220,7 @@ } private void func_184117_aA() { -@@ -1527,6 +1547,12 @@ +@@ -1514,6 +1539,12 @@ this.func_147108_a(worldloadprogressscreen); while(!this.field_71437_Z.func_71200_ad()) { @@ -228,8 +233,8 @@ worldloadprogressscreen.tick(); this.func_195542_b(false); -@@ -1547,11 +1573,17 @@ - networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_213261_0_) -> { +@@ -1534,11 +1565,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())); @@ -247,7 +252,7 @@ WorkingScreen workingscreen = new WorkingScreen(); workingscreen.func_200210_a(new TranslationTextComponent("connect.joining")); this.func_213241_c(workingscreen); -@@ -1583,10 +1615,12 @@ +@@ -1570,10 +1607,12 @@ IntegratedServer integratedserver = this.field_71437_Z; this.field_71437_Z = null; this.field_71460_t.func_190564_k(); @@ -260,15 +265,15 @@ if (integratedserver != null) { while(!integratedserver.func_213201_w()) { this.func_195542_b(false); -@@ -1624,6 +1658,7 @@ - } - +@@ -1605,6 +1644,7 @@ + this.field_71438_f.func_72732_a(p_213257_1_); + this.field_71452_i.func_78870_a(p_213257_1_); TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_); + net.minecraftforge.client.MinecraftForgeClient.clearRenderCache(); } public final boolean func_71355_q() { -@@ -1649,112 +1684,8 @@ +@@ -1630,112 +1670,8 @@ private void func_147112_ai() { if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) { @@ -383,15 +388,15 @@ } } -@@ -1826,6 +1757,7 @@ +@@ -1817,6 +1753,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_213240_0_) -> { - return p_213240_0_; -@@ -1972,6 +1904,8 @@ + return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> { + return p_229993_0_; +@@ -1944,6 +1881,8 @@ } public MusicTicker.MusicType func_147109_W() { @@ -400,9 +405,18 @@ if (this.field_71462_r instanceof WinGameScreen) { return MusicTicker.MusicType.CREDITS; } else if (this.field_71439_g == null) { -@@ -2128,4 +2062,12 @@ - public LoadingGui func_213250_au() { - return this.field_213279_p; +@@ -2120,7 +2059,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_) { +@@ -2138,4 +2077,12 @@ + public void func_228020_b_(int p_228020_1_) { + this.field_175617_aL.func_229355_a_(p_228020_1_); } + + public ItemColors getItemColors() { diff --git a/patches/minecraft/net/minecraft/client/MouseHelper.java.patch b/patches/minecraft/net/minecraft/client/MouseHelper.java.patch index 0807c9f25..6238e26cd 100644 --- a/patches/minecraft/net/minecraft/client/MouseHelper.java.patch +++ b/patches/minecraft/net/minecraft/client/MouseHelper.java.patch @@ -1,27 +1,26 @@ --- a/net/minecraft/client/MouseHelper.java +++ b/net/minecraft/client/MouseHelper.java -@@ -71,17 +71,22 @@ +@@ -72,16 +72,21 @@ if (!this.field_198051_p && flag) { this.func_198034_i(); } + if (net.minecraftforge.client.ForgeHooksClient.onRawMouseClicked(p_198023_3_, p_198023_4_, p_198023_5_)) return; } else { - double d0 = this.field_198040_e * (double)this.field_198036_a.field_195558_d.func_198107_o() / (double)this.field_198036_a.field_195558_d.func_198105_m(); - double d1 = this.field_198041_f * (double)this.field_198036_a.field_195558_d.func_198087_p() / (double)this.field_198036_a.field_195558_d.func_198083_n(); - int p_198023_3_f = p_198023_3_; + double d0 = 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 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, p_198023_3_f); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.field_198036_a.field_71462_r, d0, d1, p_198023_3_f); -+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, p_198023_3_f); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.field_198036_a.field_71462_r, d0, d1, p_198023_3_f); +- 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, p_198023_3_f); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.field_198036_a.field_71462_r, d0, d1, p_198023_3_f); -+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, p_198023_3_f); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.field_198036_a.field_71462_r, d0, d1, p_198023_3_f); +- 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()); } } @@ -36,8 +35,8 @@ @@ -116,7 +121,9 @@ if (this.field_198036_a.field_71462_r != null) { - double d1 = this.field_198040_e * (double)this.field_198036_a.field_195558_d.func_198107_o() / (double)this.field_198036_a.field_195558_d.func_198105_m(); - double d2 = this.field_198041_f * (double)this.field_198036_a.field_195558_d.func_198087_p() / (double)this.field_198036_a.field_195558_d.func_198083_n(); + 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; @@ -53,18 +52,18 @@ if (this.field_198036_a.field_71439_g.func_175149_v()) { if (this.field_198036_a.field_71456_v.func_175187_g().func_175262_a()) { this.field_198036_a.field_71456_v.func_175187_g().func_195621_a((double)(-f1)); -@@ -168,7 +176,9 @@ - double d2 = (p_198022_3_ - this.field_198040_e) * (double)this.field_198036_a.field_195558_d.func_198107_o() / (double)this.field_198036_a.field_195558_d.func_198105_m(); - double d3 = (p_198022_5_ - this.field_198041_f) * (double)this.field_198036_a.field_195558_d.func_198087_p() / (double)this.field_198036_a.field_195558_d.func_198083_n(); +@@ -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); ++ 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()); } } -@@ -233,6 +243,10 @@ +@@ -245,6 +255,10 @@ return this.field_198039_d; } @@ -75,7 +74,7 @@ public double func_198024_e() { return this.field_198040_e; } -@@ -241,6 +255,14 @@ +@@ -253,6 +267,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 58e3a5ec6..45037cd56 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 -@@ -53,6 +53,7 @@ +@@ -55,6 +55,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() { -@@ -68,6 +69,7 @@ +@@ -70,6 +71,7 @@ this.func_148613_b(); this.func_148608_i(); @@ -16,7 +16,7 @@ } private synchronized void func_148608_i() { -@@ -246,6 +248,8 @@ +@@ -251,6 +253,8 @@ public void func_148611_c(ISound p_148611_1_) { if (this.field_148617_f) { @@ -25,7 +25,7 @@ SoundEventAccessor soundeventaccessor = p_148611_1_.func_184366_a(this.field_148622_c); ResourceLocation resourcelocation = p_148611_1_.func_147650_b(); if (soundeventaccessor == null) { -@@ -300,11 +304,13 @@ +@@ -305,11 +309,13 @@ p_217930_7_.func_216420_a(vec3d); p_217930_7_.func_216432_b(flag); }); @@ -39,7 +39,7 @@ }); }); } else { -@@ -312,6 +318,7 @@ +@@ -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(); diff --git a/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch index de7fa3ee7..9fdfde39c 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 -@@ -210,6 +210,11 @@ +@@ -214,6 +214,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 64b90936d..da4b1b55a 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 -@@ -116,7 +116,7 @@ +@@ -115,7 +115,7 @@ f = 1.0F; } @@ -9,7 +9,7 @@ int i = this.func_184612_cw(); float f1 = (float)i / 20.0F; if (f1 > 1.0F) { -@@ -128,6 +128,6 @@ +@@ -127,6 +127,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 9607593c6..95f656936 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 -@@ -130,6 +130,7 @@ +@@ -134,6 +134,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -8,7 +8,7 @@ return false; } -@@ -449,6 +450,11 @@ +@@ -458,6 +459,11 @@ } public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) { @@ -17,33 +17,36 @@ + p_184185_1_ = event.getSound(); + p_184185_2_ = event.getVolume(); + p_184185_3_ = event.getPitch(); - this.field_70170_p.func_184134_a(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); + 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); } -@@ -591,6 +597,7 @@ +@@ -599,6 +605,7 @@ + boolean flag1 = this.field_71158_b.field_228350_h_; boolean flag2 = this.func_223110_ee(); - boolean flag3 = this.func_213287_bg() || this.func_213300_bk(); - this.field_71158_b.func_217607_a(flag3, this.func_175149_v()); + 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; -@@ -607,10 +614,14 @@ - - if (!this.field_70145_X) { - AxisAlignedBB axisalignedbb = this.func_174813_aQ(); -+ net.minecraftforge.client.event.PlayerSPPushOutOfBlocksEvent event = new net.minecraftforge.client.event.PlayerSPPushOutOfBlocksEvent(this, axisalignedbb); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { -+ axisalignedbb = event.getEntityBoundingBox(); - this.func_213282_i(this.field_70165_t - (double)this.func_213311_cf() * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v + (double)this.func_213311_cf() * 0.35D); - this.func_213282_i(this.field_70165_t - (double)this.func_213311_cf() * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v - (double)this.func_213311_cf() * 0.35D); - this.func_213282_i(this.field_70165_t + (double)this.func_213311_cf() * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v - (double)this.func_213311_cf() * 0.35D); - this.func_213282_i(this.field_70165_t + (double)this.func_213311_cf() * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v + (double)this.func_213311_cf() * 0.35D); -+ } +@@ -613,11 +620,12 @@ + this.field_71158_b.field_78901_c = true; } - boolean flag7 = (float)this.func_71024_bL().func_75116_a() > 6.0F || this.field_71075_bZ.field_75101_c; -@@ -950,4 +961,16 @@ +- if (!this.field_70145_X) { +- this.func_213282_i(this.func_226277_ct_() - (double)this.func_213311_cf() * 0.35D, this.func_226278_cu_() + 0.5D, this.func_226281_cx_() + (double)this.func_213311_cf() * 0.35D); +- this.func_213282_i(this.func_226277_ct_() - (double)this.func_213311_cf() * 0.35D, this.func_226278_cu_() + 0.5D, this.func_226281_cx_() - (double)this.func_213311_cf() * 0.35D); +- this.func_213282_i(this.func_226277_ct_() + (double)this.func_213311_cf() * 0.35D, this.func_226278_cu_() + 0.5D, this.func_226281_cx_() - (double)this.func_213311_cf() * 0.35D); +- this.func_213282_i(this.func_226277_ct_() + (double)this.func_213311_cf() * 0.35D, this.func_226278_cu_() + 0.5D, this.func_226281_cx_() + (double)this.func_213311_cf() * 0.35D); ++ net.minecraftforge.client.event.PlayerSPPushOutOfBlocksEvent event = new net.minecraftforge.client.event.PlayerSPPushOutOfBlocksEvent(this); ++ if (!this.field_70145_X && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { ++ 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); ++ 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); ++ 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); ++ 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 @@ return this.field_204230_bP; } } @@ -55,7 +58,7 @@ + this.field_175164_bL = old.field_175164_bL; + this.field_175165_bM = old.field_175165_bM; + this.field_184841_cd = old.field_184841_cd; -+ this.field_175170_bN = old.field_175170_bN; ++ this.field_228351_cj_ = old.field_228351_cj_; + this.field_175171_bO = old.field_175171_bO; + this.field_175168_bP = old.field_175168_bP; + } diff --git a/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch index eb7cb00b0..bce2f11bd 100644 --- a/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch @@ -8,12 +8,12 @@ this.field_147003_i = 160 + (this.width - this.field_146999_f - 200) / 2; this.field_147045_u = true; } -@@ -59,7 +60,7 @@ +@@ -58,7 +59,7 @@ j = 132 / (collection.size() - 1); } - Iterable iterable = Ordering.natural().sortedCopy(collection); -+ Iterable iterable = collection.stream().filter( effectInstance -> effectInstance.func_188419_a().shouldRender(effectInstance)).sorted().collect(java.util.stream.Collectors.toList()); ++ 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); @@ -21,8 +21,8 @@ int i = this.field_147009_r; for(EffectInstance effectinstance : p_214078_3_) { -+ effectinstance.func_188419_a().renderInventoryEffect(effectinstance, this, p_214078_1_, i, this.blitOffset); -+ if (!effectinstance.func_188419_a().shouldRenderInvText(effectinstance)) { i += p_214078_2_; continue; } ++ effectinstance.renderInventoryEffect(this, p_214078_1_, i, this.getBlitOffset()); ++ if (!effectinstance.shouldRenderInvText()) { i += p_214078_2_; continue; } String s = I18n.func_135052_a(effectinstance.func_188419_a().func_76393_a()); if (effectinstance.func_76458_c() >= 1 && effectinstance.func_76458_c() <= 9) { s = s + ' ' + I18n.func_135052_a("enchantment.level." + (effectinstance.func_76458_c() + 1)); diff --git a/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch b/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch index 3e36191b5..41049e846 100644 --- a/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch @@ -1,40 +1,34 @@ --- a/net/minecraft/client/gui/IngameGui.java +++ b/net/minecraft/client/gui/IngameGui.java -@@ -408,6 +408,9 @@ +@@ -406,6 +406,9 @@ for(EffectInstance effectinstance : Ordering.natural().reverse().sortedCopy(collection)) { Effect effect = effectinstance.func_188419_a(); -+ if (!effect.shouldRenderHUD(effectinstance)) continue; ++ if (!effectinstance.shouldRenderHUD()) continue; + // Rebind in case previous renderHUDEffect changed texture + this.field_73839_d.func_110434_K().func_110577_a(ContainerScreen.field_147001_a); if (effectinstance.func_205348_f()) { int k = this.field_194811_H; int l = 1; -@@ -439,11 +442,13 @@ - float f_f = f; - int k_f = k; - int l_f = l; -+ - TextureAtlasSprite textureatlassprite = potionspriteuploader.func_215288_a(effect); - list.add(() -> { - GlStateManager.color4f(1.0F, 1.0F, 1.0F, f_f); - blit(k_f + 3, l_f + 3, this.blitOffset, 18, 18, textureatlassprite); +@@ -443,6 +446,7 @@ + RenderSystem.color4f(1.0F, 1.0F, 1.0F, f1); + blit(j1 + 3, k1 + 3, this.getBlitOffset(), 18, 18, textureatlassprite); }); -+ effect.renderHUDEffect(effectinstance, this, k, l, this.blitOffset, f); ++ effectinstance.renderHUDEffect(this, k, l, this.getBlitOffset(), f); } } -@@ -572,6 +577,7 @@ +@@ -568,6 +572,7 @@ } String s = itextcomponent.func_150254_d(); -+ s = this.field_92016_l.func_77973_b().getHighlightTip(this.field_92016_l, s); ++ 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; if (!this.field_73839_d.field_71442_b.func_78755_b()) { -@@ -588,7 +594,13 @@ - GlStateManager.enableBlend(); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); +@@ -584,7 +589,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)); + FontRenderer font = field_92016_l.func_77973_b().getFontRenderer(field_92016_l); + if (font == null) { @@ -43,6 +37,6 @@ + i = (this.field_194811_H - font.func_78256_a(s)) / 2; + font.func_175063_a(s, (float)i, (float)j, 16777215 + (k << 24)); + } - GlStateManager.disableBlend(); - GlStateManager.popMatrix(); + RenderSystem.disableBlend(); + RenderSystem.popMatrix(); } diff --git a/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch index 2f83e7c21..384db2c54 100644 --- a/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/gui/MapItemRenderer.java +++ b/net/minecraft/client/gui/MapItemRenderer.java -@@ -118,6 +118,7 @@ +@@ -114,6 +114,7 @@ for(MapDecoration mapdecoration : this.field_148242_b.field_76203_h.values()) { - if (!p_148237_1_ || mapdecoration.func_191180_f()) { + if (!p_228089_3_ || mapdecoration.func_191180_f()) { + if (mapdecoration.render(k)) { k++; continue; } - MapItemRenderer.this.field_148251_b.func_110577_a(MapItemRenderer.field_148253_a); - GlStateManager.pushMatrix(); - GlStateManager.translatef(0.0F + (float)mapdecoration.func_176112_b() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.func_176113_c() / 2.0F + 64.0F, -0.02F); + p_228089_1_.func_227860_a_(); + p_228089_1_.func_227861_a_((double)(0.0F + (float)mapdecoration.func_176112_b() / 2.0F + 64.0F), (double)(0.0F + (float)mapdecoration.func_176113_c() / 2.0F + 64.0F), (double)-0.02F); + p_228089_1_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_((float)(mapdecoration.func_176111_d() * 360) / 16.0F)); diff --git a/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch b/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch index d95665f1c..65d639cd4 100644 --- a/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/gui/ResourceLoadProgressGui.java +++ b/net/minecraft/client/gui/ResourceLoadProgressGui.java -@@ -79,6 +79,7 @@ +@@ -81,6 +81,7 @@ this.blit(k1, i1, 0, 0, 256, 256); float f3 = this.field_212975_c.func_219555_b(); - this.field_212978_f = this.field_212978_f * 0.95F + f3 * 0.050000012F; + 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_212972_a(i / 2 - 150, j / 4 * 3, i / 2 + 150, j / 4 * 3 + 10, this.field_212978_f, 1.0F - MathHelper.func_76131_a(f, 0.0F, 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)); } diff --git a/patches/minecraft/net/minecraft/client/gui/SlotGui.java.patch b/patches/minecraft/net/minecraft/client/gui/SlotGui.java.patch index 19b0176ff..5dadc0cf1 100644 --- a/patches/minecraft/net/minecraft/client/gui/SlotGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/SlotGui.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/client/gui/SlotGui.java +++ b/net/minecraft/client/gui/SlotGui.java -@@ -154,15 +154,8 @@ - GlStateManager.disableFog(); +@@ -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); -- GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); +- 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_181662_b((double)this.x0, (double)this.y1, 0.0D).func_187315_a((double)((float)this.x0 / 32.0F), (double)((float)(this.y1 + (int)this.yo) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- bufferbuilder.func_181662_b((double)this.x1, (double)this.y1, 0.0D).func_187315_a((double)((float)this.x1 / 32.0F), (double)((float)(this.y1 + (int)this.yo) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- bufferbuilder.func_181662_b((double)this.x1, (double)this.y0, 0.0D).func_187315_a((double)((float)this.x1 / 32.0F), (double)((float)(this.y0 + (int)this.yo) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- bufferbuilder.func_181662_b((double)this.x0, (double)this.y0, 0.0D).func_187315_a((double)((float)this.x0 / 32.0F), (double)((float)(this.y0 + (int)this.yo) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- 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) { -@@ -402,4 +395,17 @@ +@@ -401,4 +394,17 @@ public int getItemHeight() { return this.itemHeight; } @@ -26,13 +26,13 @@ + protected void drawContainerBackground(Tessellator tessellator) { + BufferBuilder buffer = tessellator.func_178180_c(); + this.minecraft.func_110434_K().func_110577_a(AbstractGui.BACKGROUND_LOCATION); -+ GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); ++ 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_181662_b((double)this.x0, (double)this.y1, 0.0D).func_187315_a(this.x0 / scale, (this.y1 + (int)this.yo) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ buffer.func_181662_b((double)this.x1, (double)this.y1, 0.0D).func_187315_a(this.x1 / scale, (this.y1 + (int)this.yo) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ buffer.func_181662_b((double)this.x1, (double)this.y0, 0.0D).func_187315_a(this.x1 / scale, (this.y0 + (int)this.yo) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ buffer.func_181662_b((double)this.x0, (double)this.y0, 0.0D).func_187315_a(this.x0 / scale, (this.y0 + (int)this.yo) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ 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 9bc0f5f6b..2f7c19ac1 100644 --- a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch @@ -24,7 +24,7 @@ public Advancement func_193935_c() { return this.field_191805_h; } -@@ -136,8 +146,8 @@ +@@ -150,8 +160,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 d4f66f44c..7265fa1c5 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 -@@ -25,6 +25,7 @@ +@@ -24,6 +24,7 @@ private final Map field_191947_i = Maps.newLinkedHashMap(); private AdvancementTabGui field_191940_s; private boolean field_191944_v; @@ -8,7 +8,7 @@ public AdvancementsScreen(ClientAdvancementManager p_i47383_1_) { super(NarratorChatListener.field_216868_a); -@@ -40,7 +41,13 @@ +@@ -39,7 +40,13 @@ } else { this.field_191946_h.func_194230_a(this.field_191940_s == null ? null : this.field_191940_s.func_193935_c(), true); } @@ -23,7 +23,7 @@ } public void removed() { -@@ -58,7 +65,7 @@ +@@ -57,7 +64,7 @@ int j = (this.height - 140) / 2; for(AdvancementTabGui advancementtabgui : this.field_191947_i.values()) { @@ -32,20 +32,20 @@ this.field_191946_h.func_194230_a(advancementtabgui.func_193935_c(), true); break; } -@@ -83,6 +90,12 @@ +@@ -82,6 +89,12 @@ int j = (this.height - 140) / 2; this.renderBackground(); this.func_191936_c(p_render_1_, p_render_2_, i, j); + if (maxPages != 0) { + String page = String.format("%d / %d", tabPage + 1, maxPages + 1); + int width = this.font.func_78256_a(page); -+ GlStateManager.disableLighting(); ++ RenderSystem.disableLighting(); + this.font.func_175063_a(page, i + (252 / 2) - (width / 2), j - 44, -1); + } this.func_191934_b(i, j); this.func_191937_d(p_render_1_, p_render_2_, i, j); } -@@ -131,6 +144,7 @@ +@@ -128,6 +141,7 @@ this.minecraft.func_110434_K().func_110577_a(field_191945_g); for(AdvancementTabGui advancementtabgui : this.field_191947_i.values()) { @@ -53,15 +53,15 @@ advancementtabgui.func_191798_a(p_191934_1_, p_191934_2_, advancementtabgui == this.field_191940_s); } -@@ -139,6 +153,7 @@ - RenderHelper.func_74520_c(); +@@ -135,6 +149,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); } -@@ -161,7 +176,7 @@ +@@ -157,7 +172,7 @@ if (this.field_191947_i.size() > 1) { for(AdvancementTabGui advancementtabgui : this.field_191947_i.values()) { 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 f92753cb6..b51ace9ad 100644 --- a/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch @@ -5,9 +5,9 @@ for(ClientBossInfo clientbossinfo : this.field_184060_g.values()) { int k = i / 2 - 91; + net.minecraftforge.client.event.RenderGameOverlayEvent.BossInfo event = -+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(this.field_184059_f.field_195558_d, clientbossinfo, k, j, 10 + this.field_184059_f.field_71466_p.field_78288_b); ++ 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); + if (!event.isCanceled()) { - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + 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 @@ @@ -17,7 +17,7 @@ - j += 10 + 9; + } + j += event.getIncrement(); -+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(this.field_184059_f.field_195558_d); - if (j >= this.field_184059_f.field_195558_d.func_198087_p() / 3) { ++ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(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 8896538d8..b978c51f8 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 -@@ -342,7 +342,7 @@ +@@ -357,7 +357,7 @@ list.add(this.func_211534_a(entry)); } @@ -9,7 +9,7 @@ list.add("#" + resourcelocation); } } -@@ -358,7 +358,7 @@ +@@ -373,7 +373,7 @@ list.add(this.func_211534_a(entry1)); } @@ -18,7 +18,7 @@ list.add("#" + resourcelocation1); } } -@@ -368,6 +368,7 @@ +@@ -383,6 +383,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 f2b91dbcd..2866211b7 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 -@@ -89,7 +89,7 @@ +@@ -88,7 +88,7 @@ this.func_205702_a(); this.field_193018_j.clear(); @@ -9,7 +9,7 @@ this.field_193018_j.add(new RecipeTabToggleWidget(recipebookcategories)); } -@@ -421,7 +421,7 @@ +@@ -417,7 +417,7 @@ languagemanager.func_135045_a(language); this.field_191888_F.field_71474_y.field_74363_ab = language.getCode(); 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 1439897b0..59f805f03 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 -@@ -37,7 +37,7 @@ +@@ -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_) -> { - for(KeyBinding keybinding : this.minecraft.field_71474_y.field_74324_K) { + for(KeyBinding keybinding : this.field_228183_b_.field_74324_K) { - keybinding.func_197979_b(keybinding.func_197977_i()); + keybinding.setToDefault(); } KeyBinding.func_74508_b(); -@@ -61,11 +61,14 @@ +@@ -56,11 +56,14 @@ public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) { if (this.field_146491_f != null) { if (p_keyPressed_1_ == 256) { + this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.field_197958_a); - this.field_146497_i.func_198014_a(this.field_146491_f, 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_146497_i.func_198014_a(this.field_146491_f, 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_)); } + if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.field_146491_f.getKey())) diff --git a/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch index abb3bc951..c7e3725f7 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/gui/screen/CreateWorldScreen.java +++ b/net/minecraft/client/gui/screen/CreateWorldScreen.java -@@ -137,14 +137,7 @@ - })); +@@ -145,14 +145,7 @@ + }); this.field_146320_D.visible = false; this.field_146322_F = this.addButton(new Button(this.width / 2 + 5, 120, 150, 20, I18n.func_135052_a("selectWorld.customizeType"), (p_214314_1_) -> { - if (WorldType.field_77139_a[this.field_146331_K] == WorldType.field_77138_c) { @@ -16,11 +16,12 @@ })); this.field_146322_F.visible = false; this.field_146321_E = this.addButton(new Button(this.width / 2 - 155, 151, 150, 20, I18n.func_135052_a("selectWorld.allowCommands"), (p_214315_1_) -> { -@@ -223,6 +216,7 @@ - i = (long)s.hashCode(); +@@ -240,6 +233,8 @@ } } -+ WorldType.field_77139_a[this.field_146331_K].onGUICreateWorldPress(); - WorldSettings worldsettings = new WorldSettings(i, GameType.func_77142_a(this.field_146342_r), this.field_146341_s, this.field_146337_w, WorldType.field_77139_a[this.field_146331_K]); ++ WorldType.field_77139_a[this.field_146331_K].onGUICreateWorldPress(); ++ + WorldSettings worldsettings = new WorldSettings(i, this.field_228197_f_.field_228218_f_, this.field_146341_s, this.field_146337_w, WorldType.field_77139_a[this.field_146331_K]); worldsettings.func_205390_a(Dynamic.convert(NBTDynamicOps.field_210820_a, JsonOps.INSTANCE, this.field_146334_a)); + if (this.field_146338_v && !this.field_146337_w) { 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 378b39e44..0abcc618e 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 -@@ -44,6 +44,7 @@ +@@ -34,6 +34,7 @@ })); - Button button = this.addButton(new Button(this.width / 2 - 100, this.height / 4 + 96, 200, 20, s1, (p_213020_1_) -> { + 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_) -> { if (this.field_213023_c) { + func_213022_a(true); - this.minecraft.func_147108_a(new MainMenuScreen()); + 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")); 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 51a73912c..331787af5 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screen/EnchantmentScreen.java +++ b/net/minecraft/client/gui/screen/EnchantmentScreen.java -@@ -146,7 +146,7 @@ +@@ -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); int j2 = 6839882; @@ -9,7 +9,7 @@ this.blit(j1, j + 14 + 19 * i1, 0, 185, 108, 19); this.blit(j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16); fontrenderer.func_78279_b(s1, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1); -@@ -186,10 +186,12 @@ +@@ -195,10 +195,12 @@ Enchantment enchantment = Enchantment.func_185262_c((this.field_147002_h).field_185001_h[j]); int l = (this.field_147002_h).field_185002_i[j]; int i1 = j + 1; 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 dd03880e2..2fe74e02a 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 -@@ -45,7 +45,7 @@ +@@ -41,7 +41,7 @@ if (languagescreen$list$languageentry != null && !languagescreen$list$languageentry.field_214398_b.getCode().equals(this.field_146454_h.func_135041_c().getCode())) { this.field_146454_h.func_135045_a(languagescreen$list$languageentry.field_214398_b); - this.field_146451_g.field_74363_ab = languagescreen$list$languageentry.field_214398_b.getCode(); + this.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_146451_g)); + this.field_211832_i.setMessage(AbstractOption.field_216684_H.func_216743_c(this.field_228183_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 498ca7e74..110d1e770 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 -@@ -51,6 +51,7 @@ +@@ -45,6 +45,7 @@ private final RenderSkybox field_209101_K = new RenderSkybox(field_213098_a); private final boolean field_213102_y; private long field_213103_z; @@ -8,7 +8,7 @@ public MainMenuScreen() { this(false); -@@ -98,10 +99,14 @@ +@@ -88,10 +89,14 @@ this.field_193979_N = this.width - this.field_193978_M - 2; int i = 24; int j = this.height / 4 + 48; @@ -23,7 +23,7 @@ } this.addButton(new ImageButton(this.width / 2 - 124, j + 72 + 12, 20, 20, 0, 106, 20, Button.WIDGETS_LOCATION, 256, 256, (p_213090_1_) -> { -@@ -130,6 +135,7 @@ +@@ -116,6 +121,7 @@ if (this.func_183501_a()) { this.field_183503_M.init(this.minecraft, this.width, this.height); } @@ -31,7 +31,7 @@ } -@@ -140,7 +146,7 @@ +@@ -126,7 +132,7 @@ this.addButton(new Button(this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, 200, 20, I18n.func_135052_a("menu.multiplayer"), (p_213086_1_) -> { this.minecraft.func_147108_a(new MultiplayerScreen(this)); })); @@ -40,15 +40,15 @@ this.func_140005_i(); })); } -@@ -204,6 +210,7 @@ +@@ -190,6 +196,7 @@ this.minecraft.func_110434_K().func_110577_a(field_194400_H); blit(j + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16); + net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.font, this.width, this.height); if (this.field_73975_c != null) { - GlStateManager.pushMatrix(); - GlStateManager.translatef((float)(this.width / 2 + 90), 70.0F, 0.0F); -@@ -222,7 +229,13 @@ + RenderSystem.pushMatrix(); + RenderSystem.translatef((float)(this.width / 2 + 90), 70.0F, 0.0F); +@@ -208,7 +215,13 @@ s = s + ("release".equalsIgnoreCase(this.minecraft.func_184123_d()) ? "" : "/" + this.minecraft.func_184123_d()); } @@ -63,7 +63,7 @@ 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); -@@ -240,6 +253,7 @@ +@@ -222,6 +235,7 @@ if (this.func_183501_a() && f1 >= 1.0F) { this.field_183503_M.render(p_render_1_, p_render_2_, p_render_3_); } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch index 784ef45b1..c6ef035d2 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screen/ResourcePacksScreen.java +++ b/net/minecraft/client/gui/screen/ResourcePacksScreen.java -@@ -84,11 +84,14 @@ +@@ -86,11 +86,14 @@ resourcepacklist.func_198983_a(); List list = Lists.newArrayList(resourcepacklist.func_198978_b()); list.removeAll(resourcepacklist.func_198980_d()); 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 70c472ab5..4c3efb535 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screen/Screen.java +++ b/net/minecraft/client/gui/screen/Screen.java -@@ -109,7 +109,10 @@ +@@ -111,7 +111,10 @@ } protected void renderTooltip(ItemStack p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_) { @@ -12,7 +12,7 @@ } public List getTooltipFromItem(ItemStack p_getTooltipFromItem_1_) { -@@ -128,7 +131,11 @@ +@@ -130,7 +133,11 @@ } public void renderTooltip(List p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_) { @@ -22,10 +22,10 @@ + public void renderTooltip(List p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_, FontRenderer font) { + net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, width, height, -1, font); + if (false && !p_renderTooltip_1_.isEmpty()) { - GlStateManager.disableRescaleNormal(); - RenderHelper.func_74518_a(); - GlStateManager.disableLighting(); -@@ -301,9 +308,12 @@ + RenderSystem.disableRescaleNormal(); + RenderSystem.disableDepthTest(); + int i = 0; +@@ -308,9 +315,12 @@ } public void sendMessage(String p_sendMessage_1_, boolean p_sendMessage_2_) { @@ -38,7 +38,7 @@ this.minecraft.field_71439_g.func_71165_d(p_sendMessage_1_); } -@@ -314,10 +324,14 @@ +@@ -321,10 +331,14 @@ this.font = p_init_1_.field_71466_p; this.width = p_init_2_; this.height = p_init_3_; @@ -53,7 +53,7 @@ } public void setSize(int p_setSize_1_, int p_setSize_2_) { -@@ -345,6 +359,7 @@ +@@ -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); @@ -61,15 +61,15 @@ } else { this.renderDirtBackground(p_renderBackground_1_); } -@@ -365,6 +380,7 @@ - bufferbuilder.func_181662_b((double)this.width, 0.0D, 0.0D).func_187315_a((double)((float)this.width / 32.0F), (double)p_renderDirtBackground_1_).func_181669_b(64, 64, 64, 255).func_181675_d(); - bufferbuilder.func_181662_b(0.0D, 0.0D, 0.0D).func_187315_a(0.0D, (double)p_renderDirtBackground_1_).func_181669_b(64, 64, 64, 255).func_181675_d(); +@@ -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(); tessellator.func_78381_a(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this)); } public boolean isPauseScreen() { -@@ -448,4 +464,8 @@ +@@ -453,4 +469,8 @@ public boolean isMouseOver(double p_isMouseOver_1_, double p_isMouseOver_3_) { return true; } 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 e3bba1629..92144c481 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screen/ServerSelectionList.java +++ b/net/minecraft/client/gui/screen/ServerSelectionList.java -@@ -292,6 +292,8 @@ +@@ -294,6 +294,8 @@ this.field_148303_c.func_146793_a(s); } 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 c46630bb2..0dd057932 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,59 +1,43 @@ --- a/net/minecraft/client/gui/screen/inventory/ContainerScreen.java +++ b/net/minecraft/client/gui/screen/inventory/ContainerScreen.java -@@ -73,6 +73,7 @@ +@@ -71,6 +71,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_)); - GlStateManager.disableRescaleNormal(); - RenderHelper.func_74518_a(); - GlStateManager.disableLighting(); -@@ -102,7 +103,8 @@ + RenderSystem.disableRescaleNormal(); + RenderSystem.disableDepthTest(); + super.render(p_render_1_, p_render_2_, p_render_3_); +@@ -96,13 +97,15 @@ int j1 = slot.field_75223_e; int k1 = slot.field_75221_f; - GlStateManager.colorMask(true, true, true, false); + RenderSystem.colorMask(true, true, true, false); - this.fillGradient(j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433); + int slotColor = this.getSlotColor(i1); + this.fillGradient(j1, k1, j1 + 16, k1 + 16, slotColor, slotColor); - GlStateManager.colorMask(true, true, true, true); - GlStateManager.enableLighting(); - GlStateManager.enableDepthTest(); -@@ -112,6 +114,7 @@ - RenderHelper.func_74518_a(); + RenderSystem.colorMask(true, true, true, true); + RenderSystem.enableDepthTest(); + } + } + this.func_146979_b(p_render_1_, p_render_2_); - RenderHelper.func_74520_c(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawForeground(this, p_render_1_, p_render_2_)); PlayerInventory playerinventory = this.minecraft.field_71439_g.field_71071_by; ItemStack itemstack = this.field_147012_x.func_190926_b() ? playerinventory.func_70445_o() : this.field_147012_x; if (!itemstack.func_190926_b()) { -@@ -163,8 +166,10 @@ - GlStateManager.translatef(0.0F, 0.0F, 32.0F); - this.blitOffset = 200; +@@ -152,8 +155,10 @@ + RenderSystem.translatef(0.0F, 0.0F, 32.0F); + this.setBlitOffset(200); this.itemRenderer.field_77023_b = 200.0F; + net.minecraft.client.gui.FontRenderer font = p_146982_1_.func_77973_b().getFontRenderer(p_146982_1_); + if (font == null) font = this.font; this.itemRenderer.func_180450_b(p_146982_1_, p_146982_2_, p_146982_3_); - this.itemRenderer.func_180453_a(this.font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_); + this.itemRenderer.func_180453_a(font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_); - this.blitOffset = 0; + this.setBlitOffset(0); this.itemRenderer.field_77023_b = 0.0F; } -@@ -208,11 +213,10 @@ - this.blitOffset = 100; - this.itemRenderer.field_77023_b = 100.0F; - if (itemstack.func_190926_b() && p_146977_1_.func_111238_b()) { -- String s1 = p_146977_1_.func_178171_c(); -- if (s1 != null) { -- TextureAtlasSprite textureatlassprite = this.minecraft.func_147117_R().func_110572_b(s1); -+ TextureAtlasSprite textureatlassprite = p_146977_1_.getBackgroundSprite(); -+ if (textureatlassprite != null) { - GlStateManager.disableLighting(); -- this.minecraft.func_110434_K().func_110577_a(AtlasTexture.field_110575_b); -+ this.minecraft.func_110434_K().func_110577_a(p_146977_1_.getBackgroundLocation()); - blit(i, j, this.blitOffset, 16, 16, textureatlassprite); - GlStateManager.enableLighting(); - flag1 = true; -@@ -273,7 +277,8 @@ +@@ -260,7 +265,8 @@ if (super.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_)) { return true; } else { @@ -63,7 +47,7 @@ Slot slot = this.func_195360_a(p_mouseClicked_1_, p_mouseClicked_3_); long i = Util.func_211177_b(); this.field_146993_M = this.field_146998_K == slot && i - this.field_146997_J < 250L && this.field_146992_L == p_mouseClicked_5_; -@@ -282,6 +287,7 @@ +@@ -269,6 +275,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_); @@ -71,7 +55,7 @@ int l = -1; if (slot != null) { l = slot.field_75222_d; -@@ -307,7 +313,7 @@ +@@ -294,7 +301,7 @@ } } else if (!this.field_147007_t) { if (this.minecraft.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) { @@ -79,8 +63,8 @@ + if (this.minecraft.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { this.func_184098_a(slot, l, p_mouseClicked_5_, ClickType.CLONE); } else { - boolean flag2 = l != -999 && (InputMappings.func_216506_a(Minecraft.func_71410_x().field_195558_d.func_198092_i(), 340) || InputMappings.func_216506_a(Minecraft.func_71410_x().field_195558_d.func_198092_i(), 344)); -@@ -331,7 +337,7 @@ + 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 @@ this.field_146987_F = 0; } else if (p_mouseClicked_5_ == 1) { this.field_146987_F = 1; @@ -89,7 +73,7 @@ this.field_146987_F = 2; } } -@@ -384,10 +390,13 @@ +@@ -371,10 +378,13 @@ } public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) { @@ -103,7 +87,7 @@ int k = -1; if (slot != null) { k = slot.field_75222_d; -@@ -401,7 +410,7 @@ +@@ -388,7 +398,7 @@ if (hasShiftDown()) { if (!this.field_146994_N.func_190926_b()) { for(Slot slot2 : this.field_147002_h.field_75151_b) { @@ -112,7 +96,7 @@ this.func_184098_a(slot2, slot2.field_75222_d, p_mouseReleased_5_, ClickType.QUICK_MOVE); } } -@@ -465,7 +474,7 @@ +@@ -452,7 +462,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()) { @@ -120,8 +104,8 @@ + if (this.minecraft.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { this.func_184098_a(slot, k, p_mouseReleased_5_, ClickType.CLONE); } else { - boolean flag1 = k != -999 && (InputMappings.func_216506_a(Minecraft.func_71410_x().field_195558_d.func_198092_i(), 340) || InputMappings.func_216506_a(Minecraft.func_71410_x().field_195558_d.func_198092_i(), 344)); -@@ -514,27 +523,32 @@ + 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 { @@ -145,6 +129,8 @@ 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.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. } - return true; @@ -160,7 +146,7 @@ this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, i, ClickType.SWAP); return true; } -@@ -565,4 +579,16 @@ +@@ -552,4 +569,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 a437400b8..8653b5c17 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,6 +1,6 @@ --- a/net/minecraft/client/gui/screen/inventory/CreativeScreen.java +++ b/net/minecraft/client/gui/screen/inventory/CreativeScreen.java -@@ -63,6 +63,8 @@ +@@ -65,6 +65,8 @@ private boolean field_195377_F; private boolean field_199506_G; private final Map> field_214085_w = Maps.newTreeMap(); @@ -9,7 +9,7 @@ public CreativeScreen(PlayerEntity p_i1088_1_) { super(new CreativeScreen.CreativeContainer(p_i1088_1_), p_i1088_1_.field_71071_by, new StringTextComponent("")); -@@ -231,6 +233,12 @@ +@@ -233,6 +235,12 @@ if (this.minecraft.field_71442_b.func_78758_h()) { super.init(); this.minecraft.field_195559_v.func_197967_a(true); @@ -22,7 +22,7 @@ this.field_147062_A = new TextFieldWidget(this.font, this.field_147003_i + 82, this.field_147009_r + 6, 80, 9, I18n.func_135052_a("itemGroup.search")); this.field_147062_A.func_146203_f(50); this.field_147062_A.func_146185_a(false); -@@ -271,7 +279,7 @@ +@@ -273,7 +281,7 @@ public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_) { if (this.field_195377_F) { return false; @@ -31,7 +31,7 @@ return false; } else { String s = this.field_147062_A.func_146179_b(); -@@ -289,7 +297,7 @@ +@@ -291,7 +299,7 @@ public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) { this.field_195377_F = false; @@ -40,7 +40,7 @@ if (this.minecraft.field_71474_y.field_74310_D.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) { this.field_195377_F = true; this.func_147050_b(ItemGroup.field_78027_g); -@@ -325,6 +333,32 @@ +@@ -327,6 +335,32 @@ private void func_147053_i() { (this.field_147002_h).field_148330_a.clear(); this.field_214085_w.clear(); @@ -73,19 +73,19 @@ String s = this.field_147062_A.func_146179_b(); if (s.isEmpty()) { for(Item item : Registry.field_212630_s) { -@@ -370,9 +404,9 @@ +@@ -372,9 +406,9 @@ protected void func_146979_b(int p_146979_1_, int p_146979_2_) { ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w]; - if (itemgroup.func_78019_g()) { + if (itemgroup != null && itemgroup.func_78019_g()) { - GlStateManager.disableBlend(); + 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()); } } -@@ -383,7 +417,7 @@ +@@ -385,7 +419,7 @@ double d1 = p_mouseClicked_3_ - (double)this.field_147009_r; for(ItemGroup itemgroup : ItemGroup.field_78032_a) { @@ -94,7 +94,7 @@ return true; } } -@@ -404,7 +438,7 @@ +@@ -406,7 +440,7 @@ this.field_147066_y = false; for(ItemGroup itemgroup : ItemGroup.field_78032_a) { @@ -103,7 +103,7 @@ this.func_147050_b(itemgroup); return true; } -@@ -415,12 +449,15 @@ +@@ -417,12 +451,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) { -@@ -494,13 +531,15 @@ +@@ -499,13 +536,15 @@ } if (this.field_147062_A != null) { @@ -136,7 +136,7 @@ this.func_147053_i(); } else { -@@ -560,16 +599,35 @@ +@@ -565,16 +604,35 @@ this.renderBackground(); super.render(p_render_1_, p_render_2_, p_render_3_); @@ -163,23 +163,22 @@ + if (maxPages != 0) { + String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ GlStateManager.disableLighting(); -+ this.blitOffset = 300; ++ 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.blitOffset = 0; ++ this.setBlitOffset(0); + this.itemRenderer.field_77023_b = 0.0F; + } + - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableLighting(); + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.func_191948_b(p_render_1_, p_render_2_); -@@ -618,7 +676,11 @@ + } +@@ -622,7 +680,10 @@ } } - this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_); -+ + net.minecraft.client.gui.FontRenderer font = p_renderTooltip_1_.func_77973_b().getFontRenderer(p_renderTooltip_1_); + net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_renderTooltip_1_); + this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font)); @@ -187,8 +186,8 @@ } else { super.renderTooltip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_); } -@@ -630,25 +692,44 @@ - RenderHelper.func_74520_c(); +@@ -633,25 +694,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) { @@ -221,7 +220,7 @@ + this.minecraft.func_110434_K().func_110577_a(itemgroup.getBackgroundImage()); this.blit(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g); this.field_147062_A.render(p_146976_2_, p_146976_3_, p_146976_1_); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + 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; @@ -236,8 +235,8 @@ + this.func_147051_a(itemgroup); if (itemgroup == ItemGroup.field_78036_m) { - InventoryScreen.func_147046_a(this.field_147003_i + 88, this.field_147009_r + 45, 20, (float)(this.field_147003_i + 88 - p_146976_2_), (float)(this.field_147009_r + 45 - 30 - p_146976_3_), this.minecraft.field_71439_g); -@@ -657,6 +738,7 @@ + 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 @@ } protected boolean func_195375_a(ItemGroup p_195375_1_, double p_195375_2_, double p_195375_4_) { @@ -245,43 +244,34 @@ int i = p_195375_1_.func_78020_k(); int j = 28 * i; int k = 0; -@@ -726,6 +808,8 @@ +@@ -728,6 +809,8 @@ + i1 = i1 + (this.field_147000_g - 4); } - GlStateManager.disableLighting(); -+ GlStateManager.color3f(1F, 1F, 1F); //Forge: Reset color in case Items change it. -+ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. ++ 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.blitOffset = 100; + this.setBlitOffset(100); this.itemRenderer.field_77023_b = 100.0F; -@@ -897,6 +981,31 @@ +@@ -896,6 +979,22 @@ public boolean func_82869_a(PlayerEntity p_82869_1_) { return this.field_148332_b.func_82869_a(p_82869_1_); } + -+ public ResourceLocation getBackgroundLocation() { -+ return this.field_148332_b.getBackgroundLocation(); -+ } -+ -+ public void setBackgroundLocation(ResourceLocation texture) { -+ this.field_148332_b.setBackgroundLocation(texture); -+ } -+ -+ public void setBackgroundName(@Nullable String name) { -+ this.field_148332_b.setBackgroundName(name); -+ } -+ -+ @Nullable -+ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() { -+ return this.field_148332_b.getBackgroundSprite(); -+ } -+ ++ @Override + public int getSlotIndex() { + return this.field_148332_b.getSlotIndex(); + } + ++ @Override + public boolean isSameInventory(Slot other) { + return this.field_148332_b.isSameInventory(other); ++ } ++ ++ @Override ++ public Slot setBackground(ResourceLocation atlas, ResourceLocation sprite) { ++ this.field_148332_b.setBackground(atlas, sprite); ++ return this; + } } diff --git a/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch b/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch index 754784d69..3a19cf306 100644 --- a/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/gui/toasts/RecipeToast.java +++ b/net/minecraft/client/gui/toasts/RecipeToast.java -@@ -36,7 +36,7 @@ +@@ -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); - RenderHelper.func_74520_c(); - IRecipe irecipe = this.field_202906_c.get((int)(p_193653_2_ / (5000L / (long)this.field_202906_c.size()) % (long)this.field_202906_c.size())); + IRecipe irecipe = this.field_202906_c.get((int)((p_193653_2_ * (long)this.field_202906_c.size() / 5000L) % (long)this.field_202906_c.size())); //Forge: fix math so that it doesn't divide by 0 when there are more than 5000 recipes ItemStack itemstack = irecipe.func_222128_h(); - GlStateManager.pushMatrix(); - GlStateManager.scalef(0.6F, 0.6F, 1.0F); + 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 69ea8b740..8a4bd7e99 100644 --- a/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch @@ -1,20 +1,15 @@ --- a/net/minecraft/client/gui/widget/Widget.java +++ b/net/minecraft/client/gui/widget/Widget.java -@@ -110,12 +110,7 @@ +@@ -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 = 14737632; -- if (!this.active) { -- j = 10526880; -- } else if (this.isHovered()) { -- j = 16777120; -- } +- int j = this.active ? 16777215 : 10526880; + int j = getFGColor(); - - this.drawCenteredString(fontrenderer, this.message, this.x + this.width / 2, this.y + (this.height - 8) / 2, j | MathHelper.func_76123_f(this.alpha * 255.0F) << 24); + 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); } -@@ -211,6 +206,14 @@ + +@@ -206,6 +206,14 @@ this.width = p_setWidth_1_; } @@ -29,7 +24,7 @@ public void setAlpha(float p_setAlpha_1_) { this.alpha = p_setAlpha_1_; } -@@ -234,4 +237,18 @@ +@@ -233,4 +241,13 @@ protected void setFocused(boolean p_setFocused_1_) { this.focused = p_setFocused_1_; } @@ -37,12 +32,7 @@ + protected int packedFGColor = 0; + public int getFGColor() { + if (packedFGColor != 0) return packedFGColor; -+ int ret = 14737632; -+ if (!this.active) -+ ret = 10526880; -+ else if (this.isHovered()) -+ ret = 16777120; -+ return ret; ++ return this.active ? 16777215 : 10526880; + } + 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 66e1a2f04..3f358803d 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,6 +1,6 @@ --- a/net/minecraft/client/gui/widget/list/AbstractList.java +++ b/net/minecraft/client/gui/widget/list/AbstractList.java -@@ -451,6 +451,13 @@ +@@ -450,6 +450,13 @@ return flag; } @@ -8,8 +8,8 @@ + public int getHeight() { return this.height; } + public int getTop() { return this.y0; } + public int getBottom() { return this.y1; } -+ public int getLeft() { return this.x1; } -+ public int getRight() { return this.x0; } ++ public int getLeft() { return this.x0; } ++ public int getRight() { return this.x1; } + @OnlyIn(Dist.CLIENT) public abstract static class AbstractListEntry> implements IGuiEventListener { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch index 437385573..74522efd6 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/ClientChunkProvider.java +++ b/net/minecraft/client/multiplayer/ClientChunkProvider.java -@@ -61,6 +61,7 @@ +@@ -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_)) { @@ -8,10 +8,10 @@ this.field_217256_d.func_217190_a(i, chunk, (Chunk)null); } -@@ -113,6 +114,7 @@ - worldlightmanager.func_215566_a(SectionPos.func_218154_a(p_217250_2_, j, p_217250_3_), ChunkSection.func_222628_a(chunksection)); +@@ -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/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch index 8fff14746..86abd9c44 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch @@ -1,17 +1,23 @@ --- a/net/minecraft/client/multiplayer/PlayerController.java +++ b/net/minecraft/client/multiplayer/PlayerController.java -@@ -103,7 +103,9 @@ +@@ -92,6 +92,7 @@ + } + + public boolean func_187103_a(BlockPos p_187103_1_) { ++ if (field_78776_a.field_71439_g.func_184614_ca().onBlockStartBreak(p_187103_1_, field_78776_a.field_71439_g)) return false; + 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,7 +104,7 @@ Block block = blockstate.func_177230_c(); if ((block instanceof CommandBlockBlock || block instanceof StructureBlock || block instanceof JigsawBlock) && !this.field_78776_a.field_71439_g.func_195070_dx()) { return false; - } else if (blockstate.func_196958_f()) { + } else if (blockstate.isAir(world, p_187103_1_)) { -+ if (field_78776_a.field_71439_g.func_184614_ca().onBlockStartBreak(p_187103_1_, field_78776_a.field_71439_g)) return false; -+ return false; } else { block.func_176208_a(world, p_187103_1_, blockstate, this.field_78776_a.field_71439_g); -@@ -129,21 +131,25 @@ +@@ -129,21 +130,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_); @@ -27,7 +33,8 @@ BlockState blockstate1 = 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_, blockstate1, 0.0F); this.func_225324_a(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_); - boolean flag = !blockstate1.func_196958_f(); +- boolean flag = !blockstate1.func_196958_f(); ++ boolean flag = !blockstate1.isAir(this.field_78776_a.field_71441_e, p_180511_1_); if (flag && this.field_78770_f == 0.0F) { + if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) blockstate1.func_196942_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71439_g); @@ -37,7 +44,7 @@ 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 +189,24 @@ +@@ -183,22 +188,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_); @@ -55,7 +62,7 @@ if (this.field_78780_h % 4.0F == 0.0F) { - SoundType soundtype = blockstate.func_215695_r(); + SoundType soundtype = blockstate.getSoundType(this.field_78776_a.field_71441_e, p_180512_1_, this.field_78776_a.field_71439_g); - this.field_78776_a.func_147118_V().func_147682_a(new SimpleSound(soundtype.func_185846_f(), SoundCategory.NEUTRAL, (soundtype.func_185843_a() + 1.0F) / 8.0F, soundtype.func_185847_b() * 0.5F, p_180512_1_)); + this.field_78776_a.func_147118_V().func_147682_a(new SimpleSound(soundtype.func_185846_f(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 8.0F, soundtype.func_185847_b() * 0.5F, p_180512_1_)); } ++this.field_78780_h; @@ -64,7 +71,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 +225,8 @@ +@@ -217,7 +224,8 @@ } public float func_78757_d() { @@ -74,7 +81,7 @@ } public void func_78765_e() { -@@ -234,7 +243,7 @@ +@@ -234,7 +242,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()) { @@ -83,7 +90,7 @@ } return p_178893_1_.equals(this.field_178895_c) && flag; -@@ -257,17 +266,24 @@ +@@ -256,13 +264,19 @@ return ActionResultType.FAIL; } else { ItemStack itemstack = p_217292_1_.func_184586_b(p_217292_3_); @@ -97,20 +104,23 @@ this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); return ActionResultType.SUCCESS; } else { - boolean flag = !p_217292_1_.func_184614_ca().func_190926_b() || !p_217292_1_.func_184592_cb().func_190926_b(); -- boolean flag1 = p_217292_1_.func_70093_af() && flag; -- if (!flag1 && p_217292_2_.func_180495_p(blockpos).func_215687_a(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_)) { -+ boolean flag1 = !(p_217292_1_.func_70093_af() && flag) || (p_217292_1_.func_184614_ca().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_) && p_217292_1_.func_184592_cb().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_)); -+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && flag1 && p_217292_2_.func_180495_p(blockpos).func_215687_a(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_)) { - this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); - return ActionResultType.SUCCESS; - } else { - this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); -+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return ActionResultType.PASS; - if (!itemstack.func_190926_b() && !p_217292_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { - ItemUseContext itemusecontext = new ItemUseContext(p_217292_1_, p_217292_3_, p_217292_4_); - ActionResultType actionresulttype; -@@ -298,11 +314,14 @@ +- boolean flag = !p_217292_1_.func_184614_ca().func_190926_b() || !p_217292_1_.func_184592_cb().func_190926_b(); ++ boolean flag = !p_217292_1_.func_184614_ca().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_) || !p_217292_1_.func_184592_cb().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_); + boolean flag1 = p_217292_1_.func_226563_dT_() && flag; +- if (!flag1) { ++ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1) { + 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,6 +285,7 @@ + } + + this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); ++ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return ActionResultType.PASS; + if (!itemstack.func_190926_b() && !p_217292_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { + ItemUseContext itemusecontext = new ItemUseContext(p_217292_1_, p_217292_3_, p_217292_4_); + ActionResultType actionresulttype1; +@@ -300,11 +315,14 @@ if (p_187101_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { return ActionResultType.PASS; } else { @@ -125,7 +135,7 @@ } return actionresult.func_188397_a(); -@@ -327,6 +346,9 @@ +@@ -329,6 +347,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_)); @@ -135,9 +145,9 @@ return this.field_78779_k == GameType.SPECTATOR ? ActionResultType.PASS : p_187097_1_.func_190775_a(p_187097_2_, p_187097_3_); } -@@ -334,6 +356,9 @@ +@@ -336,6 +357,9 @@ this.func_78750_j(); - Vec3d vec3d = p_187102_3_.func_216347_e().func_178786_a(p_187102_2_.field_70165_t, p_187102_2_.field_70163_u, p_187102_2_.field_70161_v); + 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)); + 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_); 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 4113b7fcc..1d23d4117 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 -@@ -356,6 +356,7 @@ +@@ -361,6 +361,7 @@ this.field_147299_f.field_184132_p.func_217737_a(); this.field_147299_f.field_71439_g.func_70065_x(); @@ -8,15 +8,15 @@ 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); -@@ -366,6 +367,7 @@ - this.field_147299_f.field_71439_g.func_145769_d(i); +@@ -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(); -@@ -714,7 +716,7 @@ +@@ -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) { @@ -25,7 +25,7 @@ } } -@@ -790,7 +792,9 @@ +@@ -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); @@ -36,10 +36,10 @@ } public void func_147279_a(SAnimateHandPacket p_147279_1_) { -@@ -962,8 +966,10 @@ - this.field_147299_f.field_71439_g = clientplayerentity1; +@@ -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,9 +47,9 @@ 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); -@@ -1084,6 +1090,12 @@ +@@ -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) { + 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) { @@ -60,7 +60,7 @@ } if (flag && this.field_147299_f.field_71462_r instanceof CommandBlockScreen) { -@@ -1253,6 +1265,7 @@ +@@ -1276,6 +1288,7 @@ clientrecipebook.func_199644_c(); clientrecipebook.func_199642_d().forEach(imutablesearchtree::func_217872_a); imutablesearchtree.func_194040_a(); @@ -68,7 +68,7 @@ } public void func_200232_a(SPlayerLookPacket p_200232_1_) { -@@ -1333,7 +1346,7 @@ +@@ -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) { @@ -77,7 +77,7 @@ if (effect != null) { EffectInstance effectinstance = new EffectInstance(effect, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h()); effectinstance.func_100012_b(p_147260_1_.func_149429_c()); -@@ -1353,6 +1366,7 @@ +@@ -1376,6 +1389,7 @@ } this.field_147299_f.func_213253_a(SearchTreeManager.field_215360_b).func_194040_a(); @@ -85,9 +85,9 @@ } public void func_175098_a(SCombatPacket p_175098_1_) { -@@ -1766,10 +1780,12 @@ - - this.field_147299_f.field_184132_p.field_217741_m.func_217692_a(pointofinterestdebugrenderer$braininfo); +@@ -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)) @@ -99,7 +99,7 @@ packetbuffer.release(); } -@@ -1909,7 +1925,7 @@ +@@ -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) { diff --git a/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch b/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch index 8162974a1..8c8a24ecc 100644 --- a/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/particle/DiggingParticle.java +++ b/net/minecraft/client/particle/DiggingParticle.java -@@ -36,6 +36,7 @@ +@@ -37,6 +37,7 @@ } public DiggingParticle func_174846_a(BlockPos p_174846_1_) { @@ -8,7 +8,7 @@ this.field_181019_az = p_174846_1_; if (this.field_174847_a.func_177230_c() == Blocks.field_196658_i) { return this; -@@ -93,7 +94,13 @@ +@@ -94,7 +95,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_) { BlockState blockstate = p_199234_1_.func_197584_c(); diff --git a/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch b/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch index 41a59e9f3..4b7ccb4f5 100644 --- a/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/particle/ParticleManager.java +++ b/net/minecraft/client/particle/ParticleManager.java -@@ -63,7 +63,7 @@ +@@ -65,7 +65,7 @@ private final Queue field_178933_d = Queues.newArrayDeque(); private final TextureManager field_78877_c; private final Random field_78875_d = new Random(); @@ -8,8 +8,8 @@ + private final Map> field_178932_g = new java.util.HashMap<>(); private final Queue field_187241_h = Queues.newArrayDeque(); private final Map field_215242_i = Maps.newHashMap(); - private final AtlasTexture field_215243_j = new AtlasTexture("textures/particle"); -@@ -137,13 +137,13 @@ + private final AtlasTexture field_215243_j = new AtlasTexture(AtlasTexture.field_215262_g); +@@ -143,13 +143,13 @@ } public void func_199283_a(ParticleType p_199283_1_, IParticleFactory p_199283_2_) { @@ -25,7 +25,7 @@ } 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_) { -@@ -230,11 +230,12 @@ +@@ -238,11 +238,12 @@ @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_) { @@ -39,17 +39,17 @@ this.field_187241_h.add(p_78873_1_); } -@@ -306,7 +307,8 @@ - Particle.field_70554_ao = p_215233_1_.func_216785_c().field_72448_b; - Particle.field_70555_ap = p_215233_1_.func_216785_c().field_72449_c; +@@ -312,7 +313,8 @@ + RenderSystem.pushMatrix(); + RenderSystem.multMatrix(p_228345_1_.func_227866_c_().func_227870_a_()); - for(IParticleRenderType iparticlerendertype : field_215241_b) { + for(IParticleRenderType iparticlerendertype : this.field_78876_b.keySet()) { // Forge: allow custom IParticleRenderType's -+ if(iparticlerendertype == IParticleRenderType.field_217606_f) continue; ++ if (iparticlerendertype == IParticleRenderType.field_217606_f) continue; Iterable iterable = this.field_78876_b.get(iparticlerendertype); if (iterable != null) { - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); -@@ -342,7 +344,7 @@ + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); +@@ -351,7 +353,7 @@ } public void func_180533_a(BlockPos p_180533_1_, BlockState p_180533_2_) { @@ -57,8 +57,8 @@ + if (!p_180533_2_.isAir(this.field_78878_a, p_180533_1_) && !p_180533_2_.addDestroyEffects(this.field_78878_a, p_180533_1_, this)) { VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_); double d0 = 0.25D; - voxelshape.func_197755_b((p_199284_3_, p_199284_5_, p_199284_7_, p_199284_9_, p_199284_11_, p_199284_13_) -> { -@@ -414,6 +416,12 @@ + voxelshape.func_197755_b((p_228348_3_, p_228348_5_, p_228348_7_, p_228348_9_, p_228348_11_, p_228348_13_) -> { +@@ -423,6 +425,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 5f12af403..ade014f8c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch @@ -1,21 +1,15 @@ --- a/net/minecraft/client/renderer/ActiveRenderInfo.java +++ b/net/minecraft/client/renderer/ActiveRenderInfo.java -@@ -53,6 +53,10 @@ - this.func_216776_a(direction != null ? direction.func_185119_l() - 180.0F : 0.0F, 0.0F); - this.func_216782_a(0.0D, 0.3D, 0.0D); - } -+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup cameraSetup = net.minecraftforge.client.ForgeHooksClient.onCameraSetup(net.minecraft.client.Minecraft.func_71410_x().field_71460_t, this, p_216772_5_, this.field_216798_j, this.field_216797_i, 0f); -+ this.field_216797_i = cameraSetup.getPitch(); -+ this.field_216798_j = cameraSetup.getYaw(); -+ GlStateManager.rotatef(cameraSetup.getRoll(), 0, 0, 1); - - GlStateManager.rotatef(this.field_216797_i, 1.0F, 0.0F, 0.0F); - GlStateManager.rotatef(this.field_216798_j + 180.0F, 0.0F, 1.0F, 0.0F); -@@ -172,4 +176,11 @@ +@@ -168,4 +168,16 @@ this.field_216791_c = null; this.field_216789_a = false; } + ++ public void setAnglesInternal(float yaw, float pitch) { ++ this.field_216798_j = yaw; ++ this.field_216797_i = pitch; ++ } ++ + public net.minecraft.block.BlockState getBlockAtCamera() { + if (!this.field_216789_a) + return net.minecraft.block.Blocks.field_150350_a.func_176223_P(); diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch index a79557926..c7b966751 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -1,119 +1,93 @@ --- a/net/minecraft/client/renderer/BlockModelRenderer.java +++ b/net/minecraft/client/renderer/BlockModelRenderer.java -@@ -37,11 +37,17 @@ +@@ -37,13 +37,18 @@ this.field_187499_a = p_i46575_1_; } + @Deprecated //Forge: Model data argument - public boolean func_217631_a(IEnviromentBlockReader p_217631_1_, IBakedModel p_217631_2_, BlockState p_217631_3_, BlockPos p_217631_4_, BufferBuilder p_217631_5_, boolean p_217631_6_, Random p_217631_7_, long p_217631_8_) { -- boolean flag = Minecraft.func_71379_u() && p_217631_3_.func_185906_d() == 0 && p_217631_2_.func_177555_b(); -+ return renderModel(p_217631_1_, p_217631_2_, p_217631_3_, p_217631_4_, p_217631_5_, p_217631_6_, p_217631_7_, p_217631_8_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public boolean 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_) { ++ 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_.func_185906_d() == 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(IEnviromentBlockReader p_217631_1_, IBakedModel p_217631_2_, BlockState p_217631_3_, BlockPos p_217631_4_, BufferBuilder p_217631_5_, boolean p_217631_6_, Random p_217631_7_, long p_217631_8_, net.minecraftforge.client.model.data.IModelData modelData) { -+ boolean flag = Minecraft.func_71379_u() && p_217631_3_.getLightValue(p_217631_1_, p_217631_4_) == 0 && p_217631_2_.func_177555_b(); -+ modelData = p_217631_2_.getModelData(p_217631_1_, p_217631_4_, p_217631_3_, modelData); -+ try { -- return flag ? this.func_217634_b(p_217631_1_, p_217631_2_, p_217631_3_, p_217631_4_, p_217631_5_, p_217631_6_, p_217631_7_, p_217631_8_) : this.func_217635_c(p_217631_1_, p_217631_2_, p_217631_3_, p_217631_4_, p_217631_5_, p_217631_6_, p_217631_7_, p_217631_8_); -+ return flag ? this.renderModelSmooth(p_217631_1_, p_217631_2_, p_217631_3_, p_217631_4_, p_217631_5_, p_217631_6_, p_217631_7_, p_217631_8_, modelData) : this.renderModelFlat(p_217631_1_, p_217631_2_, p_217631_3_, p_217631_4_, p_217631_5_, p_217631_6_, p_217631_7_, p_217631_8_, modelData); +- 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); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.func_85055_a(throwable, "Tesselating block model"); CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block model being tesselated"); -@@ -51,7 +57,12 @@ +@@ -53,7 +58,11 @@ } } + @Deprecated //Forge: Model data argument - public boolean func_217634_b(IEnviromentBlockReader p_217634_1_, IBakedModel p_217634_2_, BlockState p_217634_3_, BlockPos p_217634_4_, BufferBuilder p_217634_5_, boolean p_217634_6_, Random p_217634_7_, long p_217634_8_) { -+ return renderModelSmooth(p_217634_1_, p_217634_2_, p_217634_3_, p_217634_4_, p_217634_5_, p_217634_6_, p_217634_7_, p_217634_8_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public boolean 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 renderModelSmooth(IEnviromentBlockReader p_217634_1_, IBakedModel p_217634_2_, BlockState p_217634_3_, BlockPos p_217634_4_, BufferBuilder p_217634_5_, boolean p_217634_6_, Random p_217634_7_, long p_217634_8_, net.minecraftforge.client.model.data.IModelData modelData) { ++ 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) { boolean flag = false; float[] afloat = new float[Direction.values().length * 2]; BitSet bitset = new BitSet(3); -@@ -59,7 +70,7 @@ +@@ -61,7 +70,7 @@ for(Direction direction : Direction.values()) { - p_217634_7_.setSeed(p_217634_8_); -- List list = p_217634_2_.func_200117_a(p_217634_3_, direction, p_217634_7_); -+ List list = p_217634_2_.getQuads(p_217634_3_, direction, p_217634_7_, modelData); - if (!list.isEmpty() && (!p_217634_6_ || Block.func_176225_a(p_217634_3_, p_217634_1_, p_217634_4_, direction))) { - this.func_217630_a(p_217634_1_, p_217634_3_, p_217634_4_, p_217634_5_, list, afloat, bitset, blockmodelrenderer$ambientocclusionface); + 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_); flag = true; -@@ -67,7 +78,7 @@ +@@ -69,7 +78,7 @@ } - p_217634_7_.setSeed(p_217634_8_); -- List list1 = p_217634_2_.func_200117_a(p_217634_3_, (Direction)null, p_217634_7_); -+ List list1 = p_217634_2_.getQuads(p_217634_3_, (Direction)null, p_217634_7_, modelData); + 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); if (!list1.isEmpty()) { - this.func_217630_a(p_217634_1_, p_217634_3_, p_217634_4_, p_217634_5_, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface); + 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_); flag = true; -@@ -76,13 +87,18 @@ +@@ -78,13 +87,18 @@ return flag; } -+ @Deprecated //Forge: Model data Argument - public boolean func_217635_c(IEnviromentBlockReader p_217635_1_, IBakedModel p_217635_2_, BlockState p_217635_3_, BlockPos p_217635_4_, BufferBuilder p_217635_5_, boolean p_217635_6_, Random p_217635_7_, long p_217635_8_) { -+ return renderModelFlat(p_217635_1_, p_217635_2_, p_217635_3_, p_217635_4_, p_217635_5_, p_217635_6_, p_217635_7_, p_217635_8_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ @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 renderModelFlat(IEnviromentBlockReader p_217635_1_, IBakedModel p_217635_2_, BlockState p_217635_3_, BlockPos p_217635_4_, BufferBuilder p_217635_5_, boolean p_217635_6_, Random p_217635_7_, long p_217635_8_, net.minecraftforge.client.model.data.IModelData modelData) { ++ 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) { boolean flag = false; BitSet bitset = new BitSet(3); for(Direction direction : Direction.values()) { - p_217635_7_.setSeed(p_217635_8_); -- List list = p_217635_2_.func_200117_a(p_217635_3_, direction, p_217635_7_); -+ List list = p_217635_2_.getQuads(p_217635_3_, direction, p_217635_7_, modelData); - if (!list.isEmpty() && (!p_217635_6_ || Block.func_176225_a(p_217635_3_, p_217635_1_, p_217635_4_, direction))) { - int i = p_217635_3_.func_215684_a(p_217635_1_, p_217635_4_.func_177972_a(direction)); - this.func_217636_a(p_217635_1_, p_217635_3_, p_217635_4_, i, false, p_217635_5_, list, bitset); -@@ -91,7 +107,7 @@ + p_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 @@ } - p_217635_7_.setSeed(p_217635_8_); -- List list1 = p_217635_2_.func_200117_a(p_217635_3_, (Direction)null, p_217635_7_); -+ List list1 = p_217635_2_.getQuads(p_217635_3_, (Direction)null, p_217635_7_, modelData); + 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); if (!list1.isEmpty()) { - this.func_217636_a(p_217635_1_, p_217635_3_, p_217635_4_, -1, true, p_217635_5_, 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); flag = true; -@@ -113,6 +129,13 @@ - p_217630_8_.func_217629_a(p_217630_1_, p_217630_2_, p_217630_3_, bakedquad.func_178210_d(), p_217630_6_, p_217630_7_); - p_217630_4_.func_178981_a(bakedquad.func_178209_a()); - p_217630_4_.func_178962_a(p_217630_8_.field_178207_c[0], p_217630_8_.field_178207_c[1], p_217630_8_.field_178207_c[2], p_217630_8_.field_178207_c[3]); -+ if(bakedquad.shouldApplyDiffuseLighting()) { -+ float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d()); -+ p_217630_8_.field_178206_b[0] *= diffuse; -+ p_217630_8_.field_178206_b[1] *= diffuse; -+ p_217630_8_.field_178206_b[2] *= diffuse; -+ p_217630_8_.field_178206_b[3] *= diffuse; -+ } - if (bakedquad.func_178212_b()) { - int k = this.field_187499_a.func_216860_a(p_217630_2_, p_217630_1_, p_217630_3_, bakedquad.func_178211_c()); - float f = (float)(k >> 16 & 255) / 255.0F; -@@ -222,10 +245,22 @@ - float f = (float)(k >> 16 & 255) / 255.0F; - float f1 = (float)(k >> 8 & 255) / 255.0F; - float f2 = (float)(k & 255) / 255.0F; -+ if(bakedquad.shouldApplyDiffuseLighting()) { -+ float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d()); -+ f *= diffuse; -+ f1 *= diffuse; -+ f2 *= diffuse; -+ } - p_217636_6_.func_178978_a(f, f1, f2, 4); - p_217636_6_.func_178978_a(f, f1, f2, 3); - p_217636_6_.func_178978_a(f, f1, f2, 2); - p_217636_6_.func_178978_a(f, f1, f2, 1); -+ } else if(bakedquad.shouldApplyDiffuseLighting()) { -+ float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d()); -+ p_217636_6_.func_178978_a(diffuse, diffuse, diffuse, 4); -+ p_217636_6_.func_178978_a(diffuse, diffuse, diffuse, 3); -+ p_217636_6_.func_178978_a(diffuse, diffuse, diffuse, 2); -+ p_217636_6_.func_178978_a(diffuse, diffuse, diffuse, 1); - } +@@ -208,7 +222,11 @@ + + } + ++ @Deprecated //Forge: Model data argument + public void func_228804_a_(MatrixStack.Entry p_228804_1_, IVertexBuilder p_228804_2_, @Nullable BlockState p_228804_3_, IBakedModel p_228804_4_, float p_228804_5_, float p_228804_6_, float p_228804_7_, int p_228804_8_, int p_228804_9_) { ++ renderModel(p_228804_1_, p_228804_2_, p_228804_3_, p_228804_4_, p_228804_5_, p_228804_6_, p_228804_7_, p_228804_8_, p_228804_9_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ } ++ public void renderModel(MatrixStack.Entry p_228804_1_, IVertexBuilder p_228804_2_, @Nullable BlockState p_228804_3_, IBakedModel p_228804_4_, float p_228804_5_, float p_228804_6_, float p_228804_7_, int p_228804_8_, int p_228804_9_, net.minecraftforge.client.model.data.IModelData modelData) { + Random random = new Random(); + long i = 42L; - p_217636_6_.func_178987_a(d0, d1, d2); diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch index 27c736447..937d9f96b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch @@ -6,7 +6,8 @@ + @Deprecated public TextureAtlasSprite func_178122_a(BlockState p_178122_1_) { - return this.func_178125_b(p_178122_1_).func_177554_e(); +- return this.func_178125_b(p_178122_1_).func_177554_e(); ++ return this.func_178125_b(p_178122_1_).getParticleTexture(net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); } + public TextureAtlasSprite getTexture(BlockState state, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) { diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch index 6fb67bc0f..65ac0f6b4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -1,42 +1,56 @@ --- a/net/minecraft/client/renderer/BlockRendererDispatcher.java +++ b/net/minecraft/client/renderer/BlockRendererDispatcher.java -@@ -28,7 +28,7 @@ - - public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_) { - this.field_175028_a = p_i46577_1_; -- this.field_175027_c = new BlockModelRenderer(p_i46577_2_); -+ this.field_175027_c = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(p_i46577_2_); - this.field_175025_e = new FluidBlockRenderer(); +@@ -40,18 +40,26 @@ + return this.field_175028_a; } -@@ -40,12 +40,16 @@ - if (p_215329_1_.func_185901_i() == BlockRenderType.MODEL) { - IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_215329_1_); - long i = p_215329_1_.func_209533_a(p_215329_2_); -- IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(p_215329_1_, ibakedmodel, p_215329_3_, this.field_195476_e, i)).func_177645_b(); -+ IBakedModel ibakedmodel1 = net.minecraftforge.client.ForgeHooksClient.getDamageModel(ibakedmodel, p_215329_3_, p_215329_1_, p_215329_4_, p_215329_2_, i); - this.field_175027_c.func_217631_a(p_215329_4_, ibakedmodel1, p_215329_1_, p_215329_2_, Tessellator.func_178181_a().func_178180_c(), true, this.field_195476_e, i); ++ @Deprecated //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_); +- 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); } } + @Deprecated //Forge: Model parameter - public boolean func_215330_a(BlockState p_215330_1_, BlockPos p_215330_2_, IEnviromentBlockReader p_215330_3_, BufferBuilder p_215330_4_, Random p_215330_5_) { -+ return renderBlock(p_215330_1_, p_215330_2_, p_215330_3_, p_215330_4_, p_215330_5_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public boolean 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 renderBlock(BlockState p_215330_1_, BlockPos p_215330_2_, IEnviromentBlockReader p_215330_3_, BufferBuilder p_215330_4_, Random p_215330_5_, net.minecraftforge.client.model.data.IModelData modelData) { ++ 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) { try { - BlockRenderType blockrendertype = p_215330_1_.func_185901_i(); - if (blockrendertype == BlockRenderType.INVISIBLE) { -@@ -53,7 +57,7 @@ - } else { - switch(blockrendertype) { - case MODEL: -- return this.field_175027_c.func_217631_a(p_215330_3_, this.func_184389_a(p_215330_1_), p_215330_1_, p_215330_2_, p_215330_4_, true, p_215330_5_, p_215330_1_.func_209533_a(p_215330_2_)); -+ return this.field_175027_c.renderModel(p_215330_3_, this.func_184389_a(p_215330_1_), p_215330_1_, p_215330_2_, p_215330_4_, true, p_215330_5_, p_215330_1_.func_209533_a(p_215330_2_), modelData); - case ENTITYBLOCK_ANIMATED: - return false; - default: -@@ -105,4 +109,9 @@ + 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); + } 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 @@ + return this.field_175028_a.func_178125_b(p_184389_1_); + } + ++ @Deprecated //Forge: Model parameter + public void func_228791_a_(BlockState p_228791_1_, MatrixStack p_228791_2_, IRenderTypeBuffer p_228791_3_, int p_228791_4_, int p_228791_5_) { ++ renderBlock(p_228791_1_, p_228791_2_, p_228791_3_, p_228791_4_, p_228791_5_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ } ++ public void renderBlock(BlockState p_228791_1_, MatrixStack p_228791_2_, IRenderTypeBuffer p_228791_3_, int p_228791_4_, int p_228791_5_, net.minecraftforge.client.model.data.IModelData modelData) { + BlockRenderType blockrendertype = p_228791_1_.func_185901_i(); + if (blockrendertype != BlockRenderType.INVISIBLE) { + switch(blockrendertype) { +@@ -89,7 +101,7 @@ + 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); + 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_); +@@ -101,4 +113,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 f85739627..82c1ebf60 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BufferBuilder.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BufferBuilder.java.patch @@ -1,58 +1,25 @@ --- a/net/minecraft/client/renderer/BufferBuilder.java +++ b/net/minecraft/client/renderer/BufferBuilder.java -@@ -120,7 +120,8 @@ +@@ -121,7 +121,6 @@ - bitset.set(i1); + bitset.set(l); } - -+ this.field_178999_b.limit(this.field_178999_b.capacity()); -+ this.field_178999_b.position(this.func_181664_j()); } - public BufferBuilder.State func_181672_a() { -@@ -459,15 +460,15 @@ - break; - case USHORT: - case SHORT: -- this.field_179001_a.putShort(i, (short)((int)p_181663_1_ * 32767 & '\uffff')); -- this.field_179001_a.putShort(i + 2, (short)((int)p_181663_2_ * 32767 & '\uffff')); -- this.field_179001_a.putShort(i + 4, (short)((int)p_181663_3_ * 32767 & '\uffff')); -+ this.field_179001_a.putShort(i, (short)((int)(p_181663_1_ * Short.MAX_VALUE) & 0xFFFF)); -+ this.field_179001_a.putShort(i + 2, (short)((int)(p_181663_2_ * Short.MAX_VALUE) & 0xFFFF)); -+ this.field_179001_a.putShort(i + 4, (short)((int)(p_181663_3_ * Short.MAX_VALUE) & 0xFFFF)); - break; - case UBYTE: - case BYTE: -- this.field_179001_a.put(i, (byte)((int)p_181663_1_ * 127 & 255)); -- this.field_179001_a.put(i + 1, (byte)((int)p_181663_2_ * 127 & 255)); -- this.field_179001_a.put(i + 2, (byte)((int)p_181663_3_ * 127 & 255)); -+ this.field_179001_a.put(i, (byte)((int)(p_181663_1_ * Byte.MAX_VALUE) & 0xFF)); -+ this.field_179001_a.put(i + 1, (byte)((int)(p_181663_2_ * Byte.MAX_VALUE) & 0xFF)); -+ this.field_179001_a.put(i + 2, (byte)((int)(p_181663_3_ * Byte.MAX_VALUE) & 0xFF)); - } - - this.func_181667_k(); -@@ -542,4 +543,23 @@ - return this.field_179018_e; + private void func_227829_a_(FloatBuffer p_227829_1_, int p_227829_2_) { +@@ -364,4 +363,14 @@ + this.field_179018_e = p_i225907_2_; } } -+ -+ //For some unknown reason Mojang changed the vanilla function to hardcode alpha as 255.... So lets re-add the parameter -.- -+ public void putColorRGBA(int index, int red, int green, int blue, int alpha) { -+ if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) -+ this.field_178999_b.put(index, alpha << 24 | blue << 16 | green << 8 | red); -+ else -+ this.field_178999_b.put(index, red << 24 | green << 16 | blue << 8 | alpha); -+ } -+ -+ public boolean isColorDisabled() { -+ return field_78939_q; -+ } -+ ++ + public void putBulkData(ByteBuffer buffer) { + func_181670_b(buffer.limit() + this.field_179011_q.func_177338_f()); + this.field_179001_a.position(this.field_178997_d * this.field_179011_q.func_177338_f()); + this.field_179001_a.put(buffer); + this.field_178997_d += buffer.limit() / this.field_179011_q.func_177338_f(); + } ++ ++ // Forge start ++ public VertexFormat getVertexFormat() { return this.field_179011_q; } } diff --git a/patches/minecraft/net/minecraft/client/renderer/ChestRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ChestRenderer.java.patch deleted file mode 100644 index 03689c3c1..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/ChestRenderer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/renderer/ChestRenderer.java -+++ b/net/minecraft/client/renderer/ChestRenderer.java -@@ -12,6 +12,7 @@ - public void func_178175_a(Block p_178175_1_, float p_178175_2_) { - GlStateManager.color4f(p_178175_2_, p_178175_2_, p_178175_2_, 1.0F); - GlStateManager.rotatef(90.0F, 0.0F, 1.0F, 0.0F); -- ItemStackTileEntityRenderer.field_147719_a.func_179022_a(new ItemStack(p_178175_1_)); -+ ItemStack stack = new ItemStack(p_178175_1_); -+ stack.func_77973_b().getTileEntityItemStackRenderer().func_179022_a(stack); - } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch index a7515be5b..6e1dd4af6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch @@ -1,119 +1,90 @@ --- a/net/minecraft/client/renderer/FirstPersonRenderer.java +++ b/net/minecraft/client/renderer/FirstPersonRenderer.java -@@ -276,7 +276,7 @@ +@@ -208,7 +208,7 @@ boolean flag1 = true; - if (abstractclientplayerentity.func_184587_cr()) { - ItemStack itemstack = abstractclientplayerentity.func_184607_cu(); + if (p_228396_4_.func_184587_cr()) { + ItemStack itemstack = p_228396_4_.func_184607_cu(); - if (itemstack.func_77973_b() == Items.field_151031_f || itemstack.func_77973_b() == Items.field_222114_py) { + if (itemstack.func_77973_b() instanceof net.minecraft.item.ShootableItem) { - flag = abstractclientplayerentity.func_184600_cs() == Hand.MAIN_HAND; + flag = p_228396_4_.func_184600_cs() == Hand.MAIN_HAND; flag1 = !flag; } -@@ -284,18 +284,18 @@ - Hand hand1 = abstractclientplayerentity.func_184600_cs(); +@@ -216,18 +216,18 @@ + Hand hand1 = p_228396_4_.func_184600_cs(); if (hand1 == Hand.MAIN_HAND) { - ItemStack itemstack1 = abstractclientplayerentity.func_184592_cb(); + ItemStack itemstack1 = p_228396_4_.func_184592_cb(); - if (itemstack1.func_77973_b() == Items.field_222114_py && CrossbowItem.func_220012_d(itemstack1)) { -+ if (itemstack1.func_77973_b() instanceof net.minecraft.item.CrossbowItem && CrossbowItem.func_220012_d(itemstack1)) { ++ if (itemstack1.func_77973_b() instanceof CrossbowItem && CrossbowItem.func_220012_d(itemstack1)) { flag1 = false; } } } else { - ItemStack itemstack2 = abstractclientplayerentity.func_184614_ca(); - ItemStack itemstack3 = abstractclientplayerentity.func_184592_cb(); + ItemStack itemstack2 = p_228396_4_.func_184614_ca(); + ItemStack itemstack3 = p_228396_4_.func_184592_cb(); - if (itemstack2.func_77973_b() == Items.field_222114_py && CrossbowItem.func_220012_d(itemstack2)) { -+ if (itemstack2.func_77973_b() instanceof net.minecraft.item.CrossbowItem && CrossbowItem.func_220012_d(itemstack2)) { ++ if (itemstack2.func_77973_b() instanceof CrossbowItem && CrossbowItem.func_220012_d(itemstack2)) { flag1 = !flag; } - if (itemstack3.func_77973_b() == Items.field_222114_py && CrossbowItem.func_220012_d(itemstack3)) { -+ if (itemstack3.func_77973_b() instanceof net.minecraft.item.CrossbowItem && CrossbowItem.func_220012_d(itemstack3)) { ++ if (itemstack3.func_77973_b() instanceof CrossbowItem && CrossbowItem.func_220012_d(itemstack3)) { flag = !itemstack2.func_190926_b(); flag1 = !flag; } -@@ -308,12 +308,14 @@ +@@ -240,12 +240,14 @@ if (flag) { - float f3 = hand == Hand.MAIN_HAND ? f : 0.0F; - float f5 = 1.0F - MathHelper.func_219799_g(p_78440_1_, this.field_187470_g, this.field_187469_f); -+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.MAIN_HAND, p_78440_1_, f1, f3, f5, this.field_187467_d)) - this.func_187457_a(abstractclientplayerentity, p_78440_1_, f1, Hand.MAIN_HAND, f3, this.field_187467_d, f5); + 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); ++ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.MAIN_HAND, p_228396_2_, p_228396_1_, f1, f3, f5, this.field_187467_d)) + this.func_228405_a_(p_228396_4_, p_228396_1_, f1, Hand.MAIN_HAND, f5, this.field_187467_d, f2, p_228396_2_, p_228396_3_, p_228396_5_); } if (flag1) { - float f4 = hand == Hand.OFF_HAND ? f : 0.0F; - float f6 = 1.0F - MathHelper.func_219799_g(p_78440_1_, this.field_187472_i, this.field_187471_h); -+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.OFF_HAND, p_78440_1_, f1, f4, f6, this.field_187468_e)) - this.func_187457_a(abstractclientplayerentity, p_78440_1_, f1, Hand.OFF_HAND, f4, this.field_187468_e, f6); + float f6 = hand == Hand.OFF_HAND ? f : 0.0F; + float f7 = 1.0F - MathHelper.func_219799_g(p_228396_1_, this.field_187472_i, this.field_187471_h); ++ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.OFF_HAND, p_228396_2_, p_228396_1_, f1, f4, f6, this.field_187468_e)) + 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_); } -@@ -329,7 +331,7 @@ - if (flag && !p_187457_1_.func_82150_aj()) { - this.func_187456_a(p_187457_7_, p_187457_5_, handside); +@@ -260,13 +262,13 @@ + if (flag && !p_228405_1_.func_82150_aj()) { + this.func_228401_a_(p_228405_8_, p_228405_9_, p_228405_10_, p_228405_7_, p_228405_5_, handside); } -- } else if (p_187457_6_.func_77973_b() == Items.field_151098_aY) { -+ } else if (p_187457_6_.func_77973_b() instanceof net.minecraft.item.FilledMapItem) { +- } else if (p_228405_6_.func_77973_b() == Items.field_151098_aY) { ++ } else if (p_228405_6_.func_77973_b() instanceof FilledMapItem) { if (flag && this.field_187468_e.func_190926_b()) { - this.func_187463_a(p_187457_3_, p_187457_7_, p_187457_5_); + this.func_228400_a_(p_228405_8_, p_228405_9_, p_228405_10_, p_228405_3_, p_228405_7_, p_228405_5_); } else { -@@ -465,6 +467,7 @@ - if (this.field_78455_a.field_71439_g.func_70094_T()) { - BlockState blockstate = this.field_78455_a.field_71441_e.func_180495_p(new BlockPos(this.field_78455_a.field_71439_g)); - PlayerEntity playerentity = this.field_78455_a.field_71439_g; -+ BlockPos overlayPos = new BlockPos(this.field_78455_a.field_71439_g); - - for(int i = 0; i < 8; ++i) { - double d0 = playerentity.field_70165_t + (double)(((float)((i >> 0) % 2) - 0.5F) * playerentity.func_213311_cf() * 0.8F); -@@ -474,20 +477,24 @@ - BlockState blockstate1 = this.field_78455_a.field_71441_e.func_180495_p(blockpos); - if (blockstate1.func_215696_m(this.field_78455_a.field_71441_e, blockpos)) { - blockstate = blockstate1; -+ overlayPos = blockpos; - } + this.func_228402_a_(p_228405_8_, p_228405_9_, p_228405_10_, p_228405_7_, handside, p_228405_5_, p_228405_6_); } - - if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) { -- this.func_178108_a(this.field_78455_a.func_175602_ab().func_175023_a().func_178122_a(blockstate)); -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, blockstate, overlayPos)) -+ this.func_178108_a(this.field_78455_a.func_175602_ab().func_175023_a().getTexture(blockstate, field_78455_a.field_71441_e, overlayPos)); - } - } - - if (!this.field_78455_a.field_71439_g.func_175149_v()) { - if (this.field_78455_a.field_71439_g.func_208600_a(FluidTags.field_206959_a)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(field_78455_a.field_71439_g, p_78447_1_)) - this.func_78448_c(p_78447_1_); - } - - if (this.field_78455_a.field_71439_g.func_70027_ad()) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(field_78455_a.field_71439_g, p_78447_1_)) - this.func_78442_d(); - } - } -@@ -544,6 +551,7 @@ - bufferbuilder.func_181662_b(1.0D, 1.0D, -0.5D).func_187315_a((double)(0.0F + f7), (double)(0.0F + f8)).func_181675_d(); - bufferbuilder.func_181662_b(-1.0D, 1.0D, -0.5D).func_187315_a((double)(4.0F + f7), (double)(0.0F + f8)).func_181675_d(); - tessellator.func_78381_a(); -+ - GlStateManager.popMatrix(); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableBlend(); -@@ -600,8 +608,17 @@ +- } else if (p_228405_6_.func_77973_b() == Items.field_222114_py) { ++ } else if (p_228405_6_.func_77973_b() instanceof CrossbowItem) { + boolean flag1 = CrossbowItem.func_220012_d(p_228405_6_); + boolean flag2 = handside == HandSide.RIGHT; + int i = flag2 ? 1 : -1; +@@ -402,8 +404,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); + + if (!requipM && !Objects.equals(this.field_187467_d, itemstack)) -+ this.field_187467_d = itemstack; ++ this.field_187467_d = itemstack; + if (!requipO && !Objects.equals(this.field_187468_e, itemstack1)) -+ 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); } if (this.field_187469_f < 0.1F) { +@@ -422,6 +432,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 2afa35890..0b6b1dcc8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch @@ -1,77 +1,94 @@ --- a/net/minecraft/client/renderer/FluidBlockRenderer.java +++ b/net/minecraft/client/renderer/FluidBlockRenderer.java -@@ -58,8 +58,9 @@ +@@ -57,8 +57,9 @@ - public boolean func_217638_a(IEnviromentBlockReader p_217638_1_, BlockPos p_217638_2_, BufferBuilder p_217638_3_, IFluidState p_217638_4_) { - boolean flag = p_217638_4_.func_206884_a(FluidTags.field_206960_b); + public boolean func_228796_a_(ILightReader p_228796_1_, BlockPos p_228796_2_, IVertexBuilder p_228796_3_, IFluidState 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_217612_c(p_217638_1_, p_217638_2_); -+ TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_217638_1_, p_217638_2_, p_217638_4_); -+ int i = p_217638_4_.func_206886_c().getAttributes().getColor(p_217638_1_, p_217638_2_); +- 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_); + 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; -@@ -145,15 +146,15 @@ - float f24 = 1.0F * f; - float f25 = 1.0F * f1; - float f26 = 1.0F * f2; -- p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f12, (double)f16).func_187314_a(k, l).func_181675_d(); -- p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f13, (double)f17).func_187314_a(k, l).func_181675_d(); -- p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f14, (double)f18).func_187314_a(k, l).func_181675_d(); -- p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f15, (double)f19).func_187314_a(k, l).func_181675_d(); -+ p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f12, (double)f16).func_187314_a(k, l).func_181675_d(); -+ p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f13, (double)f17).func_187314_a(k, l).func_181675_d(); -+ p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f14, (double)f18).func_187314_a(k, l).func_181675_d(); -+ p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f15, (double)f19).func_187314_a(k, l).func_181675_d(); - if (p_217638_4_.func_205586_a(p_217638_1_, p_217638_2_.func_177984_a())) { -- p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f12, (double)f16).func_187314_a(k, l).func_181675_d(); -- p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f15, (double)f19).func_187314_a(k, l).func_181675_d(); -- p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f14, (double)f18).func_187314_a(k, l).func_181675_d(); -- p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f13, (double)f17).func_187314_a(k, l).func_181675_d(); -+ p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f12, (double)f16).func_187314_a(k, l).func_181675_d(); -+ p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f15, (double)f19).func_187314_a(k, l).func_181675_d(); -+ p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f14, (double)f18).func_187314_a(k, l).func_181675_d(); -+ p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f13, (double)f17).func_187314_a(k, l).func_181675_d(); +@@ -143,15 +144,15 @@ + float f25 = 1.0F * f; + float f26 = 1.0F * f1; + float f27 = 1.0F * f2; +- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j); +- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j); +- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j); +- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, f16, f20, j); ++ this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, alpha, f13, f17, j); ++ this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, alpha, f14, f18, j); ++ this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, alpha, f15, f19, j); ++ this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, alpha, f16, f20, j); + if (p_228796_4_.func_205586_a(p_228796_1_, p_228796_2_.func_177984_a())) { +- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j); +- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, f16, f20, j); +- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j); +- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j); ++ this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, alpha, f13, f17, j); ++ this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, alpha, f16, f20, j); ++ this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, alpha, f15, f19, j); ++ this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, alpha, f14, f18, j); } } -@@ -168,10 +169,10 @@ - float f37 = 0.5F * f; - float f38 = 0.5F * f1; - float f40 = 0.5F * f2; -- p_217638_3_.func_181662_b(d0, d1, d2 + 1.0D).func_181666_a(f37, f38, f40, 1.0F).func_187315_a((double)f31, (double)f36).func_187314_a(j2, k2).func_181675_d(); -- p_217638_3_.func_181662_b(d0, d1, d2).func_181666_a(f37, f38, f40, 1.0F).func_187315_a((double)f31, (double)f34).func_187314_a(j2, k2).func_181675_d(); -- p_217638_3_.func_181662_b(d0 + 1.0D, d1, d2).func_181666_a(f37, f38, f40, 1.0F).func_187315_a((double)f32, (double)f34).func_187314_a(j2, k2).func_181675_d(); -- p_217638_3_.func_181662_b(d0 + 1.0D, d1, d2 + 1.0D).func_181666_a(f37, f38, f40, 1.0F).func_187315_a((double)f32, (double)f36).func_187314_a(j2, k2).func_181675_d(); -+ p_217638_3_.func_181662_b(d0, d1, d2 + 1.0D).func_181666_a(f37, f38, f40, alpha).func_187315_a((double)f31, (double)f36).func_187314_a(j2, k2).func_181675_d(); -+ p_217638_3_.func_181662_b(d0, d1, d2).func_181666_a(f37, f38, f40, alpha).func_187315_a((double)f31, (double)f34).func_187314_a(j2, k2).func_181675_d(); -+ p_217638_3_.func_181662_b(d0 + 1.0D, d1, d2).func_181666_a(f37, f38, f40, alpha).func_187315_a((double)f32, (double)f34).func_187314_a(j2, k2).func_181675_d(); -+ p_217638_3_.func_181662_b(d0 + 1.0D, d1, d2 + 1.0D).func_181666_a(f37, f38, f40, alpha).func_187315_a((double)f32, (double)f36).func_187314_a(j2, k2).func_181675_d(); +@@ -164,10 +165,10 @@ + float f40 = 0.5F * f; + float f41 = 0.5F * f1; + float f42 = 0.5F * f2; +- this.func_228797_a_(p_228796_3_, d0, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, f34, f39, i1); +- this.func_228797_a_(p_228796_3_, d0, d1 + (double)f12, d2, f40, f41, f42, f34, f37, i1); +- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2, f40, f41, f42, f35, f37, i1); +- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, f35, f39, i1); ++ this.func_228797_a_(p_228796_3_, d0, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, alpha, f34, f39, i1); ++ this.func_228797_a_(p_228796_3_, d0, d1 + (double)f12, d2, f40, f41, f42, alpha, f34, f37, i1); ++ this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2, f40, f41, f42, alpha, f35, f37, i1); ++ this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, alpha, f35, f39, i1); flag7 = true; } -@@ -245,15 +246,15 @@ - float f28 = 1.0F * f27 * f; - float f29 = 1.0F * f27 * f1; - float f30 = 1.0F * f27 * f2; -- p_217638_3_.func_181662_b(d3, d1 + (double)f33, d4).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f45, (double)f47).func_187314_a(j1, k1).func_181675_d(); -- p_217638_3_.func_181662_b(d5, d1 + (double)f35, d6).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f46, (double)f48).func_187314_a(j1, k1).func_181675_d(); -- p_217638_3_.func_181662_b(d5, d1 + 0.0D, d6).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f46, (double)f49).func_187314_a(j1, k1).func_181675_d(); -- p_217638_3_.func_181662_b(d3, d1 + 0.0D, d4).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f45, (double)f49).func_187314_a(j1, k1).func_181675_d(); -+ p_217638_3_.func_181662_b(d3, d1 + (double)f33, d4).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f45, (double)f47).func_187314_a(j1, k1).func_181675_d(); -+ p_217638_3_.func_181662_b(d5, d1 + (double)f35, d6).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f46, (double)f48).func_187314_a(j1, k1).func_181675_d(); -+ p_217638_3_.func_181662_b(d5, d1 + 0.0D, d6).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f46, (double)f49).func_187314_a(j1, k1).func_181675_d(); -+ p_217638_3_.func_181662_b(d3, d1 + 0.0D, d4).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f45, (double)f49).func_187314_a(j1, k1).func_181675_d(); +@@ -239,15 +240,15 @@ + float f31 = 1.0F * f30 * f; + float f32 = 1.0F * f30 * f1; + float f33 = 1.0F * 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); +- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, f48, f29, k); ++ this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, alpha, f48, f50, k); ++ this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, alpha, f49, f28, k); ++ this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, alpha, f49, f29, k); ++ this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, alpha, f48, f29, k); if (textureatlassprite2 != this.field_187501_d) { -- p_217638_3_.func_181662_b(d3, d1 + 0.0D, d4).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f45, (double)f49).func_187314_a(j1, k1).func_181675_d(); -- p_217638_3_.func_181662_b(d5, d1 + 0.0D, d6).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f46, (double)f49).func_187314_a(j1, k1).func_181675_d(); -- p_217638_3_.func_181662_b(d5, d1 + (double)f35, d6).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f46, (double)f48).func_187314_a(j1, k1).func_181675_d(); -- p_217638_3_.func_181662_b(d3, d1 + (double)f33, d4).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f45, (double)f47).func_187314_a(j1, k1).func_181675_d(); -+ p_217638_3_.func_181662_b(d3, d1 + 0.0D, d4).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f45, (double)f49).func_187314_a(j1, k1).func_181675_d(); -+ p_217638_3_.func_181662_b(d5, d1 + 0.0D, d6).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f46, (double)f49).func_187314_a(j1, k1).func_181675_d(); -+ p_217638_3_.func_181662_b(d5, d1 + (double)f35, d6).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f46, (double)f48).func_187314_a(j1, k1).func_181675_d(); -+ p_217638_3_.func_181662_b(d3, d1 + (double)f33, d4).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f45, (double)f47).func_187314_a(j1, k1).func_181675_d(); +- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, f48, f29, k); +- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, f49, f29, k); +- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, f49, f28, k); +- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, f48, f50, k); ++ this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, alpha, f48, f29, k); ++ this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, alpha, f49, f29, k); ++ this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, alpha, f49, f28, k); ++ this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, alpha, f48, f50, k); } } } +@@ -256,10 +257,15 @@ + } + } + ++ @Deprecated + private void func_228797_a_(IVertexBuilder p_228797_1_, double p_228797_2_, double p_228797_4_, double p_228797_6_, float p_228797_8_, float p_228797_9_, float p_228797_10_, float p_228797_11_, float p_228797_12_, int p_228797_13_) { +- p_228797_1_.func_225582_a_(p_228797_2_, p_228797_4_, p_228797_6_).func_227885_a_(p_228797_8_, p_228797_9_, p_228797_10_, 1.0F).func_225583_a_(p_228797_11_, p_228797_12_).func_227886_a_(p_228797_13_).func_225584_a_(0.0F, 1.0F, 0.0F).func_181675_d(); ++ func_228797_a_(p_228797_1_, p_228797_2_, p_228797_4_, p_228797_6_, p_228797_8_, p_228797_9_, p_228797_10_, 1.0F, p_228797_11_, p_228797_12_, p_228797_13_); + } + ++ private void func_228797_a_(IVertexBuilder p_228797_1_, double p_228797_2_, double p_228797_4_, double p_228797_6_, float p_228797_8_, float p_228797_9_, float p_228797_10_, float alpha, float p_228797_11_, float p_228797_12_, int p_228797_13_) { ++ p_228797_1_.func_225582_a_(p_228797_2_, p_228797_4_, p_228797_6_).func_227885_a_(p_228797_8_, p_228797_9_, p_228797_10_, alpha).func_225583_a_(p_228797_11_, p_228797_12_).func_227886_a_(p_228797_13_).func_225584_a_(0.0F, 1.0F, 0.0F).func_181675_d(); ++ } ++ + private int func_228795_a_(ILightReader 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 3a118390c..04b37f3a4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch @@ -1,62 +1,60 @@ --- a/net/minecraft/client/renderer/FogRenderer.java +++ b/net/minecraft/client/renderer/FogRenderer.java -@@ -101,6 +101,9 @@ - f3 = 1.0F / this.field_205095_e; +@@ -150,17 +150,28 @@ } + float f9 = Math.min(1.0F / field_205093_c, Math.min(1.0F / field_205094_d, 1.0F / field_205095_e)); + // Forge: fix MC-4647 and MC-10480 -+ if (Float.isInfinite(f3)) f3 = Math.nextAfter(f3, 0.0); -+ - this.field_205093_c = this.field_205093_c * (1.0F - f1) + this.field_205093_c * f3 * f1; - this.field_205094_d = this.field_205094_d * (1.0F - f1) + this.field_205094_d * f3 * f1; - this.field_205095_e = this.field_205095_e * (1.0F - f1) + this.field_205095_e * f3 * f1; -@@ -115,11 +118,21 @@ - f4 = 1.0F / this.field_205095_e; - } - ++ if (Float.isInfinite(f9)) f9 = Math.nextAfter(f9, 0.0); + field_205093_c = field_205093_c * (1.0F - f6) + field_205093_c * f9 * f6; + field_205094_d = field_205094_d * (1.0F - f6) + field_205094_d * f9 * f6; + field_205095_e = field_205095_e * (1.0F - f6) + field_205095_e * f9 * f6; + } else if (p_228371_0_.func_216773_g() instanceof LivingEntity && ((LivingEntity)p_228371_0_.func_216773_g()).func_70644_a(Effects.field_76439_r)) { + float f7 = GameRenderer.func_180438_a((LivingEntity)p_228371_0_.func_216773_g(), p_228371_1_); + float f10 = Math.min(1.0F / field_205093_c, Math.min(1.0F / field_205094_d, 1.0F / field_205095_e)); + // Forge: fix MC-4647 and MC-10480 -+ if (Float.isInfinite(f4)) f4 = Math.nextAfter(f4, 0.0); -+ - this.field_205093_c = this.field_205093_c * (1.0F - f2) + this.field_205093_c * f4 * f2; - this.field_205094_d = this.field_205094_d * (1.0F - f2) + this.field_205094_d * f4 * f2; - this.field_205095_e = this.field_205095_e * (1.0F - f2) + this.field_205095_e * f4 * f2; ++ if (Float.isInfinite(f10)) f10 = Math.nextAfter(f10, 0.0); + field_205093_c = field_205093_c * (1.0F - f7) + field_205093_c * f10 * f7; + field_205094_d = field_205094_d * (1.0F - f7) + field_205094_d * f10 * f7; + field_205095_e = field_205095_e * (1.0F - f7) + field_205095_e * f10 * f7; } -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, this.field_205104_n, p_217619_1_, p_217619_2_, this.field_205093_c, this.field_205094_d, this.field_205095_e); ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(p_228371_0_, p_228371_1_, field_205093_c, field_205094_d, field_205095_e); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + -+ this.field_205093_c = event.getRed(); -+ this.field_205094_d = event.getGreen(); -+ this.field_205095_e = event.getBlue(); ++ field_205093_c = event.getRed(); ++ field_205094_d = event.getGreen(); ++ field_205095_e = event.getBlue(); + - GlStateManager.clearColor(this.field_205093_c, this.field_205094_d, this.field_205095_e, 0.0F); + RenderSystem.clearColor(field_205093_c, field_205094_d, field_205095_e, 0.0F); } -@@ -205,11 +218,19 @@ - +@@ -169,10 +180,18 @@ + RenderSystem.fogMode(GlStateManager.FogMode.EXP2); } -+ @Deprecated //Forge: pass in partial ticks to setupFog - public void func_217618_a(ActiveRenderInfo p_217618_1_, int p_217618_2_) { -+ setupFog(p_217618_1_, p_217618_2_, 0F); ++ @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 void setupFog(ActiveRenderInfo p_217618_1_, int p_217618_2_, float partialTicks) { - this.func_205090_a(false); - GlStateManager.normal3f(0.0F, -1.0F, 0.0F); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - IFluidState ifluidstate = p_217618_1_.func_216771_k(); -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, this.field_205104_n, p_217618_1_, partialTicks, 0.1F); -+ if (hook >= 0) GlStateManager.fogDensity(hook); ++ 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(); + Entity entity = p_228372_0_.func_216773_g(); + boolean flag = ifluidstate.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 (p_217618_1_.func_216773_g() instanceof LivingEntity && ((LivingEntity)p_217618_1_.func_216773_g()).func_70644_a(Effects.field_76440_q)) { - float f2 = 5.0F; - int i = ((LivingEntity)p_217618_1_.func_216773_g()).func_70660_b(Effects.field_76440_q).func_76459_b(); -@@ -264,6 +285,7 @@ - GlStateManager.fogStart(f1 * 0.05F); - GlStateManager.fogEnd(Math.min(f1, 192.0F) * 0.5F); - } -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, this.field_205104_n, p_217618_1_, partialTicks, p_217618_2_, f1); + if (flag) { + float f = 1.0F; + if (ifluidstate.func_206884_a(FluidTags.field_206959_a)) { +@@ -219,8 +238,8 @@ + RenderSystem.fogEnd(f3); + RenderSystem.fogMode(GlStateManager.FogMode.LINEAR); + RenderSystem.setupNvFogDistance(); ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(p_228372_1_, p_228372_0_, partialTicks, f3); } +- + } - GlStateManager.enableColorMaterial(); + public static void func_228373_b_() { diff --git a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch index fb634f557..73c900e43 100644 --- a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/renderer/GameRenderer.java +++ b/net/minecraft/client/renderer/GameRenderer.java -@@ -170,6 +170,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")); -+ } else { -+ net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_175066_1_, this); - } - +@@ -131,6 +131,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")); ++ } else { ++ net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_175066_1_, this); } -@@ -351,7 +353,7 @@ + + } +@@ -306,7 +308,7 @@ d0 = d0 * 60.0D / 70.0D; } @@ -18,130 +18,43 @@ } } -@@ -437,6 +439,7 @@ +@@ -358,6 +360,7 @@ } boolean flag = this.field_78531_r.func_175606_aa() instanceof LivingEntity && ((LivingEntity)this.field_78531_r.func_175606_aa()).func_70608_bn(); -+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(field_78531_r.field_71438_f, p_215308_2_)) ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(field_78531_r.field_71438_f, p_228381_1_, p_228381_3_)) if (this.field_78531_r.field_71474_y.field_74320_O == 0 && !flag && !this.field_78531_r.field_71474_y.field_74319_N && this.field_78531_r.field_71442_b.func_178889_l() != GameType.SPECTATOR) { - this.func_180436_i(); - this.field_78516_c.func_78440_a(p_215308_2_); -@@ -525,6 +528,10 @@ - GlStateManager.matrixMode(5888); - GlStateManager.loadIdentity(); - this.field_78531_r.field_195558_d.func_216522_a(Minecraft.field_142025_a); -+ // Forge: Fix MC-112292 -+ net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.field_147556_a.field_147553_e = this.field_78531_r.func_110434_K(); -+ // Forge: also fix rendering text before entering world (not part of MC-112292, but the same reason) -+ net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.field_147556_a.field_147557_n = this.field_78531_r.field_71466_p; - } - - if (this.field_78531_r.field_213279_p != null) { -@@ -544,7 +551,7 @@ - GlStateManager.clear(256, Minecraft.field_142025_a); - + this.field_78513_d.func_205109_c(); + this.field_78516_c.func_228396_a_(p_228381_3_, p_228381_1_, this.field_228374_i_.func_228487_b_(), this.field_78531_r.field_71439_g, this.field_78531_r.func_175598_ae().func_229085_a_(this.field_78531_r.field_71439_g, p_228381_3_)); +@@ -475,7 +478,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()); } catch (Throwable throwable) { CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Rendering screen"); CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Screen render details"); -@@ -656,7 +663,7 @@ - double d2 = activerenderinfo.func_216785_c().field_72449_c; - icamera.func_78547_a(d0, d1, d2); - if (this.field_78531_r.field_71474_y.field_151451_c >= 4) { -- this.field_205003_A.func_217618_a(activerenderinfo, -1); -+ this.field_205003_A.setupFog(activerenderinfo, -1, p_181560_1_); - this.field_78531_r.func_213239_aq().func_219895_b("sky"); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); -@@ -669,14 +676,14 @@ - GlStateManager.matrixMode(5888); - } - -- this.field_205003_A.func_217618_a(activerenderinfo, 0); -+ this.field_205003_A.setupFog(activerenderinfo, 0, p_181560_1_); - GlStateManager.shadeModel(7425); - if (activerenderinfo.func_216785_c().field_72448_b < 128.0D) { - this.func_215313_a(activerenderinfo, worldrenderer, p_181560_1_, d0, d1, d2); - } - - this.field_78531_r.func_213239_aq().func_219895_b("prepareterrain"); -- this.field_205003_A.func_217618_a(activerenderinfo, 0); -+ this.field_205003_A.setupFog(activerenderinfo, 0, p_181560_1_); - this.field_78531_r.func_110434_K().func_110577_a(AtlasTexture.field_110575_b); - RenderHelper.func_74518_a(); - this.field_78531_r.func_213239_aq().func_219895_b("terrain_setup"); -@@ -690,7 +697,9 @@ - GlStateManager.disableAlphaTest(); - worldrenderer.func_215323_a(BlockRenderLayer.SOLID, activerenderinfo); - GlStateManager.enableAlphaTest(); -+ this.field_78531_r.func_110434_K().func_110581_b(AtlasTexture.field_110575_b).func_174936_b(false, this.field_78531_r.field_71474_y.field_151442_I > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings - worldrenderer.func_215323_a(BlockRenderLayer.CUTOUT_MIPPED, activerenderinfo); -+ this.field_78531_r.func_110434_K().func_110581_b(AtlasTexture.field_110575_b).func_174935_a(); - this.field_78531_r.func_110434_K().func_110581_b(AtlasTexture.field_110575_b).func_174936_b(false, false); - worldrenderer.func_215323_a(BlockRenderLayer.CUTOUT, activerenderinfo); - this.field_78531_r.func_110434_K().func_110581_b(AtlasTexture.field_110575_b).func_174935_a(); -@@ -709,6 +718,7 @@ - if (flag && this.field_78531_r.field_71476_x != null) { - GlStateManager.disableAlphaTest(); - this.field_78531_r.func_213239_aq().func_219895_b("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(worldrenderer, activerenderinfo, field_78531_r.field_71476_x, 0, p_181560_1_)) - worldrenderer.func_215325_a(activerenderinfo, this.field_78531_r.field_71476_x, 0); - GlStateManager.enableAlphaTest(); - } -@@ -725,7 +735,7 @@ - this.field_78531_r.func_110434_K().func_110581_b(AtlasTexture.field_110575_b).func_174935_a(); - GlStateManager.disableBlend(); - this.func_180436_i(); -- this.field_205003_A.func_217618_a(activerenderinfo, 0); -+ this.field_205003_A.setupFog(activerenderinfo, 0, p_181560_1_); - this.field_78531_r.func_213239_aq().func_219895_b("particles"); - particlemanager.func_215233_a(activerenderinfo, p_181560_1_); - this.func_175072_h(); -@@ -739,7 +749,7 @@ - GlStateManager.enableCull(); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.alphaFunc(516, 0.1F); -- this.field_205003_A.func_217618_a(activerenderinfo, 0); -+ this.field_205003_A.setupFog(activerenderinfo, 0, p_181560_1_); - GlStateManager.enableBlend(); - GlStateManager.depthMask(false); - this.field_78531_r.func_110434_K().func_110577_a(AtlasTexture.field_110575_b); -@@ -756,6 +766,9 @@ - this.func_215313_a(activerenderinfo, worldrenderer, p_181560_1_, d0, d1, d2); - } - -+ this.field_78531_r.func_213239_aq().func_219895_b("forge_render_last"); -+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(worldrenderer, p_181560_1_); +@@ -588,9 +591,16 @@ + Matrix4f matrix4f = matrixstack.func_227866_c_().func_227870_a_(); + this.func_228379_a_(matrix4f); + activerenderinfo.func_216772_a(this.field_78531_r.field_71441_e, (Entity)(this.field_78531_r.func_175606_aa() == null ? this.field_78531_r.field_71439_g : this.field_78531_r.func_175606_aa()), this.field_78531_r.field_71474_y.field_74320_O > 0, this.field_78531_r.field_71474_y.field_74320_O == 2, p_228378_1_); + ++ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup cameraSetup = net.minecraftforge.client.ForgeHooksClient.onCameraSetup(this, activerenderinfo, p_228378_1_); ++ activerenderinfo.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch()); ++ p_228378_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_(cameraSetup.getRoll())); ++ + p_228378_4_.func_227863_a_(Vector3f.field_229179_b_.func_229187_a_(activerenderinfo.func_216777_e())); + p_228378_4_.func_227863_a_(Vector3f.field_229181_d_.func_229187_a_(activerenderinfo.func_216778_f() + 180.0F)); + this.field_78531_r.field_71438_f.func_228426_a_(p_228378_4_, p_228378_1_, p_228378_2_, flag, activerenderinfo, this, this.field_78513_d, matrix4f); ++ this.field_78531_r.func_213239_aq().func_219895_b("forge_render_last"); ++ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(this.field_78531_r.field_71438_f, p_228378_4_, p_228378_2_); this.field_78531_r.func_213239_aq().func_219895_b("hand"); if (this.field_175074_C) { - GlStateManager.clear(256, Minecraft.field_142025_a); -@@ -772,7 +785,7 @@ - GlStateManager.multMatrix(Matrix4f.func_195876_a(this.func_215311_a(p_215313_1_, p_215313_3_, true), (float)this.field_78531_r.field_195558_d.func_198109_k() / (float)this.field_78531_r.field_195558_d.func_198091_l(), 0.05F, this.field_78530_s * 4.0F)); - GlStateManager.matrixMode(5888); - GlStateManager.pushMatrix(); -- this.field_205003_A.func_217618_a(p_215313_1_, 0); -+ this.field_205003_A.setupFog(p_215313_1_, 0, p_215313_3_); - p_215313_2_.func_195466_a(p_215313_3_, p_215313_4_, p_215313_6_, p_215313_8_); - GlStateManager.disableFog(); - GlStateManager.popMatrix(); -@@ -858,6 +871,11 @@ - } - - protected void func_78474_d(float p_78474_1_) { -+ net.minecraftforge.client.IRenderHandler renderer = this.field_78531_r.field_71441_e.func_201675_m().getWeatherRenderer(); -+ if (renderer != null) { -+ renderer.render(this.field_78529_t, p_78474_1_, this.field_78531_r.field_71441_e, this.field_78531_r); -+ return; -+ } - float f = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_); - if (!(f <= 0.0F)) { - this.func_180436_i(); -@@ -1090,4 +1108,9 @@ - public ActiveRenderInfo func_215316_n() { - return this.field_215317_L; + RenderSystem.clear(256, Minecraft.field_142025_a); +@@ -670,4 +680,9 @@ + public OverlayTexture func_228385_m_() { + return this.field_228375_t_; } + + @Override diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch index 6a5c5ca23..dd1f616eb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -4,9 +4,9 @@ public TextureAtlasSprite func_199309_a(ItemStack p_199309_1_) { IBakedModel ibakedmodel = this.func_178089_a(p_199309_1_); -- return (ibakedmodel == this.field_178090_d.func_174951_a() || ibakedmodel.func_188618_c()) && p_199309_1_.func_77973_b() instanceof 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(); +- 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() || ibakedmodel.func_188618_c()) && p_199309_1_.func_77973_b() instanceof BlockItem ? this.field_178090_d.func_174954_c().func_178122_a(((BlockItem)p_199309_1_.func_77973_b()).func_179223_d().func_176223_P()) : ibakedmodel.func_188617_f().func_209581_a(ibakedmodel, p_199309_1_, null, null).func_177554_e(); ++ 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); } 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 27a2d0a51..4536da775 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 -@@ -51,7 +51,7 @@ +@@ -54,7 +54,7 @@ public ItemRenderer(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) { this.field_175057_n = p_i46552_1_; @@ -9,59 +9,36 @@ for(Item item : Registry.field_212630_s) { if (!field_195411_c.contains(item)) { -@@ -75,6 +75,10 @@ +@@ -70,6 +70,10 @@ } - private void func_191967_a(IBakedModel p_191967_1_, int p_191967_2_, ItemStack p_191967_3_) { -+ if (net.minecraftforge.common.ForgeConfig.CLIENT.allowEmissiveItems.get()) { -+ net.minecraftforge.client.ForgeHooksClient.renderLitItem(this, p_191967_1_, p_191967_2_, p_191967_3_); + private void func_229114_a_(IBakedModel p_229114_1_, ItemStack p_229114_2_, int p_229114_3_, int p_229114_4_, MatrixStack p_229114_5_, IVertexBuilder p_229114_6_) { ++ if (false && net.minecraftforge.common.ForgeConfig.CLIENT.allowEmissiveItems.get()) { //TODO: Find way to re-introduce emissive items. ++ net.minecraftforge.client.ForgeHooksClient.renderLitItem(this, p_229114_5_, p_229114_6_, p_229114_1_, p_229114_2_); + return; + } - Tessellator tessellator = Tessellator.func_178181_a(); - BufferBuilder bufferbuilder = tessellator.func_178180_c(); - bufferbuilder.func_181668_a(7, DefaultVertexFormats.field_176599_b); -@@ -98,7 +102,7 @@ - if (p_180454_2_.func_188618_c()) { - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.enableRescaleNormal(); -- ItemStackTileEntityRenderer.field_147719_a.func_179022_a(p_180454_1_); -+ p_180454_1_.func_77973_b().getTileEntityItemStackRenderer().func_179022_a(p_180454_1_); - } else { - this.func_191961_a(p_180454_2_, p_180454_1_); - if (p_180454_1_.func_77962_s()) { -@@ -164,7 +168,7 @@ - k = k | -16777216; + Random random = new Random(); + long i = 42L; + +@@ -91,7 +95,7 @@ + p_229111_8_ = this.field_175059_m.func_178083_a().func_174953_a(new ModelResourceLocation("minecraft:trident#inventory")); } -- this.func_191969_a(p_191970_1_, bakedquad, k); -+ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(p_191970_1_, bakedquad, k); - } +- p_229111_8_.func_177552_f().func_181688_b(p_229111_2_).func_228830_a_(p_229111_3_, p_229111_4_); ++ 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 +109,7 @@ + IVertexBuilder ivertexbuilder = func_229113_a_(p_229111_5_, rendertype1, true, p_229111_1_.func_77962_s()); + 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().getTileEntityItemStackRenderer().func_228364_a_(p_229111_1_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); + } - } -@@ -225,11 +229,8 @@ - GlStateManager.enableBlend(); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.pushMatrix(); -- ItemCameraTransforms itemcameratransforms = p_184394_2_.func_177552_f(); -- ItemCameraTransforms.func_188034_a(itemcameratransforms.func_181688_b(p_184394_3_), p_184394_4_); -- if (this.func_183005_a(itemcameratransforms.func_181688_b(p_184394_3_))) { -- GlStateManager.cullFace(GlStateManager.CullFace.FRONT); -- } -+ // TODO: check if negative scale is a thing -+ p_184394_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184394_2_, p_184394_3_, p_184394_4_); - - this.func_180454_a(p_184394_1_, p_184394_2_); - GlStateManager.cullFace(GlStateManager.CullFace.BACK); -@@ -260,7 +261,7 @@ - GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.func_180452_a(p_191962_2_, p_191962_3_, p_191962_4_.func_177556_c()); -- p_191962_4_.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GUI); -+ p_191962_4_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_191962_4_, ItemCameraTransforms.TransformType.GUI, false); - this.func_180454_a(p_191962_1_, p_191962_4_); - GlStateManager.disableAlphaTest(); - GlStateManager.disableRescaleNormal(); -@@ -299,6 +300,7 @@ + p_229111_4_.func_227865_b_(); +@@ -216,6 +220,7 @@ crashreportcategory.func_189529_a("Item Type", () -> { return String.valueOf((Object)p_184391_2_.func_77973_b()); }); @@ -69,22 +46,16 @@ crashreportcategory.func_189529_a("Item Damage", () -> { return String.valueOf(p_184391_2_.func_77952_i()); }); -@@ -330,9 +332,12 @@ - GlStateManager.enableBlend(); - GlStateManager.enableLighting(); - GlStateManager.enableDepthTest(); -+ // Fixes opaque cooldown overlay a bit lower -+ // TODO: check if enabled blending still screws things up down the line. -+ GlStateManager.enableBlend(); +@@ -247,18 +252,16 @@ + irendertypebuffer$impl.func_228461_a_(); } - if (p_180453_2_.func_77951_h()) { + if (p_180453_2_.func_77973_b().showDurabilityBar(p_180453_2_)) { - GlStateManager.disableLighting(); - GlStateManager.disableDepthTest(); - GlStateManager.disableTexture(); -@@ -340,11 +345,9 @@ - GlStateManager.disableBlend(); + RenderSystem.disableDepthTest(); + RenderSystem.disableTexture(); + RenderSystem.disableAlphaTest(); + RenderSystem.disableBlend(); Tessellator tessellator = Tessellator.func_178181_a(); BufferBuilder bufferbuilder = tessellator.func_178180_c(); - float f = (float)p_180453_2_.func_77952_i(); @@ -97,8 +68,8 @@ + int j = p_180453_2_.func_77973_b().getRGBDurabilityForDisplay(p_180453_2_); this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255); this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255, 255); - GlStateManager.enableBlend(); -@@ -383,4 +386,9 @@ + RenderSystem.enableBlend(); +@@ -296,4 +299,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 1d9e9644b..3651a26f2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch @@ -1,18 +1,11 @@ --- a/net/minecraft/client/renderer/LightTexture.java +++ b/net/minecraft/client/renderer/LightTexture.java -@@ -114,6 +114,15 @@ - f12 = 0.25F + f9 * 0.75F; +@@ -123,6 +123,8 @@ + } } -+ float[] colors = {f10, f11, f12}; -+ world.func_201675_m().getLightmapColors(p_205106_1_, f, f4, f5, colors); -+ f10 = colors[0]; f11 = colors[1]; f12 = colors[2]; -+ -+ // Forge: fix MC-58177 -+ f10 = net.minecraft.util.math.MathHelper.func_76131_a(f10, 0f, 1f); -+ f11 = net.minecraft.util.math.MathHelper.func_76131_a(f11, 0f, 1f); -+ f12 = net.minecraft.util.math.MathHelper.func_76131_a(f12, 0f, 1f); ++ clientworld.func_201675_m().getLightmapColors(p_205106_1_, f, f4, f5, vector3f1); + + vector3f1.func_195901_a(0.0F, 1.0F); if (f2 > 0.0F) { - float f17 = 1.0F / f10; - if (f17 > 1.0F / f11) { + float f10 = Math.max(vector3f1.func_195899_a(), Math.max(vector3f1.func_195900_b(), vector3f1.func_195902_c())); diff --git a/patches/minecraft/net/minecraft/client/renderer/Matrix4f.java.patch b/patches/minecraft/net/minecraft/client/renderer/Matrix4f.java.patch index 18471fb54..ca6f64623 100644 --- a/patches/minecraft/net/minecraft/client/renderer/Matrix4f.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/Matrix4f.java.patch @@ -1,13 +1,91 @@ --- a/net/minecraft/client/renderer/Matrix4f.java +++ b/net/minecraft/client/renderer/Matrix4f.java -@@ -106,6 +106,10 @@ - +@@ -373,4 +373,88 @@ + matrix4f.field_226586_l_ = p_226599_2_; + return matrix4f; } - -+ public float get(int col, int row) { -+ return this.field_195888_a[col + 4 * row]; ++ ++ // Forge start ++ public Matrix4f(float[] values) { set(values); } ++ 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 func_195878_a(int p_195878_1_, int p_195878_2_, float p_195878_3_) { - this.field_195888_a[p_195878_1_ + 4 * p_195878_2_] = p_195878_3_; - } ++ 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 set(float[] others) { ++ field_226575_a_ = others[0]; ++ field_226576_b_ = others[1]; ++ field_226577_c_ = others[2]; ++ field_226578_d_ = others[3]; ++ field_226579_e_ = others[4]; ++ field_226580_f_ = others[5]; ++ field_226581_g_ = others[6]; ++ field_226582_h_ = others[7]; ++ field_226583_i_ = others[8]; ++ field_226584_j_ = others[9]; ++ field_226585_k_ = others[10]; ++ field_226586_l_ = others[11]; ++ field_226587_m_ = others[12]; ++ field_226588_n_ = others[13]; ++ field_226589_o_ = others[14]; ++ field_226590_p_ = others[15]; ++ } ++ ++ public void write(float[] dest) { ++ dest[0] = field_226575_a_; ++ dest[1] = field_226576_b_; ++ dest[2] = field_226577_c_; ++ dest[3] = field_226578_d_; ++ dest[4] = field_226579_e_; ++ dest[5] = field_226580_f_; ++ dest[6] = field_226581_g_; ++ dest[7] = field_226582_h_; ++ dest[8] = field_226583_i_; ++ dest[9] = field_226584_j_; ++ dest[10] = field_226585_k_; ++ dest[11] = field_226586_l_; ++ dest[12] = field_226587_m_; ++ dest[13] = field_226588_n_; ++ dest[14] = field_226589_o_; ++ dest[15] = field_226590_p_; ++ } ++ ++ public void multiplyBackward(Matrix4f other) { ++ Matrix4f copy = other.func_226601_d_(); ++ copy.func_226595_a_(this); ++ this.set(copy); ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch new file mode 100644 index 000000000..a116d6049 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch @@ -0,0 +1,48 @@ +--- a/net/minecraft/client/renderer/OverlayRenderer.java ++++ b/net/minecraft/client/renderer/OverlayRenderer.java +@@ -25,18 +25,21 @@ + RenderSystem.disableAlphaTest(); + PlayerEntity playerentity = p_228734_0_.field_71439_g; + if (!playerentity.field_70145_X) { +- BlockState blockstate = func_230018_a_(playerentity); +- if (blockstate != null) { +- func_228735_a_(p_228734_0_, p_228734_0_.func_175602_ab().func_175023_a().func_178122_a(blockstate), p_228734_1_); ++ org.apache.commons.lang3.tuple.Pair overlay = getOverlayBlock(playerentity); ++ if (overlay != null) { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(playerentity, p_228734_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight())) ++ func_228735_a_(p_228734_0_, p_228734_0_.func_175602_ab().func_175023_a().getTexture(overlay.getLeft(), p_228734_0_.field_71441_e, overlay.getRight()), p_228734_1_); + } + } + + if (!p_228734_0_.field_71439_g.func_175149_v()) { + if (p_228734_0_.field_71439_g.func_208600_a(FluidTags.field_206959_a)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(playerentity, p_228734_1_)) + func_228736_b_(p_228734_0_, p_228734_1_); + } + + if (p_228734_0_.field_71439_g.func_70027_ad()) { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(playerentity, p_228734_1_)) + func_228737_c_(p_228734_0_, p_228734_1_); + } + } +@@ -46,6 +49,11 @@ + + @Nullable + private static BlockState func_230018_a_(PlayerEntity p_230018_0_) { ++ return getOverlayBlock(p_230018_0_).getLeft(); ++ } ++ ++ @Nullable ++ private static org.apache.commons.lang3.tuple.Pair getOverlayBlock(PlayerEntity p_230018_0_) { + BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(); + + for(int i = 0; i < 8; ++i) { +@@ -55,7 +63,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)) { +- return blockstate; ++ return org.apache.commons.lang3.tuple.Pair.of(blockstate, blockpos$mutable.func_185334_h()); + } + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/Quaternion.java.patch b/patches/minecraft/net/minecraft/client/renderer/Quaternion.java.patch new file mode 100644 index 000000000..49851edeb --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/Quaternion.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/client/renderer/Quaternion.java ++++ b/net/minecraft/client/renderer/Quaternion.java +@@ -176,4 +176,12 @@ + public Quaternion func_227068_g_() { + return new Quaternion(this); + } ++ ++ // Forge start ++ public Quaternion(float[] values) { ++ this.field_227061_b_ = values[0]; ++ this.field_227062_c_ = values[1]; ++ this.field_227063_d_ = values[2]; ++ this.field_227064_e_ = values[3]; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch new file mode 100644 index 000000000..408c61d0f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch @@ -0,0 +1,97 @@ +--- a/net/minecraft/client/renderer/RenderTypeLookup.java ++++ b/net/minecraft/client/renderer/RenderTypeLookup.java +@@ -18,6 +18,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); + }); ++ @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 @@ + }); + private static boolean field_228388_c_; + ++ @Deprecated + 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 @@ + } + } + ++ @Deprecated + public static RenderType func_228391_a_(IFluidState 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 ++ ++ private static final Map> blockRenderChecks = Maps.newHashMap(); ++ private static final Map> fluidRenderChecks = Maps.newHashMap(); ++ static { ++ field_228386_a_.forEach(RenderTypeLookup::setRenderLayer); ++ field_228387_b_.forEach(RenderTypeLookup::setRenderLayer); ++ } ++ ++ public static boolean canRenderInLayer(BlockState state, RenderType type) { ++ Block block = state.func_177230_c(); ++ if (block instanceof LeavesBlock) { ++ return field_228388_c_ ? type == RenderType.func_228641_d_() : type == RenderType.func_228639_c_(); ++ } else { ++ java.util.function.Predicate rendertype; ++ synchronized (RenderTypeLookup.class) { ++ rendertype = blockRenderChecks.get(block); ++ } ++ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); ++ } ++ } ++ ++ public static boolean canRenderInLayer(IFluidState fluid, RenderType type) { ++ java.util.function.Predicate rendertype; ++ synchronized (RenderTypeLookup.class) { ++ rendertype = fluidRenderChecks.get(fluid.func_206886_c()); ++ } ++ 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 synchronized void setRenderLayer(Block block, java.util.function.Predicate predicate) { ++ blockRenderChecks.put(block, predicate); ++ } ++ ++ public static void setRenderLayer(Fluid fluid, RenderType type) { ++ java.util.Objects.requireNonNull(type); ++ setRenderLayer(fluid, type::equals); ++ } ++ ++ public static synchronized void setRenderLayer(Fluid fluid, java.util.function.Predicate predicate) { ++ fluidRenderChecks.put(fluid, 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 new file mode 100644 index 000000000..065e891b3 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/TransformationMatrix.java.patch @@ -0,0 +1,45 @@ +--- 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,33 @@ + 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 javax.vecmath.Matrix3f normalTransform = null; ++ public javax.vecmath.Matrix3f getNormalMatrix() { ++ checkNormalTransform(); ++ return normalTransform; ++ } ++ private void checkNormalTransform() { ++ if (normalTransform == null) { ++ normalTransform = new javax.vecmath.Matrix3f(); ++ net.minecraftforge.common.model.TransformationHelper.toVecmath(field_227976_a_).getRotationScale(normalTransform); ++ normalTransform.invert(); ++ normalTransform.transpose(); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/Vector3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/Vector3f.java.patch new file mode 100644 index 000000000..c15405f30 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/Vector3f.java.patch @@ -0,0 +1,17 @@ +--- a/net/minecraft/client/renderer/Vector3f.java ++++ b/net/minecraft/client/renderer/Vector3f.java +@@ -198,4 +198,14 @@ + public String toString() { + return "[" + this.field_229184_g_ + ", " + this.field_229185_h_ + ", " + this.field_229186_i_ + "]"; + } ++ ++ // Forge start ++ public Vector3f(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 new file mode 100644 index 000000000..2f66782dd --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/Vector4f.java.patch @@ -0,0 +1,24 @@ +--- a/net/minecraft/client/renderer/Vector4f.java ++++ b/net/minecraft/client/renderer/Vector4f.java +@@ -129,4 +129,21 @@ + public String toString() { + return "[" + this.field_229368_a_ + ", " + this.field_229369_b_ + ", " + this.field_229370_c_ + ", " + this.field_229371_d_ + "]"; + } ++ ++ // Forge start ++ public Vector4f(float[] values) { ++ set(values); ++ } ++ 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 write(float[] values) { ++ values[0] = this.field_229368_a_; ++ values[1] = this.field_229369_b_; ++ values[2] = this.field_229370_c_; ++ values[3] = this.field_229371_d_; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch b/patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch new file mode 100644 index 000000000..7570c781e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/client/renderer/ViewFrustum.java ++++ b/net/minecraft/client/renderer/ViewFrustum.java +@@ -7,7 +7,9 @@ + import net.minecraft.world.World; + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; ++import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher.ChunkRender; + ++ + @OnlyIn(Dist.CLIENT) + public class ViewFrustum { + protected final WorldRenderer field_178169_a; diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index e3042b60c..64e1f088f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -1,120 +1,103 @@ --- a/net/minecraft/client/renderer/WorldRenderer.java +++ b/net/minecraft/client/renderer/WorldRenderer.java -@@ -592,10 +592,12 @@ - this.field_72769_h.func_217381_Z().func_219895_b("blockentities"); - RenderHelper.func_74519_b(); - -+ TileEntityRendererDispatcher.field_147556_a.preDrawBatch(); - for(WorldRenderer.LocalRenderInformationContainer worldrenderer$localrenderinformationcontainer : this.field_72755_R) { - List list2 = worldrenderer$localrenderinformationcontainer.field_178036_a.func_178571_g().func_178485_b(); - if (!list2.isEmpty()) { - for(TileEntity tileentity : list2) { -+ if (!p_215326_2_.func_78546_a(tileentity.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_215326_3_, -1); - } - } -@@ -603,16 +605,18 @@ - - synchronized(this.field_181024_n) { - for(TileEntity tileentity1 : this.field_181024_n) { -+ if (!p_215326_2_.func_78546_a(tileentity1.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_215326_3_, -1); - } - } -+ TileEntityRendererDispatcher.field_147556_a.drawBatch(); - - this.func_180443_s(); - - for(DestroyBlockProgress destroyblockprogress : this.field_72738_E.values()) { - BlockPos blockpos = destroyblockprogress.func_180246_b(); - BlockState blockstate = this.field_72769_h.func_180495_p(blockpos); -- if (blockstate.func_177230_c().func_149716_u()) { -+ if (blockstate.hasTileEntity()) { - TileEntity tileentity2 = this.field_72769_h.func_175625_s(blockpos); - if (tileentity2 instanceof ChestTileEntity && blockstate.func_177229_b(ChestBlock.field_196314_b) == ChestType.LEFT) { - blockpos = blockpos.func_177972_a(blockstate.func_177229_b(ChestBlock.field_176459_a).func_176746_e()); -@@ -733,7 +737,7 @@ - for(int j = -this.field_72739_F; j <= this.field_72739_F; ++j) { - for(int k = -this.field_72739_F; k <= this.field_72739_F; ++k) { - ChunkRender chunkrender1 = this.field_175008_n.func_178161_a(new BlockPos((j << 4) + 8, i, (k << 4) + 8)); -- if (chunkrender1 != null && p_215320_2_.func_78546_a(chunkrender1.field_178591_c)) { -+ if (chunkrender1 != null && p_215320_2_.func_78546_a(chunkrender1.field_178591_c.func_72321_a(0.0, blockpos1.func_177956_o() > 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY, 0.0))) { // Forge: fix MC-73139 - chunkrender1.func_178577_a(p_215320_3_); - queue.add(new WorldRenderer.LocalRenderInformationContainer(chunkrender1, (Direction)null, 0)); - } -@@ -778,7 +782,7 @@ - this.field_147595_R = true; - BlockPos blockpos2 = chunkrender4.func_178568_j().func_177982_a(8, 8, 8); - boolean flag3 = blockpos2.func_177951_i(blockpos1) < 768.0D; -- if (!chunkrender4.func_188281_o() && !flag3) { -+ if (net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() || !chunkrender4.func_188281_o() && !flag3) { - this.field_175009_l.add(chunkrender4); - } else { - this.field_72777_q.func_213239_aq().func_76320_a("build near"); -@@ -972,6 +976,11 @@ +@@ -203,6 +203,11 @@ } - public void func_195465_a(float p_195465_1_) { + 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(); ++ if (renderer != null) { ++ renderer.render(this.field_72773_u, p_228438_2_, this.field_72777_q.field_71441_e, this.field_72777_q); ++ return; ++ } + float f = this.field_72777_q.field_71441_e.func_72867_j(p_228438_2_); + if (!(f <= 0.0F)) { + p_228438_1_.func_205109_c(); +@@ -772,7 +777,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) { + this.field_175009_l.add(chunkrenderdispatcher$chunkrender4); + } else { + this.field_72777_q.func_213239_aq().func_76320_a("build near"); +@@ -871,13 +876,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(); + 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_); + iprofiler.func_219895_b("sky"); + this.func_228424_a_(p_228426_1_, p_228426_2_); + } + + iprofiler.func_219895_b("fog"); +- 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()); + iprofiler.func_219895_b("updatechunks"); +@@ -898,7 +903,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); ++ this.field_72777_q.func_209506_al().func_229356_a_(AtlasTexture.field_110575_b).func_174937_a(false, this.field_72777_q.field_71474_y.field_151442_I > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings + 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 @@ + 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; + BlockPos blockpos3 = tileentity1.func_174877_v(); + IRenderTypeBuffer irendertypebuffer1 = irendertypebuffer$impl; + p_228426_1_.func_227860_a_(); +@@ -977,6 +985,7 @@ + + synchronized(this.field_181024_n) { + for(TileEntity tileentity : this.field_181024_n) { ++ if(!clippinghelperimpl.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 @@ + iprofiler.func_219895_b("outline"); + BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).func_216350_a(); + BlockState blockstate = this.field_72769_h.func_180495_p(blockpos); +- if (!blockstate.func_196958_f() && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(this, p_228426_6_, field_72777_q.field_71476_x, 0, p_228426_2_)) ++ if (!blockstate.isAir(this.field_72769_h, blockpos) && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { + 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,11 @@ + } + + 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) { -+ renderer.render(this.field_72773_u, p_195465_1_, this.field_72769_h, this.field_72777_q); ++ 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_) { - this.func_180448_r(); + this.func_228444_b_(p_228424_1_); } else if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { -@@ -1116,6 +1125,7 @@ - } - - public void func_195466_a(float p_195466_1_, double p_195466_2_, double p_195466_4_, double p_195466_6_) { -+// if (net.minecraftforge.client.CloudRenderer.renderClouds(this.ticks, partialTicks, this.world, mc)) return; - if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { - float f = 12.0F; - float f1 = 4.0F; -@@ -1491,7 +1501,11 @@ - DestroyBlockProgress destroyblockprogress = iterator.next(); - BlockPos blockpos = destroyblockprogress.func_180246_b(); - Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); -- if (!(block instanceof ChestBlock) && !(block instanceof EnderChestBlock) && !(block instanceof AbstractSignBlock) && !(block instanceof AbstractSkullBlock)) { -+ TileEntity te = this.field_72769_h.func_175625_s(blockpos); -+ boolean hasBreak = block instanceof ChestBlock || block instanceof EnderChestBlock || block instanceof AbstractSignBlock || block instanceof AbstractSkullBlock; -+ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); -+ -+ if (!hasBreak) { - double d3 = (double)blockpos.func_177958_n() - d0; - double d4 = (double)blockpos.func_177956_o() - d1; - double d5 = (double)blockpos.func_177952_p() - d2; -@@ -1499,7 +1513,7 @@ - iterator.remove(); - } else { - BlockState blockstate = this.field_72769_h.func_180495_p(blockpos); -- if (!blockstate.func_196958_f()) { -+ if (!blockstate.isAir(this.field_72769_h, blockpos)) { - int i = destroyblockprogress.func_73106_e(); - TextureAtlasSprite textureatlassprite = this.field_94141_F[i]; - BlockRendererDispatcher blockrendererdispatcher = this.field_72777_q.func_175602_ab(); -@@ -1520,7 +1534,7 @@ - if (p_215325_3_ == 0 && p_215325_2_.func_216346_c() == RayTraceResult.Type.BLOCK) { - BlockPos blockpos = ((BlockRayTraceResult)p_215325_2_).func_216350_a(); - BlockState blockstate = this.field_72769_h.func_180495_p(blockpos); -- if (!blockstate.func_196958_f() && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { -+ if (!blockstate.isAir(this.field_72769_h, blockpos) && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { - GlStateManager.enableBlend(); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.lineWidth(Math.max(2.5F, (float)this.field_72777_q.field_195558_d.func_198109_k() / 1920.0F * 2.5F)); -@@ -1994,8 +2008,8 @@ +@@ -2283,8 +2298,8 @@ break; case 2001: BlockState blockstate = Block.func_196257_b(p_180439_4_); - if (!blockstate.func_196958_f()) { - SoundType soundtype = blockstate.func_215695_r(); + if (!blockstate.isAir(this.field_72769_h, p_180439_3_)) { -+ SoundType soundtype = blockstate.getSoundType(field_72769_h, p_180439_3_, null); ++ SoundType soundtype = blockstate.getSoundType(this.field_72769_h, p_180439_3_, null); 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); } -@@ -2118,6 +2132,11 @@ - } +@@ -2445,6 +2460,11 @@ + return this.field_175015_z; } + @Override @@ -124,4 +107,4 @@ + @OnlyIn(Dist.CLIENT) class LocalRenderInformationContainer { - private final ChunkRender field_178036_a; + private final ChunkRenderDispatcher.ChunkRender field_178036_a; diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch deleted file mode 100644 index eb466d367..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- a/net/minecraft/client/renderer/WorldVertexBufferUploader.java -+++ b/net/minecraft/client/renderer/WorldVertexBufferUploader.java -@@ -20,29 +20,7 @@ - - for(int j = 0; j < list.size(); ++j) { - VertexFormatElement vertexformatelement = list.get(j); -- VertexFormatElement.Usage vertexformatelement$usage = vertexformatelement.func_177375_c(); -- int k = vertexformatelement.func_177367_b().func_177397_c(); -- int l = vertexformatelement.func_177369_e(); -- bytebuffer.position(vertexformat.func_181720_d(j)); -- switch(vertexformatelement$usage) { -- case POSITION: -- GlStateManager.vertexPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); -- GlStateManager.enableClientState(32884); -- break; -- case UV: -- GLX.glClientActiveTexture(GLX.GL_TEXTURE0 + l); -- GlStateManager.texCoordPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); -- GlStateManager.enableClientState(32888); -- GLX.glClientActiveTexture(GLX.GL_TEXTURE0); -- break; -- case COLOR: -- GlStateManager.colorPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); -- GlStateManager.enableClientState(32886); -- break; -- case NORMAL: -- GlStateManager.normalPointer(k, i, bytebuffer); -- GlStateManager.enableClientState(32885); -- } -+ vertexformatelement.func_177375_c().preDraw(vertexformat, j, i, bytebuffer); // moved to VertexFormatElement.preDraw - } - - GlStateManager.drawArrays(p_181679_1_.func_178979_i(), 0, p_181679_1_.func_178989_h()); -@@ -50,24 +28,7 @@ - - for(int j1 = list.size(); i1 < j1; ++i1) { - VertexFormatElement vertexformatelement1 = list.get(i1); -- VertexFormatElement.Usage vertexformatelement$usage1 = vertexformatelement1.func_177375_c(); -- int k1 = vertexformatelement1.func_177369_e(); -- switch(vertexformatelement$usage1) { -- case POSITION: -- GlStateManager.disableClientState(32884); -- break; -- case UV: -- GLX.glClientActiveTexture(GLX.GL_TEXTURE0 + k1); -- GlStateManager.disableClientState(32888); -- GLX.glClientActiveTexture(GLX.GL_TEXTURE0); -- break; -- case COLOR: -- GlStateManager.disableClientState(32886); -- GlStateManager.clearCurrentColor(); -- break; -- case NORMAL: -- GlStateManager.disableClientState(32885); -- } -+ vertexformatelement1.func_177375_c().postDraw(vertexformat, i1, i, bytebuffer); // moved to VertexFormatElement.postDraw - } - } - diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRender.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRender.java.patch deleted file mode 100644 index 34150e6fc..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRender.java.patch +++ /dev/null @@ -1,75 +0,0 @@ ---- a/net/minecraft/client/renderer/chunk/ChunkRender.java -+++ b/net/minecraft/client/renderer/chunk/ChunkRender.java -@@ -33,7 +33,7 @@ - import net.minecraftforge.api.distmarker.OnlyIn; - - @OnlyIn(Dist.CLIENT) --public class ChunkRender { -+public class ChunkRender implements net.minecraftforge.client.extensions.IForgeRenderChunk { - private volatile World field_178588_d; - private final WorldRenderer field_178589_e; - public static int field_178592_a; -@@ -151,22 +151,24 @@ - lvt_10_1_.func_178606_a(blockpos2); - } - -- if (block.func_149716_u()) { -+ if (blockstate.hasTileEntity()) { - TileEntity tileentity = lvt_12_1_.func_212399_a(blockpos2, Chunk.CreateEntityType.CHECK); - if (tileentity != null) { - TileEntityRenderer tileentityrenderer = TileEntityRendererDispatcher.field_147556_a.func_147547_b(tileentity); - if (tileentityrenderer != null) { -- compiledchunk.func_178490_a(tileentity); - if (tileentityrenderer.func_188185_a(tileentity)) { - lvt_11_1_.add(tileentity); - } -+ else compiledchunk.func_178490_a(tileentity); // FORGE: Fix MC-112730 - } - } - } - - IFluidState ifluidstate = lvt_12_1_.func_204610_c(blockpos2); -- if (!ifluidstate.func_206888_e()) { -- BlockRenderLayer blockrenderlayer1 = ifluidstate.func_180664_k(); -+ net.minecraftforge.client.model.data.IModelData modelData = p_178581_4_.getModelData(blockpos2); -+ for(BlockRenderLayer blockrenderlayer1 : BlockRenderLayer.values()) { -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1); -+ if (!ifluidstate.func_206888_e() && ifluidstate.canRenderInLayer(blockrenderlayer1)) { - int j = blockrenderlayer1.ordinal(); - BufferBuilder bufferbuilder = p_178581_4_.func_178545_d().func_179039_a(j); - if (!compiledchunk.func_178492_d(blockrenderlayer1)) { -@@ -177,17 +179,18 @@ - aboolean[j] |= blockrendererdispatcher.func_215331_a(blockpos2, lvt_12_1_, bufferbuilder, ifluidstate); - } - -- if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) { -- BlockRenderLayer blockrenderlayer2 = block.func_180664_k(); -- int k = blockrenderlayer2.ordinal(); -+ if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE && blockstate.canRenderInLayer(blockrenderlayer1)) { -+ int k = blockrenderlayer1.ordinal(); - BufferBuilder bufferbuilder1 = p_178581_4_.func_178545_d().func_179039_a(k); -- if (!compiledchunk.func_178492_d(blockrenderlayer2)) { -- compiledchunk.func_178493_c(blockrenderlayer2); -+ if (!compiledchunk.func_178492_d(blockrenderlayer1)) { -+ compiledchunk.func_178493_c(blockrenderlayer1); - this.func_178573_a(bufferbuilder1, blockpos); - } - -- aboolean[k] |= blockrendererdispatcher.func_215330_a(blockstate, blockpos2, lvt_12_1_, bufferbuilder1, random); -+ aboolean[k] |= blockrendererdispatcher.renderBlock(blockstate, blockpos2, lvt_12_1_, bufferbuilder1, random, modelData); - } -+ } -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null); - } - - for(BlockRenderLayer blockrenderlayer : BlockRenderLayer.values()) { -@@ -247,7 +250,8 @@ - this.func_178578_b(); - BlockPos blockpos = this.field_178586_f.func_185334_h(); - int i = 1; -- ChunkRenderCache chunkrendercache = ChunkRenderCache.func_212397_a(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos.func_177982_a(16, 16, 16), 1); -+ ChunkRenderCache chunkrendercache = createRegionRenderCache(field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos.func_177982_a(16, 16, 16), 1); -+ - this.field_178599_i = new ChunkRenderTask(this, ChunkRenderTask.Type.REBUILD_CHUNK, this.func_188280_f(), chunkrendercache); - chunkrendertask = this.field_178599_i; - } finally { diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch index 9d7a3e4e0..fdcf1cf3b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch @@ -1,18 +1,172 @@ --- a/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java +++ b/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java -@@ -45,10 +45,14 @@ +@@ -68,12 +68,15 @@ private Vec3d field_217672_l = Vec3d.field_186680_a; - public ChunkRenderDispatcher(boolean p_i51518_1_) { -+ this(p_i51518_1_, -1); + 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); + } -+ -+ public ChunkRenderDispatcher(boolean p_i51518_1_, int countRenderBuilders) { - int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / 10485760 - 1); ++ public ChunkRenderDispatcher(World p_i226020_1_, WorldRenderer p_i226020_2_, Executor p_i226020_3_, boolean p_i226020_4_, RegionRenderCacheBuilder p_i226020_5_, int countRenderBuilders) { + this.field_228893_j_ = p_i226020_1_; + this.field_228894_k_ = p_i226020_2_; + int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / (RenderType.func_228661_n_().stream().mapToInt(RenderType::func_228662_o_).sum() * 4) - 1); int j = Runtime.getRuntime().availableProcessors(); - int k = p_i51518_1_ ? j : Math.min(j, 4); -- int l = Math.max(1, Math.min(k * 2, i)); -+ int l = countRenderBuilders < 0 ? Math.max(1, Math.min(k * 2, i)) : countRenderBuilders; - this.field_178525_i = new ChunkRenderWorker(this, new RegionRenderCacheBuilder()); + int k = p_i226020_4_ ? j : Math.min(j, 4); +- int l = Math.max(1, Math.min(k, i)); ++ int l = countRenderBuilders < 0 ? Math.max(1, Math.min(k, i)) : countRenderBuilders; + this.field_228890_g_ = p_i226020_5_; List list = Lists.newArrayListWithExpectedSize(l); +@@ -206,7 +209,7 @@ + } + + @OnlyIn(Dist.CLIENT) +- public class ChunkRender { ++ public class ChunkRender implements net.minecraftforge.client.extensions.IForgeRenderChunk { + public final AtomicReference field_178590_b = new AtomicReference<>(ChunkRenderDispatcher.CompiledChunk.field_178502_a); + @Nullable + private ChunkRenderDispatcher.ChunkRender.RebuildTask field_228921_d_; +@@ -332,7 +335,7 @@ + if (!chunkrenderdispatcher$compiledchunk.field_178501_c.contains(p_228925_1_)) { + return false; + } else { +- this.field_228922_e_ = new ChunkRenderDispatcher.ChunkRender.SortTransparencyTask(this.func_188280_f(), chunkrenderdispatcher$compiledchunk); ++ this.field_228922_e_ = new ChunkRenderDispatcher.ChunkRender.SortTransparencyTask(new net.minecraft.util.math.ChunkPos(func_178568_j()), this.func_188280_f(), chunkrenderdispatcher$compiledchunk); + p_228925_2_.func_228900_a_(this.field_228922_e_); + return true; + } +@@ -355,8 +358,8 @@ + this.func_228935_i_(); + BlockPos blockpos = this.field_178586_f.func_185334_h(); + int i = 1; +- ChunkRenderCache chunkrendercache = ChunkRenderCache.func_212397_a(ChunkRenderDispatcher.this.field_228893_j_, blockpos.func_177982_a(-1, -1, -1), blockpos.func_177982_a(16, 16, 16), 1); +- this.field_228921_d_ = new ChunkRenderDispatcher.ChunkRender.RebuildTask(this.func_188280_f(), chunkrendercache); ++ ChunkRenderCache chunkrendercache = createRegionRenderCache(ChunkRenderDispatcher.this.field_228893_j_, blockpos.func_177982_a(-1, -1, -1), blockpos.func_177982_a(16, 16, 16), 1); ++ this.field_228921_d_ = new ChunkRenderDispatcher.ChunkRender.RebuildTask(new net.minecraft.util.math.ChunkPos(func_178568_j()), this.func_188280_f(), chunkrendercache); + return this.field_228921_d_; + } + +@@ -384,9 +387,19 @@ + abstract class ChunkRenderTask implements Comparable { + protected final double field_188229_e; + protected final AtomicBoolean field_178554_h = new AtomicBoolean(false); ++ protected java.util.Map modelData; + + public ChunkRenderTask(double p_i226023_2_) { ++ this(null, p_i226023_2_); ++ } ++ ++ public ChunkRenderTask(@Nullable net.minecraft.util.math.ChunkPos pos, double p_i226023_2_) { + this.field_188229_e = p_i226023_2_; ++ if (pos == null) { ++ this.modelData = java.util.Collections.emptyMap(); ++ } else { ++ this.modelData = net.minecraftforge.client.model.ModelDataManager.getModelData(net.minecraft.client.Minecraft.func_71410_x().field_71441_e, pos); ++ } + } + + public abstract CompletableFuture func_225618_a_(RegionRenderCacheBuilder p_225618_1_); +@@ -396,6 +409,10 @@ + public int compareTo(ChunkRenderDispatcher.ChunkRender.ChunkRenderTask p_compareTo_1_) { + return Doubles.compare(this.field_188229_e, p_compareTo_1_.field_188229_e); + } ++ ++ public net.minecraftforge.client.model.data.IModelData getModelData(net.minecraft.util.math.BlockPos pos) { ++ return modelData.getOrDefault(pos, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ } + } + + @OnlyIn(Dist.CLIENT) +@@ -403,8 +420,13 @@ + @Nullable + protected ChunkRenderCache field_228938_d_; + ++ @Deprecated + public RebuildTask(double p_i226024_2_, @Nullable ChunkRenderCache p_i226024_4_) { +- super(p_i226024_2_); ++ this(null, p_i226024_2_, p_i226024_4_); ++ } ++ ++ public RebuildTask(@Nullable net.minecraft.util.math.ChunkPos pos, double p_i226024_2_, @Nullable ChunkRenderCache p_i226024_4_) { ++ super(pos, p_i226024_2_); + this.field_228938_d_ = p_i226024_4_; + } + +@@ -470,7 +492,7 @@ + visgraph.func_178606_a(blockpos2); + } + +- if (block.func_149716_u()) { ++ if (blockstate.hasTileEntity()) { + TileEntity tileentity = chunkrendercache.func_212399_a(blockpos2, Chunk.CreateEntityType.CHECK); + if (tileentity != null) { + this.func_228942_a_(p_228940_4_, set, tileentity); +@@ -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); ++ for (RenderType rendertype : RenderType.func_228661_n_()) { ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(rendertype); ++ if (!ifluidstate.func_206888_e() && RenderTypeLookup.canRenderInLayer(ifluidstate, 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); +@@ -491,8 +515,8 @@ + } + } + +- if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) { +- RenderType rendertype1 = RenderTypeLookup.func_228390_a_(blockstate); ++ if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE && RenderTypeLookup.canRenderInLayer(blockstate, rendertype)) { ++ RenderType rendertype1 = rendertype; + BufferBuilder bufferbuilder2 = p_228940_5_.func_228366_a_(rendertype1); + if (p_228940_4_.field_178501_c.add(rendertype1)) { + ChunkRender.this.func_228923_a_(bufferbuilder2); +@@ -500,7 +524,7 @@ + + matrixstack.func_227860_a_(); + matrixstack.func_227861_a_((double)(blockpos2.func_177958_n() & 15), (double)(blockpos2.func_177956_o() & 15), (double)(blockpos2.func_177952_p() & 15)); +- if (blockrendererdispatcher.func_228793_a_(blockstate, blockpos2, chunkrendercache, matrixstack, bufferbuilder2, true, random)) { ++ if (blockrendererdispatcher.renderModel(blockstate, blockpos2, chunkrendercache, matrixstack, bufferbuilder2, true, random, modelData)) { + p_228940_4_.field_178498_d = false; + p_228940_4_.field_178500_b.add(rendertype1); + } +@@ -508,6 +532,8 @@ + matrixstack.func_227865_b_(); + } + } ++ } ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null); + + if (p_228940_4_.field_178500_b.contains(RenderType.func_228645_f_())) { + BufferBuilder bufferbuilder1 = p_228940_5_.func_228366_a_(RenderType.func_228645_f_()); +@@ -526,10 +552,10 @@ + private void func_228942_a_(ChunkRenderDispatcher.CompiledChunk p_228942_1_, Set p_228942_2_, E p_228942_3_) { + TileEntityRenderer tileentityrenderer = TileEntityRendererDispatcher.field_147556_a.func_147547_b(p_228942_3_); + if (tileentityrenderer != null) { +- p_228942_1_.field_178499_e.add(p_228942_3_); + if (tileentityrenderer.func_188185_a(p_228942_3_)) { + p_228942_2_.add(p_228942_3_); + } ++ else p_228942_1_.field_178499_e.add(p_228942_3_); //FORGE: Fix MC-112730 + } + + } +@@ -547,8 +573,13 @@ + class SortTransparencyTask extends ChunkRenderDispatcher.ChunkRender.ChunkRenderTask { + private final ChunkRenderDispatcher.CompiledChunk field_228945_e_; + ++ @Deprecated + public SortTransparencyTask(double p_i226025_2_, ChunkRenderDispatcher.CompiledChunk p_i226025_4_) { +- super(p_i226025_2_); ++ this(null, p_i226025_2_, p_i226025_4_); ++ } ++ ++ public SortTransparencyTask(@Nullable net.minecraft.util.math.ChunkPos pos, double p_i226025_2_, ChunkRenderDispatcher.CompiledChunk p_i226025_4_) { ++ super(pos, p_i226025_2_); + this.field_228945_e_ = p_i226025_4_; + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderTask.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderTask.java.patch deleted file mode 100644 index 43014f89e..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderTask.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/net/minecraft/client/renderer/chunk/ChunkRenderTask.java -+++ b/net/minecraft/client/renderer/chunk/ChunkRenderTask.java -@@ -22,12 +22,15 @@ - private CompiledChunk field_178547_f; - private ChunkRenderTask.Status field_178548_g = ChunkRenderTask.Status.PENDING; - private boolean field_178554_h; -+ private java.util.Map modelData; - - public ChunkRenderTask(ChunkRender p_i50980_1_, ChunkRenderTask.Type p_i50980_2_, double p_i50980_3_, @Nullable ChunkRenderCache p_i50980_5_) { - this.field_178553_a = p_i50980_1_; - this.field_178549_d = p_i50980_2_; - this.field_188229_e = p_i50980_3_; - this.field_217668_f = p_i50980_5_; -+ -+ modelData = net.minecraftforge.client.model.ModelDataManager.getModelData(net.minecraft.client.Minecraft.func_71410_x().field_71441_e, new net.minecraft.util.math.ChunkPos(p_i50980_1_.func_178568_j())); - } - - public ChunkRenderTask.Status func_178546_a() { -@@ -140,4 +143,8 @@ - REBUILD_CHUNK, - RESORT_TRANSPARENCY; - } -+ -+ public net.minecraftforge.client.model.data.IModelData getModelData(net.minecraft.util.math.BlockPos pos) { -+ return modelData.getOrDefault(pos, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); -+ } - } 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 a3fa474d3..ebd60c721 100644 --- a/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch @@ -11,8 +11,8 @@ public static BlockColors func_186723_a() { @@ -72,11 +73,12 @@ - blockcolors.func_186722_a((p_210228_0_, p_210228_1_, p_210228_2_, p_210228_3_) -> { - return p_210228_1_ != null && p_210228_2_ != null ? 2129968 : 7455580; + blockcolors.func_186722_a((p_228055_0_, p_228055_1_, p_228055_2_, p_228055_3_) -> { + return p_228055_1_ != null && p_228055_2_ != null ? 2129968 : 7455580; }, Blocks.field_196651_dG); + net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors); return blockcolors; @@ -22,15 +22,15 @@ - 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_, (IEnviromentBlockReader)null, (BlockPos)null, 0); + return iblockcolor.getColor(p_189991_1_, (ILightReader)null, (BlockPos)null, 0); } else { @@ -86,13 +88,13 @@ } - public int func_216860_a(BlockState p_216860_1_, @Nullable IEnviromentBlockReader p_216860_2_, @Nullable BlockPos p_216860_3_, int p_216860_4_) { -- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(Registry.field_212618_g.func_148757_b(p_216860_1_.func_177230_c())); -+ IBlockColor iblockcolor = this.field_186725_a.get(p_216860_1_.func_177230_c().delegate); - return iblockcolor == null ? -1 : iblockcolor.getColor(p_216860_1_, p_216860_2_, p_216860_3_, p_216860_4_); + public int func_228054_a_(BlockState p_228054_1_, @Nullable ILightReader 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_); } public void func_186722_a(IBlockColor p_186722_1_, Block... p_186722_2_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch index 058639c97..407ebd518 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch @@ -1,13 +1,11 @@ --- a/net/minecraft/client/renderer/entity/EntityRendererManager.java +++ b/net/minecraft/client/renderer/entity/EntityRendererManager.java -@@ -257,6 +257,10 @@ - this.field_178636_l.put("slim", new PlayerRenderer(this, true)); +@@ -445,4 +445,8 @@ + public FontRenderer func_78716_a() { + return this.field_78736_p; } - -+ public Map getSkinMap() { -+ return (Map) java.util.Collections.unmodifiableMap(field_178636_l); -+ } + - public void func_178628_a(double p_178628_1_, double p_178628_3_, double p_178628_5_) { - this.field_78725_b = p_178628_1_; - this.field_78726_c = p_178628_3_; ++ public Map getSkinMap() { ++ return (Map) java.util.Collections.unmodifiableMap(field_178636_l); ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch new file mode 100644 index 000000000..d914f1ffa --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch @@ -0,0 +1,17 @@ +--- a/net/minecraft/client/renderer/entity/FallingBlockRenderer.java ++++ b/net/minecraft/client/renderer/entity/FallingBlockRenderer.java +@@ -33,7 +33,13 @@ + 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_); ++ 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_); ++ } ++ } ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null); + 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/FishRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/FishRenderer.java.patch index 7e6818e86..c33488cc2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/FishRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/FishRenderer.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/renderer/entity/FishRenderer.java +++ b/net/minecraft/client/renderer/entity/FishRenderer.java -@@ -59,7 +59,7 @@ - GlStateManager.popMatrix(); +@@ -48,7 +48,7 @@ + p_225623_4_.func_227865_b_(); int i = playerentity.func_184591_cq() == HandSide.RIGHT ? 1 : -1; ItemStack itemstack = playerentity.func_184614_ca(); - if (itemstack.func_77973_b() != Items.field_151112_aM) { 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 db32c26da..8d8984dba 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch @@ -1,41 +1,39 @@ --- a/net/minecraft/client/renderer/entity/ItemFrameRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemFrameRenderer.java -@@ -44,7 +44,7 @@ - this.field_76990_c.field_78724_e.func_110577_a(AtlasTexture.field_110575_b); +@@ -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_76986_1_.func_82335_i().func_77973_b() == Items.field_151098_aY ? field_209586_g : field_209585_f; -+ ModelResourceLocation modelresourcelocation = p_76986_1_.func_82335_i().func_77973_b() instanceof FilledMapItem ? field_209586_g : field_209585_f; - GlStateManager.pushMatrix(); - GlStateManager.translatef(-0.5F, -0.5F, -0.5F); - if (this.field_188301_f) { -@@ -86,17 +86,17 @@ - ItemStack itemstack = p_82402_1_.func_82335_i(); +- 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_(); + ItemStack itemstack = p_225623_1_.func_82335_i(); if (!itemstack.func_190926_b()) { - GlStateManager.pushMatrix(); - boolean flag = itemstack.func_77973_b() == Items.field_151098_aY; -- int i = flag ? p_82402_1_.func_82333_j() % 4 * 2 : p_82402_1_.func_82333_j(); -+ MapData mapdata = FilledMapItem.func_195950_a(itemstack, p_82402_1_.field_70170_p); -+ int i = mapdata != null ? p_82402_1_.func_82333_j() % 4 * 2 : p_82402_1_.func_82333_j(); - GlStateManager.rotatef((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); ++ 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(); ++ 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 (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderItemInFrameEvent(p_82402_1_, this))) { ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderItemInFrameEvent(p_225623_1_, this))) { + if (mapdata != null) { - GlStateManager.disableLighting(); - this.field_76990_c.field_78724_e.func_110577_a(field_110789_a); - GlStateManager.rotatef(180.0F, 0.0F, 0.0F, 1.0F); + p_225623_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_(180.0F)); float f = 0.0078125F; - GlStateManager.scalef(0.0078125F, 0.0078125F, 0.0078125F); - GlStateManager.translatef(-64.0F, -64.0F, 0.0F); -- MapData mapdata = FilledMapItem.func_195950_a(itemstack, p_82402_1_.field_70170_p); - GlStateManager.translatef(0.0F, 0.0F, -1.0F); + p_225623_4_.func_227862_a_(0.0078125F, 0.0078125F, 0.0078125F); + p_225623_4_.func_227861_a_(-64.0D, -64.0D, 0.0D); +- MapData mapdata = FilledMapItem.func_195950_a(itemstack, p_225623_1_.field_70170_p); + 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_148250_a(mapdata, true); -@@ -105,6 +105,7 @@ - GlStateManager.scalef(0.5F, 0.5F, 0.5F); - this.field_177074_h.func_181564_a(itemstack, ItemCameraTransforms.TransformType.FIXED); + 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 @@ + 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_); } + } - - GlStateManager.popMatrix(); } + + p_225623_4_.func_227865_b_(); 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 13a1c1fc5..20bcbd265 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch @@ -1,63 +1,54 @@ --- a/net/minecraft/client/renderer/entity/ItemRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemRenderer.java -@@ -36,7 +36,7 @@ - boolean flag = p_177077_9_.func_177556_c(); - int i = this.func_177078_a(itemstack); - float f = 0.25F; -- float f1 = MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F; -+ float f1 = shouldBob() ? MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F : 0; - float f2 = p_177077_9_.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.func_195900_b(); - GlStateManager.translatef((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); - if (flag || this.field_76990_c.field_78733_k != null) { -@@ -82,14 +82,11 @@ - GlStateManager.pushMatrix(); - IBakedModel ibakedmodel = this.field_177080_a.func_184393_a(itemstack, p_76986_1_.field_70170_p, (LivingEntity)null); - int j = this.func_177077_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_9_, ibakedmodel); -- float f = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195899_a(); -- float f1 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195900_b(); -- float f2 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195902_c(); - boolean flag1 = ibakedmodel.func_177556_c(); - if (!flag1) { -- float f3 = -0.0F * (float)(j - 1) * 0.5F * f; -- float f4 = -0.0F * (float)(j - 1) * 0.5F * f1; -- float f5 = -0.09375F * (float)(j - 1) * 0.5F * f2; -+ float f3 = -0.0F * (float)(j - 1) * 0.5F; -+ float f4 = -0.0F * (float)(j - 1) * 0.5F; -+ float f5 = -0.09375F * (float)(j - 1) * 0.5F; - GlStateManager.translatef(f3, f4, f5); +@@ -53,18 +53,15 @@ + boolean flag = ibakedmodel.func_177556_c(); + 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(); + 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; + 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(); +- float f6 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195902_c(); + if (!flag) { +- float f7 = -0.0F * (float)(j - 1) * 0.5F * f4; +- float f8 = -0.0F * (float)(j - 1) * 0.5F * f5; +- float f9 = -0.09375F * (float)(j - 1) * 0.5F * f6; ++ float f7 = -0.0F * (float)(j - 1) * 0.5F; ++ float f8 = -0.0F * (float)(j - 1) * 0.5F; ++ float f9 = -0.09375F * (float)(j - 1) * 0.5F; + p_225623_4_.func_227861_a_((double)f7, (double)f8, (double)f9); } -@@ -105,11 +102,11 @@ - float f7 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f9 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f6 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -- GlStateManager.translatef(f7, f9, f6); -+ GlStateManager.translatef(shouldSpreadItems() ? f7 : 0, shouldSpreadItems() ? f9 : 0, f6); +@@ -75,18 +72,19 @@ + float f11 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f13 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f10 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; +- p_225623_4_.func_227861_a_((double)f11, (double)f13, (double)f10); ++ p_225623_4_.func_227861_a_(shouldSpreadItems() ? f11 : 0, shouldSpreadItems() ? f13 : 0, shouldSpreadItems() ? f10 : 0); + } else { + float f12 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; + float f14 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; +- p_225623_4_.func_227861_a_((double)f12, (double)f14, 0.0D); ++ p_225623_4_.func_227861_a_(shouldSpreadItems() ? f12 : 0, shouldSpreadItems() ? f14 : 0, 0.0D); } + } -- ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND); -- this.field_177080_a.func_180454_a(itemstack, ibakedmodel); -+ IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); -+ this.field_177080_a.func_180454_a(itemstack, transformedModel); - GlStateManager.popMatrix(); - } else { - GlStateManager.pushMatrix(); -@@ -119,10 +116,10 @@ - GlStateManager.translatef(f8, f10, 0.0F); - } - -- ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND); -- this.field_177080_a.func_180454_a(itemstack, ibakedmodel); -+ IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); -+ this.field_177080_a.func_180454_a(itemstack, transformedModel); - GlStateManager.popMatrix(); -- GlStateManager.translatef(0.0F * f, 0.0F * f1, 0.09375F * f2); -+ GlStateManager.translatef(0.0F, 0.0F, 0.09375F); +- this.field_177080_a.func_229111_a_(itemstack, ItemCameraTransforms.TransformType.GROUND, false, p_225623_4_, p_225623_5_, p_225623_6_, OverlayTexture.field_229196_a_, ibakedmodel); ++ IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_225623_4_, ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); ++ this.field_177080_a.func_229111_a_(itemstack, ItemCameraTransforms.TransformType.GROUND, false, p_225623_4_, p_225623_5_, p_225623_6_, OverlayTexture.field_229196_a_, transformedModel); + p_225623_4_.func_227865_b_(); + if (!flag) { +- p_225623_4_.func_227861_a_((double)(0.0F * f4), (double)(0.0F * f5), (double)(0.09375F * f6)); ++ p_225623_4_.func_227861_a_(0.0, 0.0, 0.09375F); } } -@@ -145,4 +142,21 @@ - protected ResourceLocation func_110775_a(ItemEntity p_110775_1_) { +@@ -97,4 +95,21 @@ + public ResourceLocation func_110775_a(ItemEntity p_110775_1_) { return AtlasTexture.field_110575_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 7a139de12..52ab3b674 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch @@ -1,48 +1,39 @@ --- a/net/minecraft/client/renderer/entity/LivingRenderer.java +++ b/net/minecraft/client/renderer/entity/LivingRenderer.java -@@ -59,17 +59,19 @@ +@@ -47,14 +47,17 @@ } - public void func_76986_a(T p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_))) return; - GlStateManager.pushMatrix(); - GlStateManager.disableCull(); - this.field_77045_g.field_217112_c = this.func_77040_d(p_76986_1_, p_76986_9_); -- this.field_77045_g.field_217113_d = p_76986_1_.func_184218_aH(); -+ boolean shouldSit = p_76986_1_.func_184218_aH() && (p_76986_1_.func_184187_bx() != null && p_76986_1_.func_184187_bx().shouldRiderSit()); + 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 (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(p_225623_1_, this, p_225623_3_, p_225623_4_))) return; + p_225623_4_.func_227860_a_(); + this.field_77045_g.field_217112_c = this.func_77040_d(p_225623_1_, p_225623_3_); +- this.field_77045_g.field_217113_d = p_225623_1_.func_184218_aH(); ++ ++ boolean shouldSit = p_225623_1_.func_184218_aH() && (p_225623_1_.func_184187_bx() != null && p_225623_1_.func_184187_bx().shouldRiderSit()); + this.field_77045_g.field_217113_d = shouldSit; - this.field_77045_g.field_217114_e = p_76986_1_.func_70631_g_(); + this.field_77045_g.field_217114_e = p_225623_1_.func_70631_g_(); + float f = MathHelper.func_219805_h(p_225623_3_, p_225623_1_.field_70760_ar, p_225623_1_.field_70761_aq); + float f1 = MathHelper.func_219805_h(p_225623_3_, p_225623_1_.field_70758_at, p_225623_1_.field_70759_as); + float f2 = f1 - f; +- if (p_225623_1_.func_184218_aH() && p_225623_1_.func_184187_bx() instanceof LivingEntity) { ++ if (shouldSit && p_225623_1_.func_184187_bx() instanceof LivingEntity) { + LivingEntity livingentity = (LivingEntity)p_225623_1_.func_184187_bx(); + f = MathHelper.func_219805_h(p_225623_3_, livingentity.field_70760_ar, livingentity.field_70761_aq); + f2 = f1 - f; +@@ -91,7 +94,7 @@ + p_225623_4_.func_227861_a_(0.0D, (double)-1.501F, 0.0D); + float f8 = 0.0F; + float f5 = 0.0F; +- if (!p_225623_1_.func_184218_aH() && p_225623_1_.func_70089_S()) { ++ if (!shouldSit && p_225623_1_.func_70089_S()) { + 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_()) { +@@ -132,6 +135,7 @@ - try { - float f = MathHelper.func_219805_h(p_76986_9_, p_76986_1_.field_70760_ar, p_76986_1_.field_70761_aq); - float f1 = MathHelper.func_219805_h(p_76986_9_, p_76986_1_.field_70758_at, p_76986_1_.field_70759_as); - float f2 = f1 - f; -- if (p_76986_1_.func_184218_aH() && p_76986_1_.func_184187_bx() instanceof LivingEntity) { -+ if (shouldSit && p_76986_1_.func_184187_bx() instanceof LivingEntity) { - LivingEntity livingentity = (LivingEntity)p_76986_1_.func_184187_bx(); - f = MathHelper.func_219805_h(p_76986_9_, livingentity.field_70760_ar, livingentity.field_70761_aq); - f2 = f1 - f; -@@ -153,6 +155,7 @@ - GlStateManager.enableCull(); - GlStateManager.popMatrix(); - super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_)); + 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_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(p_225623_1_, this, p_225623_3_, p_225623_4_)); } - public float func_188322_c(T p_188322_1_, float p_188322_2_) { -@@ -408,6 +411,7 @@ - } - - public void func_177067_a(T p_177067_1_, double p_177067_2_, double p_177067_4_, double p_177067_6_) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_))) return; - if (this.func_177070_b(p_177067_1_)) { - double d0 = p_177067_1_.func_195048_a(this.field_76990_c.field_217783_c.func_216785_c()); - float f = p_177067_1_.func_213287_bg() ? 32.0F : 64.0F; -@@ -417,6 +421,7 @@ - this.func_188296_a(p_177067_1_, p_177067_2_, p_177067_4_, p_177067_6_, s, d0); - } - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_)); - } - - protected boolean func_177070_b(T p_177070_1_) { + public static int func_229117_c_(LivingEntity p_229117_0_, float p_229117_1_) { 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 b9ddd8c4a..d63f59757 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch @@ -1,18 +1,12 @@ --- a/net/minecraft/client/renderer/entity/PlayerRenderer.java +++ b/net/minecraft/client/renderer/entity/PlayerRenderer.java -@@ -52,6 +52,7 @@ - public void func_76986_a(AbstractClientPlayerEntity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { - if (!p_76986_1_.func_175144_cb() || this.field_76990_c.field_217783_c.func_216773_g() == p_76986_1_) { - double d0 = p_76986_4_; -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_))) return; - if (p_76986_1_.func_213287_bg()) { - d0 = p_76986_4_ - 0.125D; - } -@@ -61,6 +62,7 @@ - super.func_76986_a(p_76986_1_, p_76986_2_, d0, p_76986_6_, p_76986_8_, p_76986_9_); - GlStateManager.unsetProfile(GlStateManager.Profile.PLAYER_SKIN); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_)); +@@ -58,7 +58,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_); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_225623_1_, this, p_225623_3_, p_225623_4_))) return; + super.func_225623_a_(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_225623_1_, this, p_225623_3_, p_225623_4_)); } - private void func_177137_d(AbstractClientPlayerEntity p_177137_1_) { + public Vec3d 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 index f00083ba2..52d16f687 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/ArmorLayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/ArmorLayer.java.patch @@ -1,58 +1,65 @@ --- a/net/minecraft/client/renderer/entity/layers/ArmorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/ArmorLayer.java -@@ -55,24 +55,25 @@ +@@ -45,21 +45,22 @@ ArmorItem armoritem = (ArmorItem)itemstack.func_77973_b(); - if (armoritem.func_185083_B_() == p_188361_9_) { - A a = this.func_215337_a(p_188361_9_); -+ a = getArmorModelHook(p_188361_1_, itemstack, p_188361_9_, a); + 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_188361_1_, p_188361_2_, p_188361_3_, p_188361_4_); - this.func_188359_a(a, p_188361_9_); - boolean flag = this.func_188363_b(p_188361_9_); -- this.func_215333_a(this.func_177181_a(armoritem, flag)); + 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); -+ this.func_215333_a(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, null)); + if (armoritem instanceof net.minecraft.item.IDyeableArmorItem) { // Allow this for anything, not only cloth + int i = ((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; - GlStateManager.color4f(this.field_177184_f * f, this.field_177185_g * f1, this.field_177192_h * f2, this.field_177187_e); - a.func_78088_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); -- this.func_215333_a(this.func_177178_a(armoritem, flag, "overlay")); -+ this.func_215333_a(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, "overlay")); +- 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)); } - GlStateManager.color4f(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); - a.func_78088_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); -- if (!this.field_177193_i && itemstack.func_77948_v()) { -+ if (!this.field_177193_i && itemstack.func_77962_s()) { - func_215338_a(this::func_215333_a, p_188361_1_, a, p_188361_2_, p_188361_3_, p_188361_4_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); - } - -@@ -125,15 +126,60 @@ - gamerenderer.func_191514_d(false); + } +@@ -67,7 +68,10 @@ } -+ @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation func_177181_a(ArmorItem p_177181_1_, boolean p_177181_2_) { - return this.func_177178_a(p_177181_1_, p_177181_2_, (String)null); + 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(LivingEntity entity, ItemStack itemStack, EquipmentSlotType slot, A model) { ++ protected A getArmorModelHook(T entity, ItemStack itemStack, EquipmentSlotType slot, A model) { + return model; + } + @@ -78,7 +85,7 @@ + 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 = (ResourceLocation)field_177191_j.get(s1); ++ ResourceLocation resourcelocation = field_177191_j.get(s1); + + if (resourcelocation == null) + { @@ -89,6 +96,4 @@ + return resourcelocation; + } + /*=================================== FORGE END ===========================================*/ - protected abstract void func_188359_a(A p_188359_1_, EquipmentSlotType p_188359_2_); - - protected abstract void func_177194_a(A p_177194_1_); + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch index a84e06329..c214801d4 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 @@ -6,7 +6,7 @@ } + + @Override -+ protected A getArmorModelHook(net.minecraft.entity.LivingEntity entity, net.minecraft.item.ItemStack itemStack, EquipmentSlotType slot, A model) { ++ protected A getArmorModelHook(T entity, net.minecraft.item.ItemStack itemStack, EquipmentSlotType slot, A model) { + return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model); + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java.patch deleted file mode 100644 index 0fa5728d4..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java -+++ b/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java -@@ -39,11 +39,12 @@ - private void func_188358_a(LivingEntity p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, HandSide p_188358_4_) { - if (!p_188358_2_.func_190926_b()) { - GlStateManager.pushMatrix(); -- this.func_191361_a(p_188358_4_); - if (p_188358_1_.func_213287_bg()) { - GlStateManager.translatef(0.0F, 0.2F, 0.0F); - } - -+ // Forge: moved this call down, fixes incorrect offset while sneaking. -+ this.func_191361_a(p_188358_4_); - GlStateManager.rotatef(-90.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotatef(180.0F, 0.0F, 1.0F, 0.0F); - boolean flag = p_188358_4_ == HandSide.LEFT; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java.patch deleted file mode 100644 index 4599712ec..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java -+++ b/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java -@@ -41,7 +41,7 @@ - GlStateManager.rotatef(-5.0F, 0.0F, 1.0F, 0.0F); - float f1 = 0.375F; - GlStateManager.scalef(0.375F, -0.375F, 0.375F); -- } else if (item == Items.field_151031_f) { -+ } else if (item instanceof net.minecraft.item.BowItem) { - GlStateManager.translatef(0.0F, 0.125F, -0.125F); - GlStateManager.rotatef(-45.0F, 0.0F, 1.0F, 0.0F); - float f2 = 0.625F; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/model/SkeletonModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/model/SkeletonModel.java.patch index 16800282a..fd6f18443 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 -@@ -41,7 +41,7 @@ +@@ -43,7 +43,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,12 +9,12 @@ if (p_212843_1_.func_184591_cq() == HandSide.RIGHT) { this.field_187076_m = BipedModel.ArmPose.BOW_AND_ARROW; } else { -@@ -55,7 +55,7 @@ - public void func_212844_a_(T p_212844_1_, float p_212844_2_, float p_212844_3_, float p_212844_4_, float p_212844_5_, float p_212844_6_, float p_212844_7_) { - super.func_212844_a_(p_212844_1_, p_212844_2_, p_212844_3_, p_212844_4_, p_212844_5_, p_212844_6_, p_212844_7_); - ItemStack itemstack = p_212844_1_.func_184614_ca(); -- if (p_212844_1_.func_213398_dR() && (itemstack.func_190926_b() || itemstack.func_77973_b() != Items.field_151031_f)) { -+ if (p_212844_1_.func_213398_dR() && (itemstack.func_190926_b() || !(itemstack.func_77973_b() instanceof net.minecraft.item.BowItem))) { +@@ -57,7 +57,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(); +- if (p_225597_1_.func_213398_dR() && (itemstack.func_190926_b() || itemstack.func_77973_b() != Items.field_151031_f)) { ++ if (p_225597_1_.func_213398_dR() && (itemstack.func_190926_b() || !(itemstack.func_77973_b() instanceof net.minecraft.item.BowItem))) { float f = MathHelper.func_76126_a(this.field_217112_c * (float)Math.PI); float f1 = MathHelper.func_76126_a((1.0F - (1.0F - this.field_217112_c) * (1.0F - this.field_217112_c)) * (float)Math.PI); this.field_178723_h.field_78808_h = 0.0F; diff --git a/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch index d8f607690..20970b8fa 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch @@ -1,13 +1,6 @@ --- a/net/minecraft/client/renderer/model/BakedQuad.java +++ b/net/minecraft/client/renderer/model/BakedQuad.java -@@ -6,13 +6,23 @@ - import net.minecraftforge.api.distmarker.OnlyIn; - - @OnlyIn(Dist.CLIENT) --public class BakedQuad { -+public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer { - protected final int[] field_178215_a; - protected final int field_178213_b; +@@ -12,7 +12,17 @@ protected final Direction field_178214_c; protected final TextureAtlasSprite field_187509_d; @@ -18,30 +11,29 @@ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, Direction p_i46574_3_, TextureAtlasSprite p_i46574_4_) { + this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, true, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a); + } -+ ++ + public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, Direction p_i46574_3_, TextureAtlasSprite p_i46574_4_, boolean applyDiffuseLighting, net.minecraft.client.renderer.vertex.VertexFormat format) { + this.format = format; + this.applyDiffuseLighting = applyDiffuseLighting; this.field_178215_a = p_i46574_1_; this.field_178213_b = p_i46574_2_; this.field_178214_c = p_i46574_3_; -@@ -38,4 +48,20 @@ +@@ -34,4 +44,19 @@ public Direction func_178210_d() { return this.field_178214_c; } -+ ++ + protected final net.minecraft.client.renderer.vertex.VertexFormat format; + protected final boolean applyDiffuseLighting; -+ -+ @Override -+ public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { -+ net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); -+ } -+ ++ + public net.minecraft.client.renderer.vertex.VertexFormat getFormat() { + return format; + } -+ ++ ++ public TextureAtlasSprite func_187508_a() { ++ return field_187509_d; ++ } ++ + public boolean shouldApplyDiffuseLighting() { + return applyDiffuseLighting; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/BakedQuadRetextured.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/BakedQuadRetextured.java.patch deleted file mode 100644 index fe4170b8d..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/model/BakedQuadRetextured.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/net/minecraft/client/renderer/model/BakedQuadRetextured.java -+++ b/net/minecraft/client/renderer/model/BakedQuadRetextured.java -@@ -10,17 +10,22 @@ - private final TextureAtlasSprite field_178218_d; - - public BakedQuadRetextured(BakedQuad p_i46217_1_, TextureAtlasSprite p_i46217_2_) { -- super(Arrays.copyOf(p_i46217_1_.func_178209_a(), p_i46217_1_.func_178209_a().length), p_i46217_1_.field_178213_b, FaceBakery.func_178410_a(p_i46217_1_.func_178209_a()), p_i46217_1_.func_187508_a()); -+ super(Arrays.copyOf(p_i46217_1_.func_178209_a(), p_i46217_1_.func_178209_a().length), p_i46217_1_.field_178213_b, FaceBakery.func_178410_a(p_i46217_1_.func_178209_a()), p_i46217_1_.func_187508_a(), p_i46217_1_.shouldApplyDiffuseLighting(), p_i46217_1_.getFormat()); - this.field_178218_d = p_i46217_2_; - this.func_178217_e(); - } - - private void func_178217_e() { - for(int i = 0; i < 4; ++i) { -- int j = 7 * i; -- this.field_178215_a[j + 4] = Float.floatToRawIntBits(this.field_178218_d.func_94214_a((double)this.field_187509_d.func_188537_a(Float.intBitsToFloat(this.field_178215_a[j + 4])))); -- this.field_178215_a[j + 4 + 1] = Float.floatToRawIntBits(this.field_178218_d.func_94207_b((double)this.field_187509_d.func_188536_b(Float.intBitsToFloat(this.field_178215_a[j + 4 + 1])))); -+ int j = format.func_181719_f() * i; -+ int uvIndex = format.func_177344_b(0) / 4; -+ this.field_178215_a[j + uvIndex] = Float.floatToRawIntBits(this.field_178218_d.func_94214_a((double)this.field_187509_d.func_188537_a(Float.intBitsToFloat(this.field_178215_a[j + uvIndex])))); -+ this.field_178215_a[j + uvIndex + 1] = Float.floatToRawIntBits(this.field_178218_d.func_94207_b((double)this.field_187509_d.func_188536_b(Float.intBitsToFloat(this.field_178215_a[j + uvIndex + 1])))); - } -- - } -+ -+ @Override -+ public TextureAtlasSprite func_187508_a() { -+ return field_178218_d; -+ } - } 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 ffa77d300..eb05e31a9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch @@ -1,6 +1,24 @@ --- a/net/minecraft/client/renderer/model/BlockModel.java +++ b/net/minecraft/client/renderer/model/BlockModel.java -@@ -75,6 +75,9 @@ +@@ -56,9 +56,10 @@ + public BlockModel field_178315_d; + @Nullable + protected ResourceLocation field_178316_e; ++ public final net.minecraftforge.client.model.BlockModelConfiguration customData = new net.minecraftforge.client.model.BlockModelConfiguration(this); + + public static BlockModel func_178307_a(Reader p_178307_0_) { +- return JSONUtils.func_193839_a(field_178319_a, p_178307_0_, BlockModel.class); ++ return JSONUtils.func_193839_a(net.minecraftforge.client.model.ModelLoaderRegistry.ExpandedBlockModelDeserializer.INSTANCE, p_178307_0_, BlockModel.class); + } + + public static BlockModel func_178294_a(String p_178294_0_) { +@@ -75,10 +76,15 @@ + this.field_187968_k = p_i46573_7_; + } + ++ @Deprecated + public List func_178298_a() { ++ if (customData.hasCustomGeometry()) return java.util.Collections.emptyList(); return this.field_178314_g.isEmpty() && this.field_178315_d != null ? this.field_178315_d.func_178298_a() : this.field_178314_g; } @@ -10,65 +28,48 @@ public boolean func_178309_b() { return this.field_178315_d != null ? this.field_178315_d.func_178309_b() : this.field_178322_i; } -@@ -91,6 +94,10 @@ +@@ -95,6 +101,10 @@ 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, net.minecraft.client.renderer.vertex.VertexFormat format) { -+ 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, format); ++ 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); + } + public Collection func_187965_e() { Set set = Sets.newHashSet(); -@@ -160,25 +167,33 @@ - return set1; +@@ -138,6 +148,9 @@ + + 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); +@@ -168,7 +181,11 @@ + return this.func_228813_a_(p_225613_1_, this, p_225613_2_, p_225613_3_, p_225613_4_); } -- public IBakedModel func_217641_a(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_) { -- return this.func_217644_a(p_217641_1_, this, p_217641_2_, p_217641_3_); -+ // FORGE: Override our interface method, binary compatible -+ public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, net.minecraft.client.renderer.vertex.VertexFormat format) { -+ if (!net.minecraftforge.client.model.Attributes.moreSpecific(format, net.minecraftforge.client.model.Attributes.DEFAULT_BAKED_FORMAT)) -+ throw new IllegalArgumentException("Cannot bake vanilla model to format other than BLOCK"); -+ return this.bake(bakery, this, spriteGetter, sprite, format); - } - -+ @Deprecated - public IBakedModel func_217644_a(ModelBakery p_217644_1_, BlockModel p_217644_2_, Function p_217644_3_, ISprite p_217644_4_) { -+ return bake(p_217644_1_, p_217644_2_, p_217644_3_, p_217644_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); +- 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_) { ++ 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_) ++ { ++ return net.minecraftforge.client.model.ModelLoaderRegistry.bakeHelper(this, p_228813_1_, p_228813_2_, p_228813_3_, p_228813_4_, p_228813_5_); + } -+ -+ public IBakedModel bake(ModelBakery p_217644_1_, BlockModel p_217644_2_, Function p_217644_3_, ISprite p_217644_4_, net.minecraft.client.renderer.vertex.VertexFormat format) { - TextureAtlasSprite textureatlassprite = p_217644_3_.apply(new ResourceLocation(this.func_178308_c("particle"))); ++ public IBakedModel bakeVanilla(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_) { + 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_217644_1_, p_217644_2_), textureatlassprite); -+ return new BuiltInModel(this.func_181682_g(), this.getOverrides(p_217644_1_, p_217644_2_, p_217644_3_, format), textureatlassprite); - } else { -- SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(this, this.func_217646_a(p_217644_1_, p_217644_2_))).func_177646_a(textureatlassprite); -+ SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(this, this.getOverrides(p_217644_1_, p_217644_2_, p_217644_3_, format))).func_177646_a(textureatlassprite); - - for(BlockPart blockpart : this.func_178298_a()) { - for(Direction direction : blockpart.field_178240_c.keySet()) { - BlockPartFace blockpartface = blockpart.field_178240_c.get(direction); - TextureAtlasSprite textureatlassprite1 = p_217644_3_.apply(new ResourceLocation(this.func_178308_c(blockpartface.field_178242_d))); - if (blockpartface.field_178244_b == null) { -- simplebakedmodel$builder.func_177648_a(func_217645_a(blockpart, blockpartface, textureatlassprite1, direction, p_217644_4_)); -+ simplebakedmodel$builder.func_177648_a(makeBakedQuad(blockpart, blockpartface, textureatlassprite1, direction, p_217644_4_)); - } else { -- simplebakedmodel$builder.func_177650_a(p_217644_4_.func_188048_b().func_177523_a(blockpartface.field_178244_b), func_217645_a(blockpart, blockpartface, textureatlassprite1, direction, p_217644_4_)); -+ simplebakedmodel$builder.func_177650_a(p_217644_4_.getState().apply(java.util.Optional.empty()).map(trsr -> trsr.rotateTransform(blockpartface.field_178244_b)).orElse(blockpartface.field_178244_b), makeBakedQuad(blockpart, blockpartface, textureatlassprite1, direction, p_217644_4_)); - } - } - } -@@ -191,6 +206,10 @@ - return field_217647_g.func_217648_a(p_217645_0_.field_178241_a, p_217645_0_.field_178239_b, p_217645_1_, p_217645_2_, p_217645_3_, p_217645_4_, p_217645_0_.field_178237_d, p_217645_0_.field_178238_e); + return new BuiltInModel(this.func_181682_g(), this.func_217646_a(p_228813_1_, p_228813_2_), textureatlassprite); +@@ -195,6 +212,10 @@ + return field_217647_g.func_228824_a_(p_228812_0_.field_178241_a, p_228812_0_.field_178239_b, p_228812_1_, p_228812_2_, p_228812_3_, p_228812_4_, p_228812_0_.field_178237_d, p_228812_0_.field_178238_e, p_228812_5_); } -+ public static BakedQuad makeBakedQuad(BlockPart p_209567_0, BlockPartFace partFace, TextureAtlasSprite sprite, Direction face, ISprite isprite) { -+ return field_217647_g.makeBakedQuad(p_209567_0.field_178241_a, p_209567_0.field_178239_b, partFace, sprite, face, new net.minecraftforge.client.model.BasicState(isprite.getState().apply(java.util.Optional.empty()).orElse(net.minecraftforge.common.model.TRSRTransformation.identity()), isprite.func_188049_c()), p_209567_0.field_178237_d, p_209567_0.field_178238_e); ++ public static BakedQuad makeBakedQuad(BlockPart p_228812_0_, BlockPartFace p_228812_1_, TextureAtlasSprite p_228812_2_, Direction p_228812_3_, IModelTransform p_228812_4_, ResourceLocation p_228812_5_) { ++ return func_228812_a_(p_228812_0_, p_228812_1_, p_228812_2_, p_228812_3_, p_228812_4_, p_228812_5_); + } + public boolean func_178300_b(String p_178300_1_) { - return !MissingTextureSprite.func_195675_b().toString().equals(this.func_178308_c(p_178300_1_)); + return !MissingTextureSprite.func_195675_b().equals(this.func_228816_c_(p_178300_1_).func_229313_b_()); } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/BlockModelDefinition.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/BlockModelDefinition.java.patch deleted file mode 100644 index 572f963b7..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/model/BlockModelDefinition.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/client/renderer/model/BlockModelDefinition.java -+++ b/net/minecraft/client/renderer/model/BlockModelDefinition.java -@@ -29,10 +29,15 @@ - private final Map field_178332_b = Maps.newLinkedHashMap(); - private Multipart field_188005_c; - -+ @Deprecated - public static BlockModelDefinition func_209577_a(BlockModelDefinition.ContainerHolder p_209577_0_, Reader p_209577_1_) { -- return JSONUtils.func_193839_a(p_209577_0_.field_209575_a, p_209577_1_, BlockModelDefinition.class); -+ return fromJson(p_209577_0_, p_209577_1_, null, null, null); - } - -+ public static BlockModelDefinition fromJson(BlockModelDefinition.ContainerHolder containerHolderIn, Reader readerIn, @Nullable net.minecraft.util.ResourceLocation location, @Nullable ModelBakery bakery, @Nullable java.util.function.BiConsumer modelConsumer) { -+ return net.minecraftforge.client.model.BlockStateLoader.load(readerIn, location, containerHolderIn.field_209575_a, bakery, modelConsumer); -+ } -+ - public BlockModelDefinition(Map p_i46572_1_, Multipart p_i46572_2_) { - this.field_188005_c = p_i46572_2_; - this.field_178332_b.putAll(p_i46572_1_); diff --git a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch index 3e905d21d..81cfaecb5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch @@ -1,101 +1,30 @@ --- a/net/minecraft/client/renderer/model/FaceBakery.java +++ b/net/minecraft/client/renderer/model/FaceBakery.java -@@ -40,9 +40,15 @@ - }; - - public BakedQuad func_217648_a(Vector3f p_217648_1_, Vector3f p_217648_2_, BlockPartFace p_217648_3_, TextureAtlasSprite p_217648_4_, Direction p_217648_5_, ISprite p_217648_6_, @Nullable BlockPartRotation p_217648_7_, boolean p_217648_8_) { -+ return makeBakedQuad(p_217648_1_, p_217648_2_, p_217648_3_, p_217648_4_, p_217648_5_, p_217648_6_, p_217648_7_, p_217648_8_); -+ } -+ -+ public BakedQuad makeBakedQuad(Vector3f p_217648_1_, Vector3f p_217648_2_, BlockPartFace p_217648_3_, TextureAtlasSprite p_217648_4_, Direction p_217648_5_, ISprite p_217648_6_, @Nullable BlockPartRotation p_217648_7_, boolean p_217648_8_) { - BlockFaceUV blockfaceuv = p_217648_3_.field_178243_e; -+ net.minecraftforge.common.model.TRSRTransformation transform = p_217648_6_.getState().apply(java.util.Optional.empty()) -+ .orElse(net.minecraftforge.common.model.TRSRTransformation.identity()); - if (p_217648_6_.func_188049_c()) { -- blockfaceuv = this.func_188010_a(p_217648_3_.field_178243_e, p_217648_5_, p_217648_6_.func_188048_b()); -+ blockfaceuv = net.minecraftforge.client.ForgeHooksClient.applyUVLock(p_217648_3_.field_178243_e, p_217648_5_, transform); +@@ -24,7 +24,7 @@ + public BakedQuad func_228824_a_(Vector3f p_228824_1_, Vector3f p_228824_2_, BlockPartFace p_228824_3_, TextureAtlasSprite p_228824_4_, Direction p_228824_5_, IModelTransform p_228824_6_, @Nullable BlockPartRotation p_228824_7_, boolean p_228824_8_, ResourceLocation p_228824_9_) { + BlockFaceUV blockfaceuv = p_228824_3_.field_178243_e; + if (p_228824_6_.func_188049_c()) { +- blockfaceuv = func_228821_a_(p_228824_3_.field_178243_e, p_228824_5_, p_228824_6_.func_225615_b_(), p_228824_9_); ++ blockfaceuv = net.minecraftforge.client.ForgeHooksClient.applyUVLock(p_228824_3_.field_178243_e, p_228824_5_, p_228824_6_.func_225615_b_(), p_228824_9_); } float[] afloat = new float[blockfaceuv.field_178351_a.length]; -@@ -56,14 +62,15 @@ - blockfaceuv.field_178351_a[2] = MathHelper.func_219799_g(f2, blockfaceuv.field_178351_a[2], f3); - blockfaceuv.field_178351_a[1] = MathHelper.func_219799_g(f2, blockfaceuv.field_178351_a[1], f4); - blockfaceuv.field_178351_a[3] = MathHelper.func_219799_g(f2, blockfaceuv.field_178351_a[3], f4); -- int[] aint = this.func_188012_a(blockfaceuv, p_217648_4_, p_217648_5_, this.func_199337_a(p_217648_1_, p_217648_2_), p_217648_6_.func_188048_b(), p_217648_7_, p_217648_8_); -+ int[] aint = this.makeQuadVertexData(blockfaceuv, p_217648_4_, p_217648_5_, this.func_199337_a(p_217648_1_, p_217648_2_), transform, p_217648_7_, false); // FORGE: *Must* pass false here, shade value is applied at render time - Direction direction = func_178410_a(aint); - System.arraycopy(afloat, 0, blockfaceuv.field_178351_a, 0, afloat.length); - if (p_217648_7_ == null) { +@@ -43,7 +43,8 @@ this.func_178408_a(aint, direction); } -- return new BakedQuad(aint, p_217648_3_.field_178245_c, direction, p_217648_4_); +- 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_217648_3_.field_178245_c, direction, p_217648_4_, p_217648_8_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); ++ return new BakedQuad(aint, p_228824_3_.field_178245_c, direction, p_228824_4_, p_228824_8_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a); } - private BlockFaceUV func_188010_a(BlockFaceUV p_188010_1_, Direction p_188010_2_, ModelRotation p_188010_3_) { -@@ -71,10 +78,14 @@ - } - - private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, Direction p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, @Nullable BlockPartRotation p_188012_6_, boolean p_188012_7_) { -+ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.common.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); -+ } -+ -+ private int[] makeQuadVertexData(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, Direction p_188012_3_, float[] p_188012_4_, net.minecraftforge.common.model.ITransformation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) { - int[] aint = new int[28]; - - for(int i = 0; i < 4; ++i) { -- this.func_188015_a(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); -+ this.fillVertexData(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); - } - - return aint; -@@ -115,12 +126,16 @@ - } - - private void func_188015_a(int[] p_188015_1_, int p_188015_2_, Direction p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, @Nullable BlockPartRotation p_188015_8_, boolean p_188015_9_) { -- Direction direction = p_188015_7_.func_177523_a(p_188015_3_); -+ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.common.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_); -+ } -+ -+ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, Direction p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.common.model.ITransformation p_188015_7_, @Nullable BlockPartRotation p_188015_8_, boolean p_188015_9_) { -+ Direction direction = p_188015_7_.rotateTransform(p_188015_3_); - int i = p_188015_9_ ? this.func_178413_a(direction) : -1; - FaceDirection.VertexInformation facedirection$vertexinformation = FaceDirection.func_179027_a(p_188015_3_).func_179025_a(p_188015_2_); - Vector3f vector3f = new Vector3f(p_188015_5_[facedirection$vertexinformation.field_179184_a], p_188015_5_[facedirection$vertexinformation.field_179182_b], p_188015_5_[facedirection$vertexinformation.field_179183_c]); - this.func_199336_a(vector3f, p_188015_8_); -- int j = this.func_199335_a(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); -+ int j = this.rotateVertex(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); - this.func_199333_a(p_188015_1_, j, p_188015_2_, vector3f, i, p_188015_6_, p_188015_4_); - } - -@@ -130,8 +145,8 @@ - p_199333_1_[i + 1] = Float.floatToRawIntBits(p_199333_4_.func_195900_b()); - p_199333_1_[i + 2] = Float.floatToRawIntBits(p_199333_4_.func_195902_c()); - p_199333_1_[i + 3] = p_199333_5_; -- p_199333_1_[i + 4] = Float.floatToRawIntBits(p_199333_6_.func_94214_a((double)p_199333_7_.func_178348_a(p_199333_3_))); -- p_199333_1_[i + 4 + 1] = Float.floatToRawIntBits(p_199333_6_.func_94207_b((double)p_199333_7_.func_178346_b(p_199333_3_))); -+ p_199333_1_[i + 4] = Float.floatToRawIntBits(p_199333_6_.func_94214_a((double)p_199333_7_.func_178348_a(p_199333_3_) * .999 + p_199333_7_.func_178348_a((p_199333_3_ + 2) % 4) * .001)); -+ p_199333_1_[i + 4 + 1] = Float.floatToRawIntBits(p_199333_6_.func_94207_b((double)p_199333_7_.func_178346_b(p_199333_3_) * .999 + p_199333_7_.func_178346_b((p_199333_3_ + 2) % 4) * .001)); + public static BlockFaceUV func_228821_a_(BlockFaceUV p_228821_0_, Direction p_228821_1_, TransformationMatrix p_228821_2_, ResourceLocation p_228821_3_) { +@@ -152,6 +153,8 @@ + 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)); } private void func_199336_a(Vector3f p_199336_1_, @Nullable BlockPartRotation p_199336_2_) { -@@ -173,11 +188,15 @@ - } - - public int func_199335_a(Vector3f p_199335_1_, Direction p_199335_2_, int p_199335_3_, ModelRotation p_199335_4_) { -+ return rotateVertex(p_199335_1_, p_199335_2_, p_199335_3_, (net.minecraftforge.common.model.ITransformation)p_199335_4_); -+ } -+ -+ public int rotateVertex(Vector3f p_199335_1_, Direction p_199335_2_, int p_199335_3_, net.minecraftforge.common.model.ITransformation p_199335_4_) { - if (p_199335_4_ == ModelRotation.X0_Y0) { - return p_199335_3_; - } else { -- this.func_199334_a(p_199335_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_199335_4_.func_217650_a(), new Vector3f(1.0F, 1.0F, 1.0F)); -- return p_199335_4_.func_177520_a(p_199335_2_, p_199335_3_); -+ net.minecraftforge.client.ForgeHooksClient.transform(p_199335_1_, p_199335_4_.getMatrixVec()); -+ return p_199335_4_.rotate(p_199335_2_, p_199335_3_); - } - } - diff --git a/patches/minecraft/net/minecraft/client/renderer/model/IModelTransform.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/IModelTransform.java.patch new file mode 100644 index 000000000..aab97b675 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/model/IModelTransform.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/renderer/model/IModelTransform.java ++++ b/net/minecraft/client/renderer/model/IModelTransform.java +@@ -5,7 +5,7 @@ + import net.minecraftforge.api.distmarker.OnlyIn; + + @OnlyIn(Dist.CLIENT) +-public interface IModelTransform { ++public interface IModelTransform extends net.minecraftforge.client.extensions.IForgeModelTransform { + default TransformationMatrix func_225615_b_() { + return TransformationMatrix.func_227983_a_(); + } 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 311884632..5308701d9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch @@ -1,22 +1,11 @@ --- a/net/minecraft/client/renderer/model/IUnbakedModel.java +++ b/net/minecraft/client/renderer/model/IUnbakedModel.java -@@ -11,11 +11,17 @@ +@@ -11,7 +11,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) -public interface IUnbakedModel { -+public interface IUnbakedModel extends net.minecraftforge.client.model.IModel { ++public interface IUnbakedModel extends net.minecraftforge.client.extensions.IForgeUnbakedModel { Collection func_187965_e(); - Collection func_209559_a(Function p_209559_1_, Set p_209559_2_); - -+ /** -+ * @deprecated Use {@link #bake(Function, Function, net.minecraftforge.common.model.IModelState, boolean, net.minecraft.client.renderer.vertex.VertexFormat)}. -+ */ - @Nullable -- IBakedModel func_217641_a(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_); -+ @Deprecated -+ default IBakedModel func_217641_a(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_) { -+ return bake(p_217641_1_, p_217641_2_, p_217641_3_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); -+ } - } + Collection func_225614_a_(Function p_225614_1_, Set> p_225614_2_); diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch index 20a1546d9..810547e4f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/model/ItemCameraTransforms.java +++ b/net/minecraft/client/renderer/model/ItemCameraTransforms.java -@@ -12,6 +12,10 @@ +@@ -9,6 +9,10 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -11,7 +11,7 @@ @OnlyIn(Dist.CLIENT) public class ItemCameraTransforms { public static final ItemCameraTransforms field_178357_a = new ItemCameraTransforms(); -@@ -37,6 +41,7 @@ +@@ -25,6 +29,7 @@ this(ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a); } @@ -19,7 +19,7 @@ public ItemCameraTransforms(ItemCameraTransforms p_i46443_1_) { this.field_188036_k = p_i46443_1_.field_188036_k; this.field_188037_l = p_i46443_1_.field_188037_l; -@@ -48,6 +53,7 @@ +@@ -36,6 +41,7 @@ this.field_181700_p = p_i46443_1_.field_181700_p; } @@ -27,20 +27,11 @@ public ItemCameraTransforms(ItemTransformVec3f p_i46569_1_, ItemTransformVec3f p_i46569_2_, ItemTransformVec3f p_i46569_3_, ItemTransformVec3f p_i46569_4_, ItemTransformVec3f p_i46569_5_, ItemTransformVec3f p_i46569_6_, ItemTransformVec3f p_i46569_7_, ItemTransformVec3f p_i46569_8_) { this.field_188036_k = p_i46569_1_; this.field_188037_l = p_i46569_2_; -@@ -80,6 +86,7 @@ - } +@@ -47,6 +53,7 @@ + this.field_181700_p = p_i46569_8_; } + @Deprecated public ItemTransformVec3f func_181688_b(ItemCameraTransforms.TransformType p_181688_1_) { switch(p_181688_1_) { case THIRD_PERSON_LEFT_HAND: -@@ -136,7 +143,7 @@ - } - - @OnlyIn(Dist.CLIENT) -- public static enum TransformType { -+ public static enum TransformType implements net.minecraftforge.common.model.IModelPart { - NONE, - THIRD_PERSON_LEFT_HAND, - THIRD_PERSON_RIGHT_HAND, 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 e173e1ab7..2d4f114db 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch @@ -6,13 +6,13 @@ + @Deprecated //Forge: Use IUnbakedModel, add texture getter 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_.field_177609_j::func_195424_a, p_i50984_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); ++ 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_, net.minecraft.client.renderer.vertex.VertexFormat format) { ++ 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); -+ return Objects.equals(iunbakedmodel, p_i50984_2_) ? null : p_i50984_1_.getBakedModel(p_217649_3_.func_188026_a(), ModelRotation.X0_Y0, textureGetter, format); ++ return Objects.equals(iunbakedmodel, p_i50984_2_) ? null : p_i50984_1_.getBakedModel(p_217649_3_.func_188026_a(), ModelRotation.X0_Y0, textureGetter); }).collect(Collectors.toList()); Collections.reverse(this.field_209582_c); 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 c2b1503f5..fe1d0ff12 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemTransformVec3f.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemTransformVec3f.java.patch @@ -1,17 +1,14 @@ --- a/net/minecraft/client/renderer/model/ItemTransformVec3f.java +++ b/net/minecraft/client/renderer/model/ItemTransformVec3f.java -@@ -12,8 +12,13 @@ +@@ -14,7 +14,11 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +/** -+ * @deprecated use {@link net.minecraftforge.common.model.IModelState} and {@link net.minecraftforge.common.model.TRSRTransformation} ++ * @deprecated use {@link net.minecraft.client.renderer.TransformationMatrix} through {@link net.minecraftforge.client.extensions.IForgeBakedModel#handlePerspective} + */ @OnlyIn(Dist.CLIENT) --public class ItemTransformVec3f { +@Deprecated -+public class ItemTransformVec3f implements net.minecraftforge.common.model.IModelState { -+ public java.util.Optional apply(java.util.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); } + public class ItemTransformVec3f { public static final ItemTransformVec3f field_178366_a = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); public final Vector3f field_178364_b; - public final Vector3f field_178365_c; 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 35ad18cc1..430f7a5dc 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch @@ -1,90 +1,94 @@ --- a/net/minecraft/client/renderer/model/ModelBakery.java +++ b/net/minecraft/client/renderer/model/ModelBakery.java -@@ -97,7 +97,7 @@ - private final Set field_217848_D = Sets.newHashSet(); - private final BlockModelDefinition.ContainerHolder field_209610_F = new BlockModelDefinition.ContainerHolder(); - private final Map field_217849_F = Maps.newHashMap(); -- private final Map, IBakedModel> field_217850_G = Maps.newHashMap(); -+ private final Map, IBakedModel> field_217850_G = Maps.newHashMap(); - private final Map field_217851_H = Maps.newHashMap(); - private final Map field_217852_I = Maps.newHashMap(); - private AtlasTexture.SheetData field_217853_J; -@@ -107,9 +107,17 @@ +@@ -145,9 +145,19 @@ + p_229336_0_.defaultReturnValue(-1); }); - public ModelBakery(IResourceManager p_i51735_1_, AtlasTexture p_i51735_2_, BlockColors p_i51735_3_, IProfiler p_i51735_4_) { -+ this(p_i51735_1_, p_i51735_2_, p_i51735_3_, true); -+ processLoading(p_i51735_4_); +- public ModelBakery(IResourceManager p_i226056_1_, BlockColors p_i226056_2_, IProfiler p_i226056_3_, int p_i226056_4_) { ++ public ModelBakery(IResourceManager p_i226056_1_, BlockColors p_i226056_2_, IProfiler p_i226056_3_, int p_i226056_4_) ++ { ++ this(p_i226056_1_, p_i226056_2_, true); ++ processLoading(p_i226056_3_, p_i226056_4_); + } + -+ protected ModelBakery(IResourceManager p_i51735_1_, AtlasTexture p_i51735_2_, BlockColors p_i51735_3_, boolean vanillaBakery) { - this.field_177598_f = p_i51735_1_; - this.field_177609_j = p_i51735_2_; - this.field_225365_D = p_i51735_3_; ++ protected ModelBakery(IResourceManager p_i226056_1_, BlockColors p_i226056_2_, boolean vanillaBakery) ++ { + this.field_177598_f = p_i226056_1_; + this.field_225365_D = p_i226056_2_; + } + -+ protected void processLoading(IProfiler p_i51735_4_) { - p_i51735_4_.func_76320_a("missing_model"); ++ protected void processLoading(IProfiler p_i226056_3_, int p_i226056_4_) { + p_i226056_3_.func_76320_a("missing_model"); try { -@@ -142,12 +150,19 @@ +@@ -180,12 +190,16 @@ - p_i51735_4_.func_219895_b("special"); + p_i226056_3_.func_219895_b("special"); this.func_217843_a(new ModelResourceLocation("minecraft:trident_in_hand#inventory")); + for (ResourceLocation rl : getSpecialModels()) { -+ // Same as func_217843_a but without restricting to MRL's -+ IUnbakedModel iunbakedmodel = this.func_209597_a(rl); -+ this.field_217849_F.put(rl, iunbakedmodel); -+ this.field_217851_H.put(rl, iunbakedmodel); ++ addModelToCache(rl); + } - p_i51735_4_.func_219895_b("textures"); - Set set = Sets.newLinkedHashSet(); - Set set1 = this.field_217851_H.values().stream().flatMap((p_217838_2_) -> { - return p_217838_2_.func_209559_a(this::func_209597_a, set).stream(); + p_i226056_3_.func_219895_b("textures"); + Set> set = Sets.newLinkedHashSet(); + 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); + net.minecraftforge.client.ForgeHooksClient.gatherFluidTextures(set1); - set.forEach((p_217833_0_) -> { - field_177603_c.warn("Unable to resolve texture reference: {}", (Object)p_217833_0_); - }); -@@ -288,7 +303,7 @@ - { - lvt_13_5_ = this.field_177598_f.func_199004_b(resourcelocation1).stream().map((p_217839_1_) -> { - try (InputStream inputstream = p_217839_1_.func_199027_b()) { -- Pair pair2 = Pair.of(p_217839_1_.func_199026_d(), BlockModelDefinition.func_209577_a(this.field_209610_F, new InputStreamReader(inputstream, StandardCharsets.UTF_8))); -+ Pair pair2 = Pair.of(p_217839_1_.func_199026_d(), BlockModelDefinition.fromJson(this.field_209610_F, new InputStreamReader(inputstream, StandardCharsets.UTF_8), p_209598_1_, this, this::func_209593_a)); - return pair2; - } catch (Exception exception1) { - throw new ModelBakery.BlockStateDefinitionException(String.format("Exception loading blockstate definition: '%s' in resourcepack: '%s': %s", p_217839_1_.func_199029_a(), p_217839_1_.func_199026_d(), exception1.getMessage())); -@@ -404,7 +419,12 @@ + set.stream().filter((p_229346_0_) -> { + return !p_229346_0_.getSecond().equals(field_229321_r_); + }).forEach((p_229330_0_) -> { +@@ -224,6 +238,7 @@ + try { + ibakedmodel = this.func_217845_a(p_229350_1_, ModelRotation.X0_Y0); + } catch (Exception exception) { ++ exception.printStackTrace(); + field_177603_c.warn("Unable to bake model: '{}': {}", p_229350_1_, exception); + } + +@@ -447,6 +462,13 @@ + this.field_217848_D.addAll(p_209593_2_.func_187965_e()); + } + ++ // Same as func_217843_a but without restricting to MRL's ++ private void addModelToCache(ResourceLocation p_217843_1_) { ++ IUnbakedModel iunbakedmodel = this.func_209597_a(p_217843_1_); ++ this.field_217849_F.put(p_217843_1_, iunbakedmodel); ++ this.field_217851_H.put(p_217843_1_, iunbakedmodel); ++ } ++ + 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); +@@ -461,7 +483,13 @@ + } @Nullable - public IBakedModel func_217845_a(ResourceLocation p_217845_1_, ISprite p_217845_2_) { -- Triple triple = Triple.of(p_217845_1_, p_217845_2_.func_188048_b(), p_217845_2_.func_188049_c()); -+ return getBakedModel(p_217845_1_, p_217845_2_, this.field_177609_j::func_195424_a, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); ++ @Deprecated + public IBakedModel func_217845_a(ResourceLocation p_217845_1_, IModelTransform p_217845_2_) { ++ return getBakedModel(p_217845_1_, p_217845_2_, this.field_229322_z_::func_229151_a_); + } + + @Nullable -+ public IBakedModel getBakedModel(ResourceLocation p_217845_1_, ISprite p_217845_2_, java.util.function.Function textureGetter, net.minecraft.client.renderer.vertex.VertexFormat format) { -+ Triple triple = Triple.of(p_217845_1_, p_217845_2_.getState(), p_217845_2_.func_188049_c()); ++ 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); - } else { -@@ -412,11 +432,11 @@ +@@ -472,11 +500,11 @@ if (iunbakedmodel instanceof BlockModel) { BlockModel blockmodel = (BlockModel)iunbakedmodel; if (blockmodel.func_178310_f() == field_177606_o) { -- return field_217854_z.func_209579_a(this.field_177609_j::func_195424_a, blockmodel).func_217644_a(this, blockmodel, this.field_177609_j::func_195424_a, p_217845_2_); -+ return field_217854_z.func_209579_a(textureGetter, blockmodel).func_217644_a(this, blockmodel, textureGetter, p_217845_2_); +- return field_217854_z.func_209579_a(this.field_229322_z_::func_229151_a_, blockmodel).func_228813_a_(this, blockmodel, this.field_229322_z_::func_229151_a_, p_217845_2_, p_217845_1_); ++ return field_217854_z.func_209579_a(textureGetter, blockmodel).func_228813_a_(this, blockmodel, textureGetter, p_217845_2_, p_217845_1_); } } -- IBakedModel ibakedmodel = iunbakedmodel.func_217641_a(this, this.field_177609_j::func_195424_a, p_217845_2_); -+ IBakedModel ibakedmodel = iunbakedmodel.bake(this, this.field_177609_j::func_195424_a, p_217845_2_, format); +- IBakedModel ibakedmodel = iunbakedmodel.func_225613_a_(this, this.field_229322_z_::func_229151_a_, p_217845_2_, p_217845_1_); ++ IBakedModel ibakedmodel = iunbakedmodel.func_225613_a_(this, textureGetter, p_217845_2_, p_217845_1_); this.field_217850_G.put(triple, ibakedmodel); return ibakedmodel; } -@@ -471,6 +491,10 @@ +@@ -530,6 +558,10 @@ return this.field_225367_M; } @@ -95,3 +99,14 @@ @OnlyIn(Dist.CLIENT) static class BlockStateDefinitionException extends RuntimeException { public BlockStateDefinitionException(String p_i49526_1_) { +@@ -537,6 +569,10 @@ + } + } + ++ public SpriteMap getSpriteMap() { ++ return this.field_229322_z_; ++ } ++ + @OnlyIn(Dist.CLIENT) + static class ModelListWrapper { + private final List field_225339_a; 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 7372c957b..90349e1d6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch @@ -1,24 +1,35 @@ --- a/net/minecraft/client/renderer/model/ModelManager.java +++ b/net/minecraft/client/renderer/model/ModelManager.java -@@ -16,7 +16,7 @@ +@@ -18,7 +18,7 @@ @OnlyIn(Dist.CLIENT) - public class ModelManager extends ReloadListener { + public class ModelManager extends ReloadListener implements AutoCloseable { - private Map field_174958_a; + private Map field_174958_a = new java.util.HashMap<>(); - private final AtlasTexture field_174956_b; + private SpriteMap field_229352_b_; private final BlockModelShapes field_174957_c; - private final BlockColors field_224743_d; -@@ -43,7 +43,7 @@ + private final TextureManager field_229353_d_; +@@ -34,6 +34,10 @@ + this.field_174957_c = new BlockModelShapes(this); + } + ++ public IBakedModel getModel(ResourceLocation modelLocation) { ++ return this.field_174958_a.getOrDefault(modelLocation, this.field_174955_d); ++ } ++ + 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 @@ protected ModelBakery func_212854_a_(IResourceManager p_212854_1_, IProfiler p_212854_2_) { p_212854_2_.func_219894_a(); -- ModelBakery modelbakery = new ModelBakery(p_212854_1_, this.field_174956_b, this.field_224743_d, p_212854_2_); -+ net.minecraftforge.client.model.ModelLoader modelbakery = new net.minecraftforge.client.model.ModelLoader(p_212854_1_, this.field_174956_b, this.field_224743_d, p_212854_2_); +- ModelBakery modelbakery = new ModelBakery(p_212854_1_, this.field_224743_d, p_212854_2_, this.field_229354_f_); ++ net.minecraftforge.client.model.ModelLoader modelbakery = new net.minecraftforge.client.model.ModelLoader(p_212854_1_, this.field_224743_d, p_212854_2_, this.field_229354_f_); p_212854_2_.func_219897_b(); return modelbakery; } -@@ -55,6 +55,7 @@ +@@ -60,6 +64,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); @@ -26,9 +37,17 @@ p_212853_3_.func_219895_b("cache"); this.field_174957_c.func_178124_c(); p_212853_3_.func_76319_b(); -@@ -78,4 +79,10 @@ - return true; - } +@@ -85,6 +90,7 @@ + } + + public AtlasTexture func_229356_a_(ResourceLocation p_229356_1_) { ++ if (this.field_229352_b_ == null) throw new RuntimeException("func_229356_a_ called too early!"); + return this.field_229352_b_.func_229152_a_(p_229356_1_); + } + +@@ -95,4 +101,10 @@ + public void func_229355_a_(int p_229355_1_) { + this.field_229354_f_ = p_229355_1_; } + + // TODO diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ModelRotation.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ModelRotation.java.patch deleted file mode 100644 index bee43afd9..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelRotation.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/client/renderer/model/ModelRotation.java -+++ b/net/minecraft/client/renderer/model/ModelRotation.java -@@ -13,7 +13,7 @@ - import net.minecraftforge.api.distmarker.OnlyIn; - - @OnlyIn(Dist.CLIENT) --public enum ModelRotation implements ISprite { -+public enum ModelRotation implements ISprite, net.minecraftforge.common.model.IModelState, net.minecraftforge.common.model.ITransformation { - X0_Y0(0, 0), - X0_Y90(0, 90), - X0_Y180(0, 180), -@@ -102,4 +102,9 @@ - public static ModelRotation func_177524_a(int p_177524_0_, int p_177524_1_) { - return field_177546_q.get(func_177521_b(MathHelper.func_180184_b(p_177524_0_, 360), MathHelper.func_180184_b(p_177524_1_, 360))); - } -+ -+ public java.util.Optional apply(java.util.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); } -+ public javax.vecmath.Matrix4f getMatrixVec() { return net.minecraftforge.common.model.TRSRTransformation.from(this).getMatrixVec(); } -+ public Direction rotateTransform(Direction facing) { return func_177523_a(facing); } -+ public int rotate(Direction facing, int vertexIndex) { return func_177520_a(facing, vertexIndex); } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch index 2eeaa712e..31bd88f7a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch @@ -1,11 +1,13 @@ --- a/net/minecraft/client/renderer/model/SimpleBakedModel.java +++ b/net/minecraft/client/renderer/model/SimpleBakedModel.java -@@ -75,7 +75,7 @@ +@@ -74,6 +74,10 @@ + this(p_i46988_1_.func_178309_b(), p_i46988_1_.func_178311_c(), p_i46988_1_.func_181682_g(), p_i46988_2_); } - public Builder(BlockState p_i48189_1_, IBakedModel p_i48189_2_, TextureAtlasSprite p_i48189_3_, Random p_i48189_4_, long p_i48189_5_) { -- this(p_i48189_2_.func_177555_b(), p_i48189_2_.func_177556_c(), p_i48189_2_.func_177552_f(), p_i48189_2_.func_188617_f()); -+ this(p_i48189_2_.isAmbientOcclusion(p_i48189_1_), p_i48189_2_.func_177556_c(), p_i48189_2_.func_177552_f(), p_i48189_2_.func_188617_f()); - this.field_177652_d = p_i48189_2_.func_177554_e(); - ++ public Builder(net.minecraftforge.client.model.IModelConfiguration model, ItemOverrideList overrides) { ++ this(model.useSmoothLighting(), model.isShadedInGui(), model.getCameraTransforms(), overrides); ++ } ++ + private Builder(boolean p_i46990_1_, boolean p_i46990_2_, ItemCameraTransforms p_i46990_3_, ItemOverrideList p_i46990_4_) { for(Direction direction : Direction.values()) { + this.field_177654_b.put(direction, Lists.newArrayList()); diff --git a/patches/minecraft/net/minecraft/client/renderer/model/Variant.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/Variant.java.patch deleted file mode 100644 index e60c7ec3c..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/model/Variant.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/client/renderer/model/Variant.java -+++ b/net/minecraft/client/renderer/model/Variant.java -@@ -13,7 +13,7 @@ - import net.minecraftforge.api.distmarker.OnlyIn; - - @OnlyIn(Dist.CLIENT) --public class Variant implements ISprite { -+public class Variant implements ISprite, net.minecraftforge.client.model.ISmartVariant { - private final ResourceLocation field_188050_a; - private final ModelRotation field_188051_b; - private final boolean field_188052_c; -@@ -30,6 +30,7 @@ - return this.field_188050_a; - } - -+ @Deprecated - public ModelRotation func_188048_b() { - return this.field_188051_b; - } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch deleted file mode 100644 index fb06a6805..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/client/renderer/model/VariantList.java -+++ b/net/minecraft/client/renderer/model/VariantList.java -@@ -57,14 +57,15 @@ - } - - @Nullable -- public IBakedModel func_217641_a(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_) { -+ @Override -+ public IBakedModel bake(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_, net.minecraft.client.renderer.vertex.VertexFormat format) { - if (this.func_188114_a().isEmpty()) { - return null; - } else { - WeightedBakedModel.Builder weightedbakedmodel$builder = new WeightedBakedModel.Builder(); - - for(Variant variant : this.func_188114_a()) { -- IBakedModel ibakedmodel = p_217641_1_.func_217845_a(variant.func_188046_a(), variant); -+ IBakedModel ibakedmodel = p_217641_1_.getBakedModel(variant.func_188046_a(), variant, p_217641_2_, format); - weightedbakedmodel$builder.func_177677_a(ibakedmodel, variant.func_188047_d()); - } - diff --git a/patches/minecraft/net/minecraft/client/renderer/model/multipart/Multipart.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/multipart/Multipart.java.patch deleted file mode 100644 index 2f4e26539..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/model/multipart/Multipart.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/client/renderer/model/multipart/Multipart.java -+++ b/net/minecraft/client/renderer/model/multipart/Multipart.java -@@ -82,11 +82,12 @@ - } - - @Nullable -- public IBakedModel func_217641_a(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_) { -+ @Override -+ public IBakedModel bake(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_, net.minecraft.client.renderer.vertex.VertexFormat format) { - MultipartBakedModel.Builder multipartbakedmodel$builder = new MultipartBakedModel.Builder(); - - for(Selector selector : this.func_188136_a()) { -- IBakedModel ibakedmodel = selector.func_188165_a().func_217641_a(p_217641_1_, p_217641_2_, p_217641_3_); -+ IBakedModel ibakedmodel = selector.func_188165_a().bake(p_217641_1_, p_217641_2_, p_217641_3_, format); - if (ibakedmodel != null) { - multipartbakedmodel$builder.func_188648_a(selector.func_188166_a(this.field_188140_b), ibakedmodel); - } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch index 2ac45d762..8f9b81131 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch @@ -1,128 +1,28 @@ --- a/net/minecraft/client/renderer/texture/AtlasTexture.java +++ b/net/minecraft/client/renderer/texture/AtlasTexture.java -@@ -80,6 +80,7 @@ +@@ -78,6 +78,7 @@ } } + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); } - public AtlasTexture.SheetData func_215254_a(IResourceManager p_215254_1_, Iterable p_215254_2_, IProfiler p_215254_3_) { + public AtlasTexture.SheetData func_229220_a_(IResourceManager p_229220_1_, Stream p_229220_2_, IProfiler p_229220_3_, int p_229220_4_) { @@ -92,6 +93,7 @@ - set.add(p_215253_1_); - } - }); -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this, set); - int i = this.field_215265_o; - Stitcher stitcher = new Stitcher(i, i, this.field_147636_j); int j = Integer.MAX_VALUE; -@@ -111,6 +113,7 @@ + int k = 1 << p_229220_4_; + p_229220_3_.func_219895_b("extracting_frames"); ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this, set); + + for(TextureAtlasSprite.Info textureatlassprite$info : this.func_215256_a(p_229220_1_, set)) { + j = Math.min(j, Math.min(textureatlassprite$info.func_229250_b_(), textureatlassprite$info.func_229252_c_())); +@@ -106,7 +108,8 @@ int i1 = Math.min(j, k); int j1 = MathHelper.func_151239_c(i1); +- int k1; ++ int k1 = p_229220_4_; + if (false) // FORGE: do not lower the mipmap level - if (j1 < this.field_147636_j) { - field_147635_d.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.field_94254_c, this.field_147636_j, j1, i1); - this.field_147636_j = j1; -@@ -198,6 +201,7 @@ - - label62: { - boolean flag; -+ if (p_195422_2_.hasCustomLoader(p_195422_1_, resourcelocation)) break label62; - try { - iresource = p_195422_1_.func_199002_a(resourcelocation); - p_195422_2_.func_195664_a(iresource, this.field_147636_j + 1); -@@ -275,6 +279,93 @@ - this.field_94258_i.clear(); - } - -+ //=================================================================================================== -+ // Forge Start -+ //=================================================================================================== -+ -+ private final java.util.Deque loadingSprites = new java.util.ArrayDeque<>(); -+ private final java.util.Set loadedSprites = new java.util.HashSet<>(); -+ -+ public String getBasePath() -+ { -+ return field_94254_c; -+ } -+ -+ public int getMipmapLevels() -+ { -+ return field_147636_j; -+ } -+ -+ private int loadTexture(Stitcher stitcher, IResourceManager manager, ResourceLocation resourcelocation, int j, int k) -+ { -+ if (loadedSprites.contains(resourcelocation)) -+ { -+ return j; -+ } -+ TextureAtlasSprite textureatlassprite; -+ ResourceLocation resourcelocation1 = this.func_195420_b(resourcelocation); -+ for (ResourceLocation loading : loadingSprites) -+ { -+ if (resourcelocation1.equals(loading)) -+ { -+ final String error = "circular model dependencies, stack: [" + com.google.common.base.Joiner.on(", ").join(loadingSprites) + "]"; -+ net.minecraftforge.fml.client.ClientHooks.trackBrokenTexture(resourcelocation, error); -+ } -+ } -+ loadingSprites.addLast(resourcelocation1); -+ try (IResource iresource = manager.func_199002_a(resourcelocation1)) -+ { -+ PngSizeInfo pngsizeinfo = new PngSizeInfo(iresource.toString(), iresource.func_199027_b()); -+ AnimationMetadataSection animationmetadatasection = iresource.func_199028_a(AnimationMetadataSection.field_195817_a); -+ textureatlassprite = new TextureAtlasSprite(resourcelocation, pngsizeinfo, animationmetadatasection); -+ -+ for (ResourceLocation dependency : textureatlassprite.getDependencies()) -+ { -+ if (!field_195427_i.contains(dependency)) -+ { -+ this.field_195427_i.add(dependency); -+ } -+ j = loadTexture(stitcher, manager, dependency, j, k); -+ } -+ if (textureatlassprite.hasCustomLoader(manager, resourcelocation)) -+ { -+ if (textureatlassprite.load(manager, resourcelocation, field_94252_e::get)) -+ { -+ return j; -+ } -+ } -+ j = Math.min(j, Math.min(textureatlassprite.func_94211_a(), textureatlassprite.func_94216_b())); -+ int j1 = Math.min(Integer.lowestOneBit(textureatlassprite.func_94211_a()), Integer.lowestOneBit(textureatlassprite.func_94216_b())); -+ if (j1 < k) -+ { -+ // FORGE: do not lower the mipmap level, just log the problematic textures -+ field_147635_d.warn("Texture {} with size {}x{} will have visual artifacts at mip level {}, it can only support level {}." + -+ "Please report to the mod author that the texture should be some multiple of 16x16.", -+ resourcelocation1, textureatlassprite.func_94211_a(), textureatlassprite.func_94216_b(), MathHelper.func_151239_c(k), MathHelper.func_151239_c(j1)); -+ } -+ if (func_195422_a(manager, textureatlassprite)) -+ { -+ stitcher.func_110934_a(textureatlassprite); -+ } -+ return j; -+ } -+ catch (RuntimeException runtimeexception) -+ { -+ net.minecraftforge.fml.client.ClientHooks.trackBrokenTexture(resourcelocation, runtimeexception.getMessage()); -+ return j; -+ } -+ catch (IOException ioexception) -+ { -+ net.minecraftforge.fml.client.ClientHooks.trackMissingTexture(resourcelocation); -+ return j; -+ } -+ finally -+ { -+ loadingSprites.removeLast(); -+ field_195427_i.add(resourcelocation1); -+ } -+ } -+ - @OnlyIn(Dist.CLIENT) - public static class SheetData { - final Set field_217805_a; + if (j1 < p_229220_4_) { + field_147635_d.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.field_229214_j_, p_229220_4_, j1, i1); + k1 = j1; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/ISprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/ISprite.java.patch deleted file mode 100644 index 1a8ce73ab..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/texture/ISprite.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/client/renderer/texture/ISprite.java -+++ b/net/minecraft/client/renderer/texture/ISprite.java -@@ -6,6 +6,10 @@ - - @OnlyIn(Dist.CLIENT) - public interface ISprite { -+ /** -+ * @deprecated Use {@link #getState()} instead. -+ */ -+ @Deprecated - default ModelRotation func_188048_b() { - return ModelRotation.X0_Y0; - } -@@ -13,4 +17,6 @@ - default boolean func_188049_c() { - return false; - } -+ -+ default net.minecraftforge.common.model.IModelState getState() { return func_188048_b(); } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java.patch deleted file mode 100644 index 66a437cc1..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java -+++ b/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java -@@ -39,8 +39,7 @@ - String s = this.field_174949_h.get(i); - if (s != null) { - try ( -- IResource iresource1 = p_195413_1_.func_199002_a(new ResourceLocation(s)); -- NativeImage nativeimage2 = NativeImage.func_195713_a(iresource1.func_199027_b()); -+ NativeImage nativeimage2 = net.minecraftforge.client.MinecraftForgeClient.getImageLayer(new ResourceLocation(s), p_195413_1_); - ) { - int j = this.field_174950_i.get(i).func_196057_c(); - if (nativeimage2.func_195702_a() == nativeimage1.func_195702_a() && nativeimage2.func_195714_b() == nativeimage1.func_195714_b()) { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/LayeredTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/LayeredTexture.java.patch new file mode 100644 index 000000000..9888e39ac --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/LayeredTexture.java.patch @@ -0,0 +1,11 @@ +--- 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/texture/NativeImage.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/NativeImage.java.patch index a964e748e..56ba9fdad 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/NativeImage.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/NativeImage.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/client/renderer/texture/NativeImage.java +++ b/net/minecraft/client/renderer/texture/NativeImage.java -@@ -172,7 +172,7 @@ +@@ -178,7 +178,7 @@ public int func_195709_a(int p_195709_1_, int p_195709_2_) { if (this.field_211680_b != NativeImage.PixelFormat.RGBA) { throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.field_211680_b)); - } else if (p_195709_1_ <= this.field_195719_a && p_195709_2_ <= this.field_195720_b) { + } else if (p_195709_1_ >= 0 && p_195709_2_ >= 0 && p_195709_1_ < this.field_195719_a && p_195709_2_ < this.field_195720_b) { //Fix MC-162953 bounds checks in `NativeImage` this.func_195696_g(); - return MemoryUtil.memIntBuffer(this.field_195722_d, this.field_195723_e).get(p_195709_1_ + p_195709_2_ * this.field_195719_a); - } else { -@@ -183,7 +183,7 @@ + long i = (long)((p_195709_1_ + p_195709_2_ * this.field_195719_a) * 4); + return MemoryUtil.memGetInt(this.field_195722_d + i); +@@ -190,7 +190,7 @@ public void func_195700_a(int p_195700_1_, int p_195700_2_, int p_195700_3_) { if (this.field_211680_b != NativeImage.PixelFormat.RGBA) { throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.field_211680_b)); - } else if (p_195700_1_ <= this.field_195719_a && p_195700_2_ <= this.field_195720_b) { + } else if (p_195700_1_ >= 0 && p_195700_2_ >= 0 && p_195700_1_ < this.field_195719_a && p_195700_2_ < this.field_195720_b) { //Fix MC-162953 bounds checks in `NativeImage` this.func_195696_g(); - MemoryUtil.memIntBuffer(this.field_195722_d, this.field_195723_e).put(p_195700_1_ + p_195700_2_ * this.field_195719_a, p_195700_3_); - } else { -@@ -194,7 +194,7 @@ + long i = (long)((p_195700_1_ + p_195700_2_ * this.field_195719_a) * 4); + MemoryUtil.memPutInt(this.field_195722_d + i, p_195700_3_); +@@ -202,7 +202,7 @@ public byte func_211675_e(int p_211675_1_, int p_211675_2_) { if (!this.field_211680_b.func_211653_r()) { throw new IllegalArgumentException(String.format("no luminance or alpha in %s", this.field_211680_b)); - } else if (p_211675_1_ <= this.field_195719_a && p_211675_2_ <= this.field_195720_b) { + } else if (p_211675_1_ >= 0 && p_211675_2_ >= 0 && p_211675_1_ < this.field_195719_a && p_211675_2_ < this.field_195720_b) { //Fix MC-162953 bounds checks in `NativeImage` - return MemoryUtil.memByteBuffer(this.field_195722_d, this.field_195723_e).get((p_211675_1_ + p_211675_2_ * this.field_195719_a) * this.field_211680_b.func_211651_a() + this.field_211680_b.func_211647_v() / 8); + int i = (p_211675_1_ + p_211675_2_ * this.field_195719_a) * this.field_211680_b.func_211651_a() + this.field_211680_b.func_211647_v() / 8; + return MemoryUtil.memGetByte(this.field_195722_d + (long)i); } else { - throw new IllegalArgumentException(String.format("(%s, %s) outside of image bounds (%s, %s)", p_211675_1_, p_211675_2_, this.field_195719_a, this.field_195720_b)); -@@ -328,7 +328,7 @@ +@@ -336,7 +336,7 @@ } public void func_211676_a(STBTTFontinfo p_211676_1_, int p_211676_2_, int p_211676_3_, int p_211676_4_, float p_211676_5_, float p_211676_6_, float p_211676_7_, float p_211676_8_, int p_211676_9_, int p_211676_10_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index a03c65ff8..a9d567689 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -14,15 +14,15 @@ for(Stitcher.Holder stitcher$holder : list) { if (!this.func_94310_b(stitcher$holder)) { + LOGGER.info(new net.minecraftforge.fml.loading.AdvancedLogMessageAdapter(sb->{ -+ sb.append("Unable to fit: ").append(stitcher$holder.field_98151_a.func_195668_m()); -+ sb.append(" - size: ").append(stitcher$holder.field_98151_a.func_94211_a()).append("x").append(stitcher$holder.field_98151_a.func_94216_b()); ++ sb.append("Unable to fit: ").append(stitcher$holder.field_229213_a_.func_229248_a_()); ++ sb.append(" - size: ").append(stitcher$holder.field_229213_a_.func_229250_b_()).append("x").append(stitcher$holder.field_229213_a_.func_229252_c_()); + sb.append(" - Maybe try a lower resolution resourcepack?\n"); + list.forEach(h-> sb.append("\t").append(h).append("\n")); + })); - throw new StitcherException(stitcher$holder.field_98151_a, list.stream().map((p_225334_0_) -> { - return p_225334_0_.field_98151_a; + throw new StitcherException(stitcher$holder.field_229213_a_, list.stream().map((p_229212_0_) -> { + return p_229212_0_.field_229213_a_; }).collect(ImmutableList.toImmutableList())); -@@ -107,7 +115,7 @@ +@@ -103,7 +111,7 @@ boolean flag4 = flag2 && j != l; boolean flag; if (flag3 ^ flag4) { @@ -31,12 +31,12 @@ } else { flag = flag1 && i <= j; } -@@ -144,7 +152,7 @@ +@@ -140,7 +148,7 @@ } public String toString() { - return "Holder{width=" + this.field_94204_c + ", height=" + this.field_94201_d + '}'; -+ return "Holder{width=" + this.field_94204_c + ", height=" + this.field_94201_d + ", name=" + this.field_98151_a.func_195668_m() + '}'; ++ return "Holder{width=" + this.field_94204_c + ", height=" + this.field_94201_d + ", name=" + this.field_229213_a_.func_229248_a_() + '}'; } } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch new file mode 100644 index 000000000..ac34344c5 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/client/renderer/texture/Texture.java ++++ b/net/minecraft/client/renderer/texture/Texture.java +@@ -33,6 +33,11 @@ + GlStateManager.func_227677_b_(3553, 10240, j); + } + ++ // FORGE: This seems to have been stripped out, but we need it ++ public void restoreLastBlurMipmap() { ++ func_174937_a(this.field_174940_b, this.field_174941_c); ++ } ++ + public int func_110552_b() { + RenderSystem.assertThread(RenderSystem::isOnRenderThreadOrInit); + if (this.field_110553_a == -1) { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index 61e65aa99..965514c91 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -1,55 +1,30 @@ --- a/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +++ b/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -18,7 +18,7 @@ +@@ -17,7 +17,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) --public class TextureAtlasSprite { -+public class TextureAtlasSprite implements net.minecraftforge.client.extensions.IForgeTextureAtlasSprite { - private final ResourceLocation field_110984_i; - protected final int field_130223_c; - protected final int field_130224_d; -@@ -103,7 +103,10 @@ - anativeimage[k1] = this.field_195670_c[k1]; - } else { - NativeImage nativeimage1 = anativeimage[k1 - 1]; -- NativeImage nativeimage = new NativeImage(nativeimage1.func_195702_a() >> 1, nativeimage1.func_195714_b() >> 1, false); -+ int width = nativeimage1.func_195702_a() >> 1; -+ int height = nativeimage1.func_195714_b() >> 1; -+ if (width > 0 && height > 0) { // FORGE force higher mipmap levels when a texture is not square -+ NativeImage nativeimage = new NativeImage(width, height, false); - int k = nativeimage.func_195702_a(); - int l = nativeimage.func_195714_b(); - -@@ -112,8 +115,11 @@ - nativeimage.func_195700_a(i1, j1, func_195661_b(nativeimage1.func_195709_a(i1 * 2 + 0, j1 * 2 + 0), nativeimage1.func_195709_a(i1 * 2 + 1, j1 * 2 + 0), nativeimage1.func_195709_a(i1 * 2 + 0, j1 * 2 + 1), nativeimage1.func_195709_a(i1 * 2 + 1, j1 * 2 + 1), flag)); - } - } -- -+ - anativeimage[k1] = nativeimage; -+ } else { -+ anativeimage[k1] = nativeimage1; -+ } - } - } - -@@ -209,6 +215,7 @@ +-public class TextureAtlasSprite implements AutoCloseable { ++public class TextureAtlasSprite implements AutoCloseable, net.minecraftforge.client.extensions.IForgeTextureAtlasSprite { + private final AtlasTexture field_229225_b_; + private final TextureAtlasSprite.Info field_229226_c_; + private final AnimationMetadataSection field_110982_k; +@@ -135,6 +135,7 @@ private void func_195667_a(int p_195667_1_, int p_195667_2_, NativeImage[] p_195667_3_) { for(int i = 0; i < this.field_195670_c.length; ++i) { -+ if ((this.field_130223_c >> i <= 0) || (this.field_130224_d >> i <= 0)) break; - p_195667_3_[i].func_195706_a(i, this.field_110975_c >> i, this.field_110974_d >> i, p_195667_1_ >> i, p_195667_2_ >> i, this.field_130223_c >> i, this.field_130224_d >> i, this.field_195670_c.length > 1); ++ if ((this.field_229226_c_.field_229245_b_ >> i <= 0) || (this.field_229226_c_.field_229246_c_ >> i <= 0)) break; + p_195667_3_[i].func_227788_a_(i, this.field_110975_c >> i, this.field_110974_d >> i, p_195667_1_ >> i, p_195667_2_ >> i, this.field_229226_c_.field_229245_b_ >> i, this.field_229226_c_.field_229246_c_ >> i, this.field_195670_c.length > 1, false); } -@@ -464,4 +471,10 @@ - public void func_195663_q() { - this.func_195659_d(0); +@@ -341,4 +342,10 @@ + + } } + + // Forge Start + + public int getPixelRGBA(int frameIndex, int x, int y) { -+ return this.field_195670_c[frameIndex].func_195709_a(x + this.field_195671_d[frameIndex] * this.field_130223_c, y + this.field_195672_e[frameIndex] * this.field_130224_d); ++ return this.field_195670_c[frameIndex].func_195709_a(x + this.field_195671_d[frameIndex] * func_94211_a(), y + this.field_195672_e[frameIndex] * func_94216_b()); + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch index 5fc848c9d..51c624e09 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -1,19 +1,10 @@ --- a/net/minecraft/client/renderer/texture/TextureManager.java +++ b/net/minecraft/client/renderer/texture/TextureManager.java -@@ -49,7 +49,7 @@ - } - - public boolean func_110580_a(ResourceLocation p_110580_1_, ITickableTextureObject p_110580_2_) { -- if (this.func_110579_a(p_110580_1_, p_110580_2_)) { -+ if (this.func_110579_a(p_110580_1_, (ITextureObject)p_110580_2_)) { //TODO: Move to MCPConfig - this.field_110583_b.add(p_110580_2_); - return true; - } else { -@@ -125,6 +125,7 @@ +@@ -140,6 +140,7 @@ public void func_147645_c(ResourceLocation p_147645_1_) { - ITextureObject itextureobject = this.func_110581_b(p_147645_1_); - if (itextureobject != null) { + Texture texture = this.func_229267_b_(p_147645_1_); + if (texture != null) { + this.field_110585_a.remove(p_147645_1_); // Forge: fix MC-98707 - TextureUtil.releaseTextureId(itextureobject.func_110552_b()); + TextureUtil.func_225679_a_(texture.func_110552_b()); } 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 1cedcfd30..f28783991 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch @@ -1,10 +1,16 @@ --- a/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java +++ b/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java -@@ -70,6 +70,7 @@ +@@ -61,8 +61,12 @@ } - private boolean func_188186_a(BlockPos p_188186_1_, BlockState p_188186_2_, BufferBuilder p_188186_3_, World p_188186_4_, boolean p_188186_5_) { + 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_); ++ 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); + if (field_178462_c == null) field_178462_c = Minecraft.func_71410_x().func_175602_ab(); - return this.field_178462_c.func_175019_b().func_217631_a(p_188186_4_, this.field_178462_c.func_184389_a(p_188186_2_), p_188186_2_, p_188186_1_, p_188186_3_, p_188186_5_, new Random(), p_188186_2_.func_209533_a(p_188186_1_)); + this.field_178462_c.func_175019_b().func_228802_a_(p_228876_5_, this.field_178462_c.func_184389_a(p_228876_2_), p_228876_2_, p_228876_1_, p_228876_3_, ivertexbuilder, p_228876_6_, new Random(), p_228876_2_.func_209533_a(p_228876_1_), p_228876_7_); ++ }); ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java.patch deleted file mode 100644 index 03807de7a..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java -+++ b/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java -@@ -66,6 +66,8 @@ - return false; - } - -+ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.BufferBuilder buffer) {} -+ - protected void func_190052_a(T p_190052_1_, String p_190052_2_, double p_190052_3_, double p_190052_5_, double p_190052_7_, int p_190052_9_) { - ActiveRenderInfo activerenderinfo = this.field_147501_a.field_217666_g; - double d0 = p_190052_1_.func_145835_a(activerenderinfo.func_216785_c().field_72450_a, activerenderinfo.func_216785_c().field_72448_b, activerenderinfo.func_216785_c().field_72449_c); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch index 4dbf8cfa1..3a418208a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch @@ -1,84 +1,12 @@ --- a/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java +++ b/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java -@@ -89,7 +89,7 @@ - - @Nullable - public TileEntityRenderer func_147547_b(@Nullable TileEntity p_147547_1_) { -- return p_147547_1_ == null ? null : this.func_147546_a(p_147547_1_.getClass()); -+ return p_147547_1_ == null || p_147547_1_.func_145837_r() ? null : this.func_147546_a(p_147547_1_.getClass()); - } - - public void func_217665_a(World p_217665_1_, TextureManager p_217665_2_, FontRenderer p_217665_3_, ActiveRenderInfo p_217665_4_, RayTraceResult p_217665_5_) { -@@ -105,12 +105,14 @@ - - public void func_180546_a(TileEntity p_180546_1_, float p_180546_2_, int p_180546_3_) { - if (p_180546_1_.func_145835_a(this.field_217666_g.func_216785_c().field_72450_a, this.field_217666_g.func_216785_c().field_72448_b, this.field_217666_g.func_216785_c().field_72449_c) < p_180546_1_.func_145833_n()) { -+ if(!drawingBatch || !p_180546_1_.hasFastRenderer()) { - RenderHelper.func_74519_b(); - int i = this.field_147550_f.func_217338_b(p_180546_1_.func_174877_v(), 0); - int j = i % 65536; - int k = i / 65536; - GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float)j, (float)k); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); -+ } - BlockPos blockpos = p_180546_1_.func_174877_v(); - this.func_203602_a(p_180546_1_, (double)blockpos.func_177958_n() - field_147554_b, (double)blockpos.func_177956_o() - field_147555_c, (double)blockpos.func_177952_p() - field_147552_d, p_180546_2_, p_180546_3_, false); - } -@@ -130,6 +132,10 @@ - if (tileentityrenderer != null) { - try { - if (p_203602_10_ || p_203602_1_.func_145830_o() && p_203602_1_.func_200662_C().func_223045_a(p_203602_1_.func_195044_w().func_177230_c())) { -+ -+ if(drawingBatch && p_203602_1_.hasFastRenderer()) -+ tileentityrenderer.renderTileEntityFast(p_203602_1_, p_203602_2_, p_203602_4_, p_203602_6_, p_203602_8_, p_203602_9_, batchBuffer.func_178180_c()); -+ else - tileentityrenderer.func_199341_a(p_203602_1_, p_203602_2_, p_203602_4_, p_203602_6_, p_203602_8_, p_203602_9_); - } - } catch (Throwable throwable) { -@@ -153,4 +159,46 @@ +@@ -141,4 +141,9 @@ public FontRenderer func_147548_a() { return this.field_147557_n; } + -+ /** -+ * Buffer used for batched TESRs -+ */ -+ private net.minecraft.client.renderer.Tessellator batchBuffer = new net.minecraft.client.renderer.Tessellator(0x200000); -+ private boolean drawingBatch = false; -+ -+ /** -+ * Prepare for a batched TESR rendering. -+ * You probably shouldn't call this manually. -+ */ -+ public void preDrawBatch() { -+ batchBuffer.func_178180_c().func_181668_a(org.lwjgl.opengl.GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a); -+ drawingBatch = true; -+ } -+ -+ /** -+ * Render all TESRs batched so far. -+ * You probably shouldn't call this manually. -+ */ -+ public void drawBatch() { -+ field_147553_e.func_110577_a(net.minecraft.client.renderer.texture.AtlasTexture.field_110575_b); -+ net.minecraft.client.renderer.RenderHelper.func_74518_a(); -+ GlStateManager.blendFunc(org.lwjgl.opengl.GL11.GL_SRC_ALPHA, org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA); -+ GlStateManager.enableBlend(); -+ GlStateManager.disableCull(); -+ -+ if (net.minecraft.client.Minecraft.func_71379_u()) -+ GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_SMOOTH); -+ else -+ GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_FLAT); -+ -+ batchBuffer.func_78381_a(); -+ -+ net.minecraft.client.renderer.RenderHelper.func_74519_b(); -+ drawingBatch = false; -+ } -+ + //Internal, Do not call Use ClientRegistry. -+ public synchronized void setSpecialRenderer(Class tileEntityClass, TileEntityRenderer specialRenderer) { -+ this.field_147559_m.put(tileEntityClass, specialRenderer); ++ public synchronized void setSpecialRendererInternal(TileEntityType tileEntityType, TileEntityRenderer specialRenderer) { ++ this.field_147559_m.put(tileEntityType, specialRenderer); + } } 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 0f957ea02..74b6a9a62 100644 --- a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java.patch @@ -1,38 +1,14 @@ --- a/net/minecraft/client/renderer/vertex/VertexFormat.java +++ b/net/minecraft/client/renderer/vertex/VertexFormat.java -@@ -16,6 +16,7 @@ - private int field_177354_e = -1; - private final List field_177351_f = Lists.newArrayList(); - private int field_177352_g = -1; -+ private int hashCode; +@@ -84,4 +84,11 @@ - public VertexFormat(VertexFormat p_i46097_1_) { - this(); -@@ -37,6 +38,7 @@ - this.field_177351_f.clear(); - this.field_177352_g = -1; - this.field_177353_d = 0; -+ this.hashCode = 0; - } - - public VertexFormat func_181721_a(VertexFormatElement p_181721_1_) { -@@ -58,6 +60,7 @@ - } - - this.field_177353_d += p_181721_1_.func_177368_f(); -+ this.hashCode = 0; - return this; } } -@@ -152,9 +155,11 @@ - } - - public int hashCode() { -+ if (this.hashCode != 0) return this.hashCode; - int i = this.field_177355_b.hashCode(); - i = 31 * i + this.field_177356_c.hashCode(); - i = 31 * i + this.field_177353_d; -+ this.hashCode = i; - return i; - } ++ ++ // 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 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.COLOR && 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 deleted file mode 100644 index 42806e1d1..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/client/renderer/vertex/VertexFormatElement.java -+++ b/net/minecraft/client/renderer/vertex/VertexFormatElement.java -@@ -124,10 +124,17 @@ - NORMAL("Normal"), - COLOR("Vertex Color"), - UV("UV"), -+ // As of 1.8.8 - unused in vanilla; use GENERIC for now -+ @Deprecated - MATRIX("Bone Matrix"), -+ @Deprecated - BLEND_WEIGHT("Blend Weight"), -- PADDING("Padding"); -+ PADDING("Padding"), -+ GENERIC("Generic"); - -+ public void preDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, format, element, stride, buffer); } -+ public void postDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, format, element, stride, buffer); } -+ - private final String field_177392_h; - - private Usage(String p_i46094_3_) { diff --git a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch index 3dc3c4bc6..57913a8b3 100644 --- a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch @@ -28,7 +28,7 @@ - KeyBinding keybinding = field_74514_b.get(p_197980_0_); + for (KeyBinding keybinding : field_74514_b.lookupAll(p_197980_0_)) if (keybinding != null) { - keybinding.field_74513_e = p_197980_1_; + keybinding.func_225593_a_(p_197980_1_); } @@ -67,10 +67,10 @@ } @@ -102,7 +102,7 @@ String s = this.field_74512_d.func_197935_d(); int i = this.field_74512_d.func_197937_c(); String s1 = null; -@@ -171,13 +192,94 @@ +@@ -171,16 +192,97 @@ } return s1 == null ? I18n.func_135052_a(s) : s1; @@ -117,7 +117,7 @@ public String func_197982_m() { return this.field_74512_d.func_197935_d(); } -+ + + /****************** 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; @@ -197,4 +197,7 @@ + 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/world/ClientWorld.java.patch b/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch index 5d21914dc..a07b850b4 100644 --- a/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/world/ClientWorld.java +++ b/net/minecraft/client/world/ClientWorld.java -@@ -87,6 +87,8 @@ +@@ -103,6 +103,8 @@ this.func_175652_B(new BlockPos(8, 64, 8)); this.func_72966_v(); this.func_72947_a(); @@ -9,15 +9,15 @@ } public void func_72835_b(BooleanSupplier p_72835_1_) { -@@ -111,6 +113,7 @@ +@@ -127,6 +129,7 @@ Entity entity = this.field_217428_a.get(i); - this.func_217390_a((p_217415_0_) -> { - ++p_217415_0_.field_70173_aa; -+ if (p_217415_0_.canUpdate()) - p_217415_0_.func_70071_h_(); + 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) { -@@ -158,6 +161,7 @@ +@@ -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(); }); @@ -25,19 +25,19 @@ p_217418_1_.func_70071_h_(); this.func_217381_Z().func_76319_b(); } -@@ -265,9 +269,11 @@ +@@ -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_.field_70165_t / 16.0D), MathHelper.func_76128_c(p_217424_2_.field_70161_v / 16.0D), ChunkStatus.field_222617_m, true).func_76612_a(p_217424_2_); + 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_) { -@@ -286,6 +292,7 @@ +@@ -310,6 +316,7 @@ } this.field_217431_w.remove(p_217414_1_); @@ -45,7 +45,7 @@ } public void func_217417_b(Chunk p_217417_1_) { -@@ -411,6 +418,11 @@ +@@ -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_) { @@ -57,7 +57,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); } -@@ -418,6 +430,11 @@ +@@ -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_) { diff --git a/patches/minecraft/net/minecraft/command/Commands.java.patch b/patches/minecraft/net/minecraft/command/Commands.java.patch index a86deb5cb..5fd933cf8 100644 --- a/patches/minecraft/net/minecraft/command/Commands.java.patch +++ b/patches/minecraft/net/minecraft/command/Commands.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/command/Commands.java +++ b/net/minecraft/command/Commands.java -@@ -183,7 +183,15 @@ +@@ -194,7 +194,15 @@ try { try { diff --git a/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch b/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch index 0daa24a42..431af2cc0 100644 --- a/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch +++ b/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch @@ -1,17 +1,16 @@ --- a/net/minecraft/command/arguments/EntitySelectorParser.java +++ b/net/minecraft/command/arguments/EntitySelectorParser.java -@@ -448,6 +448,10 @@ +@@ -448,6 +448,9 @@ } this.field_197417_j.skip(); + EntitySelector forgeSelector = net.minecraftforge.common.command.EntitySelectorManager.parseSelector(this); -+ if (forgeSelector != null) { ++ if (forgeSelector != null) + return forgeSelector; -+ } this.func_197403_b(); } else { this.func_197382_c(); -@@ -463,6 +467,7 @@ +@@ -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")); diff --git a/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch b/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch index 8f73df010..fa26229b8 100644 --- a/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch @@ -9,36 +9,36 @@ 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_); -@@ -51,13 +51,8 @@ - }); - ValidationResults validationresults = new ValidationResults(); +@@ -53,13 +53,8 @@ + return null; + }, map::get); - for(ResourceLocation resourcelocation : Sets.difference(LootTables.func_215796_a(), map.keySet())) { -- validationresults.func_216105_a("Missing built-in table: " + resourcelocation); +- validationtracker.func_227530_a_("Missing built-in table: " + resourcelocation); - } -+ validate(map, validationresults); ++ validate(map, validationtracker); -- map.forEach((p_218436_2_, p_218436_3_) -> { -- LootTableManager.func_215302_a(validationresults, p_218436_2_, p_218436_3_, map::get); +- map.forEach((p_229439_1_, p_229439_2_) -> { +- LootTableManager.func_227508_a_(validationtracker, p_229439_1_, p_229439_2_); - }); - Multimap multimap = validationresults.func_216106_a(); + Multimap multimap = validationtracker.func_227527_a_(); if (!multimap.isEmpty()) { - multimap.forEach((p_218435_0_, p_218435_1_) -> { -@@ -78,6 +73,20 @@ + multimap.forEach((p_229440_0_, p_229440_1_) -> { +@@ -80,6 +75,20 @@ } } + protected List>>, LootParameterSet>> getTables() { -+ return field_218444_e; ++ return field_218444_e; + } + -+ protected void validate(Map map, ValidationResults validationresults) { ++ protected void validate(Map map, ValidationTracker validationtracker) { + for(ResourceLocation resourcelocation : Sets.difference(LootTables.func_215796_a(), map.keySet())) { -+ validationresults.func_216105_a("Missing built-in table: " + resourcelocation); ++ validationtracker.func_227530_a_("Missing built-in table: " + resourcelocation); + } + + map.forEach((p_218436_2_, p_218436_3_) -> { -+ LootTableManager.func_215302_a(validationresults, p_218436_2_, p_218436_3_, map::get); ++ LootTableManager.func_227508_a_(validationtracker, p_218436_2_, p_218436_3_); + }); + } + diff --git a/patches/minecraft/net/minecraft/data/Main.java.patch b/patches/minecraft/net/minecraft/data/Main.java.patch index 8cf8910bf..4b2e7ed2d 100644 --- a/patches/minecraft/net/minecraft/data/Main.java.patch +++ b/patches/minecraft/net/minecraft/data/Main.java.patch @@ -1,18 +1,11 @@ --- a/net/minecraft/data/Main.java +++ b/net/minecraft/data/Main.java -@@ -1,5 +1,6 @@ - package net.minecraft.data; - -+import java.io.File; - import java.io.IOException; - import java.nio.file.Path; - import java.nio.file.Paths; -@@ -21,8 +22,11 @@ +@@ -21,8 +21,11 @@ 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(File.class).defaultsTo(new File(".")).required(); ++ 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(","); OptionSet optionset = optionparser.parse(p_main_0_); - if (!optionset.has(optionspec) && optionset.hasOptions()) { @@ -20,7 +13,7 @@ Path path = Paths.get(optionspec7.value(optionset)); boolean flag = optionset.has(optionspec6); boolean flag1 = flag || optionset.has(optionspec2); -@@ -30,10 +34,12 @@ +@@ -30,10 +33,12 @@ boolean flag3 = flag || optionset.has(optionspec3); boolean flag4 = flag || optionset.has(optionspec4); boolean flag5 = flag || optionset.has(optionspec5); diff --git a/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch b/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch index 894fb0051..7bf7bb49c 100644 --- a/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/RecipeProvider.java +++ b/net/minecraft/data/RecipeProvider.java -@@ -58,6 +58,7 @@ +@@ -57,6 +57,7 @@ } }); diff --git a/patches/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch b/patches/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch index 98f113321..3301eee73 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 -@@ -188,7 +188,7 @@ +@@ -204,7 +204,7 @@ return LootTable.func_216119_b(); } @@ -9,8 +9,8 @@ this.func_218492_c(Blocks.field_196650_c); this.func_218492_c(Blocks.field_196652_d); this.func_218492_c(Blocks.field_196654_e); -@@ -962,9 +962,13 @@ - this.func_218507_a(Blocks.field_196713_dt, func_218482_a()); +@@ -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()); + } @@ -24,7 +24,7 @@ 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); -@@ -981,6 +985,10 @@ +@@ -995,6 +999,10 @@ } } @@ -33,5 +33,5 @@ + } + public void func_218547_a(Block p_218547_1_) { - this.func_218522_a(p_218547_1_, (p_218524_0_) -> { - return func_218523_c(((FlowerPotBlock)p_218524_0_).func_220276_d()); + 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/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch b/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch index 773f2d974..793278692 100644 --- a/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch @@ -8,8 +8,8 @@ + 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_200792_f, 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_151072_bj).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_212840_b_(KilledByPlayer.func_215994_b()))); -@@ -136,8 +136,12 @@ + 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)))); @@ -23,7 +23,7 @@ EntityType entitytype; ResourceLocation resourcelocation; -@@ -149,7 +153,7 @@ +@@ -150,7 +154,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; } -@@ -166,6 +170,14 @@ +@@ -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))); } diff --git a/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch index 0fa8480c8..ca367b12c 100644 --- a/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch +++ b/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/dispenser/IDispenseItemBehavior.java +++ b/net/minecraft/dispenser/IDispenseItemBehavior.java -@@ -270,8 +270,9 @@ +@@ -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))); @@ -12,9 +12,9 @@ world.func_217377_a(blockpos, false); } else { this.field_218407_b = false; -@@ -370,15 +371,23 @@ - } - +@@ -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_) { diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 7dcf52ead..91f50c0dd 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/enchantment/EnchantmentHelper.java +++ b/net/minecraft/enchantment/EnchantmentHelper.java -@@ -258,7 +258,7 @@ +@@ -262,7 +262,7 @@ public static int func_77514_a(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) { Item item = p_77514_3_.func_77973_b(); @@ -9,7 +9,7 @@ if (i <= 0) { return 0; } else { -@@ -296,7 +296,7 @@ +@@ -300,7 +300,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,7 +18,7 @@ if (i <= 0) { return list; } else { -@@ -349,7 +349,7 @@ +@@ -353,7 +353,7 @@ boolean flag = p_185291_1_.func_77973_b() == Items.field_151122_aG; for(Enchantment enchantment : Registry.field_212628_q) { diff --git a/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch index 9bb4a1ab4..89dbd7257 100644 --- a/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch @@ -2,14 +2,14 @@ +++ b/net/minecraft/enchantment/FrostWalkerEnchantment.java @@ -42,9 +42,10 @@ if (blockpos.func_218137_a(p_185266_0_.func_213303_ch(), (double)f)) { - blockpos$mutableblockpos.func_181079_c(blockpos.func_177958_n(), blockpos.func_177956_o() + 1, blockpos.func_177952_p()); - BlockState blockstate1 = p_185266_1_.func_180495_p(blockpos$mutableblockpos); + 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$mutableblockpos)) { ++ 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_217350_a(blockstate, blockpos, ISelectionContext.func_216377_a())) { +- 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_217350_a(blockstate, blockpos, ISelectionContext.func_216377_a()) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_185266_0_, new net.minecraftforge.common.util.BlockSnapshot(p_185266_1_, blockpos, blockstate2), net.minecraft.util.Direction.UP)) { ++ 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/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index e70ac5b79..de31fae54 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 -@@ -104,12 +104,13 @@ +@@ -105,12 +105,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -15,7 +15,7 @@ private final EntityType field_200606_g; private int field_145783_c = field_213331_b.incrementAndGet(); public boolean field_70156_m; -@@ -136,6 +137,7 @@ +@@ -138,6 +139,7 @@ public boolean field_70132_H; public boolean field_70133_I; protected Vec3d field_213328_B = Vec3d.field_186680_a; @@ -23,7 +23,7 @@ public boolean field_70128_L; public float field_70141_P; public float field_70140_Q; -@@ -197,6 +199,7 @@ +@@ -196,6 +198,7 @@ private float field_213326_aJ; public Entity(EntityType p_i48580_1_, World p_i48580_2_) { @@ -31,7 +31,7 @@ this.field_200606_g = p_i48580_1_; this.field_70170_p = p_i48580_2_; this.field_213325_aI = p_i48580_1_.func_220334_j(); -@@ -214,7 +217,9 @@ +@@ -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(); @@ -41,8 +41,17 @@ + this.gatherCapabilities(); } - public boolean func_175149_v() { -@@ -303,7 +308,13 @@ + @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() { @@ -57,37 +66,23 @@ protected void func_213301_b(Pose p_213301_1_) { @@ -323,6 +334,7 @@ - this.field_70165_t = p_70107_1_; - this.field_70163_u = p_70107_3_; - this.field_70161_v = p_70107_5_; + + 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)); -@@ -496,11 +508,11 @@ - int k = MathHelper.func_76128_c(this.field_70161_v); - BlockPos blockpos = new BlockPos(i, j, k); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); -- if (blockstate.func_196958_f()) { -+ if (blockstate.isAir(this.field_70170_p, blockpos)) { - BlockPos blockpos1 = blockpos.func_177977_b(); - BlockState blockstate1 = this.field_70170_p.func_180495_p(blockpos1); - Block block = blockstate1.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, blockpos, this)) { - blockstate = blockstate1; - blockpos = blockpos1; - } -@@ -535,7 +547,7 @@ +@@ -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(d2 * d2 + d0 * d0 + d1 * d1) * 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; -@@ -550,7 +562,7 @@ +@@ -538,7 +550,7 @@ } else { this.func_180429_a(blockpos, blockstate); } @@ -96,15 +91,29 @@ this.field_191959_ay = this.func_191954_d(this.field_82151_R); } } -@@ -792,6 +804,7 @@ - this.field_70165_t = (axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D; - this.field_70163_u = axisalignedbb.field_72338_b; - this.field_70161_v = (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D; +@@ -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() { -@@ -844,7 +857,7 @@ +@@ -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()); @@ -113,19 +122,19 @@ this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b()); } } -@@ -1040,9 +1053,10 @@ - int k = MathHelper.func_76128_c(this.field_70161_v); +@@ -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.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.field_70163_u + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vec3d.field_72450_a * -4.0D, 1.5D, vec3d.field_72449_c * -4.0D); -+ this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate).setPos(blockpos), this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.field_70163_u + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vec3d.field_72450_a * -4.0D, 1.5D, vec3d.field_72449_c * -4.0D); +- 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); } } -@@ -1061,7 +1075,7 @@ +@@ -1040,7 +1053,7 @@ return false; } else { IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos); @@ -134,15 +143,7 @@ } } } -@@ -1132,6 +1146,7 @@ - this.field_70126_B -= 360.0F; - } - -+ if (!this.field_70170_p.field_72995_K && this.func_70089_S()) this.field_70170_p.func_212866_a_((int) Math.floor(this.field_70165_t) >> 4, (int) Math.floor(this.field_70161_v) >> 4); // Forge - ensure target chunk is loaded. - this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); - this.func_70101_b(p_70080_7_, p_70080_8_); - } -@@ -1368,6 +1383,7 @@ +@@ -1330,6 +1343,7 @@ if (this.field_184238_ar) { p_189511_1_.func_74757_a("Glowing", this.field_184238_ar); } @@ -150,7 +151,7 @@ if (!this.field_184236_aF.isEmpty()) { ListNBT listnbt = new ListNBT(); -@@ -1379,6 +1395,10 @@ +@@ -1341,6 +1355,10 @@ p_189511_1_.func_218657_a("Tags", listnbt); } @@ -161,7 +162,7 @@ this.func_213281_b(p_189511_1_); if (this.func_184207_aI()) { ListNBT listnbt1 = new ListNBT(); -@@ -1455,6 +1475,9 @@ +@@ -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")); @@ -171,16 +172,16 @@ if (p_70020_1_.func_150297_b("Tags", 9)) { this.field_184236_aF.clear(); ListNBT listnbt1 = p_70020_1_.func_150295_c("Tags", 8); -@@ -1543,6 +1566,8 @@ +@@ -1497,6 +1518,8 @@ } else { - ItemEntity itementity = new ItemEntity(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_); + ItemEntity 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; } -@@ -1586,6 +1611,7 @@ +@@ -1540,6 +1563,7 @@ public void func_70098_U() { this.func_213317_d(Vec3d.field_186680_a); @@ -188,7 +189,7 @@ this.func_70071_h_(); if (this.func_184218_aH()) { this.func_184187_bx().func_184232_k(this); -@@ -1626,6 +1652,7 @@ +@@ -1584,6 +1608,7 @@ } } @@ -196,7 +197,7 @@ if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) { if (this.func_184218_aH()) { this.func_184210_p(); -@@ -1657,6 +1684,7 @@ +@@ -1615,6 +1640,7 @@ public void func_184210_p() { if (this.field_184239_as != null) { Entity entity = this.field_184239_as; @@ -204,7 +205,7 @@ this.field_184239_as = null; entity.func_184225_p(this); } -@@ -1807,6 +1835,7 @@ +@@ -1771,6 +1797,7 @@ return !this.func_184188_bt().isEmpty(); } @@ -212,16 +213,16 @@ public boolean func_205710_ba() { return true; } -@@ -2005,7 +2034,7 @@ - func_207712_c(itextcomponent1); - return itextcomponent1; - } else { -- return this.field_200606_g.func_212546_e(); -+ return this.func_200600_R().func_212546_e(); // Forge: Use getter to allow overriding by mods - } +@@ -1989,7 +2016,7 @@ } -@@ -2063,6 +2092,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,7 @@ @Nullable public Entity func_212321_a(DimensionType p_212321_1_) { @@ -229,12 +230,12 @@ 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(); -@@ -2080,16 +2110,9 @@ +@@ -2063,16 +2091,9 @@ } else if (p_212321_1_ == DimensionType.field_223229_c_) { blockpos = serverworld1.func_180504_m(); } else { -- double d0 = this.field_70165_t; -- double d1 = this.field_70161_v; +- 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; @@ -244,12 +245,12 @@ - d1 *= 8.0D; - } + double movementFactor = serverworld.func_201675_m().getMovementFactor() / serverworld1.func_201675_m().getMovementFactor(); -+ double d0 = this.field_70165_t * movementFactor; -+ double d1 = this.field_70161_v * movementFactor; ++ double 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); -@@ -2118,7 +2141,7 @@ +@@ -2101,7 +2122,7 @@ serverworld1.func_217460_e(entity); } @@ -258,7 +259,7 @@ this.field_70170_p.func_217381_Z().func_76319_b(); serverworld.func_82742_i(); serverworld1.func_82742_i(); -@@ -2146,10 +2169,12 @@ +@@ -2129,10 +2150,12 @@ } public Vec3d func_181014_aG() { @@ -271,7 +272,7 @@ return this.field_181018_ap; } -@@ -2274,7 +2299,7 @@ +@@ -2261,7 +2284,7 @@ Pose pose = this.func_213283_Z(); EntitySize entitysize1 = this.func_213305_a(pose); this.field_213325_aI = entitysize1; @@ -279,18 +280,18 @@ + this.field_213326_aJ = getEyeHeightForge(pose, entitysize1); if (entitysize1.field_220315_a < entitysize.field_220315_a) { double d0 = (double)entitysize1.field_220315_a / 2.0D; - this.func_174826_a(new AxisAlignedBB(this.field_70165_t - d0, this.field_70163_u, this.field_70161_v - d0, this.field_70165_t + d0, this.field_70163_u + (double)entitysize1.field_220316_b, this.field_70161_v + d0)); -@@ -2641,6 +2666,7 @@ - return this.field_211517_W; + 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 +2736,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 final float func_213311_cf() { - return this.field_213325_aI.field_220315_a; - } -@@ -2670,4 +2696,69 @@ - public void func_213293_j(double p_213293_1_, double p_213293_3_, double p_213293_5_) { - this.func_213317_d(new Vec3d(p_213293_1_, p_213293_3_, p_213293_5_)); + public void func_70623_bb() { +@@ -2726,4 +2750,69 @@ + public interface IMoveCallback { + void accept(Entity p_accept_1_, double p_accept_2_, double p_accept_4_, double p_accept_6_); } + + /* ================================== Forge Start =====================================*/ diff --git a/patches/minecraft/net/minecraft/entity/EntityType.java.patch b/patches/minecraft/net/minecraft/entity/EntityType.java.patch index 72077aaf1..bb79ef355 100644 --- a/patches/minecraft/net/minecraft/entity/EntityType.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/EntityType.java +++ b/net/minecraft/entity/EntityType.java -@@ -134,7 +134,7 @@ +@@ -135,7 +135,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,7 +9,7 @@ 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)); -@@ -252,6 +252,12 @@ +@@ -254,6 +254,12 @@ private ResourceLocation field_220358_bg; private final EntitySize field_220359_bi; @@ -22,16 +22,19 @@ 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_)); } -@@ -264,7 +270,7 @@ +@@ -266,7 +272,11 @@ return Registry.field_212629_r.func_218349_b(ResourceLocation.func_208304_a(p_220327_0_)); } -- 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_) { ++ + 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_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_; -@@ -272,6 +278,10 @@ +@@ -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_; @@ -42,7 +45,7 @@ } @Nullable -@@ -282,6 +292,7 @@ +@@ -284,6 +298,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_); @@ -50,7 +53,7 @@ p_220342_1_.func_217376_c(t); return t; } -@@ -464,6 +475,9 @@ +@@ -466,6 +481,9 @@ } public int func_220345_k() { @@ -60,7 +63,7 @@ if (this == field_200729_aH) { return 32; } else if (this == field_200801_o) { -@@ -476,6 +490,9 @@ +@@ -478,6 +496,9 @@ } public int func_220332_l() { @@ -70,7 +73,7 @@ if (this != field_200729_aH && this != field_200805_s) { if (this == field_200808_v) { return 4; -@@ -496,6 +513,9 @@ +@@ -498,6 +519,9 @@ } public boolean func_220340_m() { @@ -80,7 +83,7 @@ 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; } -@@ -503,12 +523,30 @@ +@@ -505,12 +529,30 @@ return p_220341_1_.func_199685_a_(this); } @@ -111,7 +114,7 @@ private boolean field_225436_f; private EntitySize field_220326_f = EntitySize.func_220314_b(0.6F, 1.8F); -@@ -553,11 +591,35 @@ +@@ -555,11 +597,35 @@ return this; } @@ -148,7 +151,7 @@ if (SharedConstants.field_206244_b) { throw illegalstateexception; } -@@ -566,7 +628,7 @@ +@@ -568,7 +634,7 @@ } } diff --git a/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch b/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch index 35467dfd5..dcb9a4cc8 100644 --- a/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/entity/FlyingEntity.java +++ b/net/minecraft/entity/FlyingEntity.java -@@ -27,15 +27,16 @@ +@@ -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.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v); ++ 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.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().func_208618_m() * 0.91F; -+ f = this.field_70170_p.func_180495_p(ground).getSlipperiness(field_70170_p, ground, this) * 0.91F; +- 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.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().func_208618_m() * 0.91F; -+ f = this.field_70170_p.func_180495_p(ground).getSlipperiness(field_70170_p, ground, this) * 0.91F; +- 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/minecraft/net/minecraft/entity/LivingEntity.java.patch b/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch index 480a31de4..3ca7e901c 100644 --- a/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/LivingEntity.java +++ b/net/minecraft/entity/LivingEntity.java -@@ -104,7 +104,12 @@ +@@ -109,7 +109,12 @@ public abstract class LivingEntity extends Entity { private static final UUID field_110156_b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); @@ -13,7 +13,7 @@ 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); -@@ -228,6 +233,9 @@ +@@ -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); @@ -23,7 +23,7 @@ } protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, BlockState p_184231_4_, BlockPos p_184231_5_) { -@@ -237,9 +245,10 @@ +@@ -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); @@ -32,10 +32,10 @@ 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.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, (double)0.15F); + ((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); } } -@@ -303,7 +312,7 @@ +@@ -310,7 +319,7 @@ } } @@ -44,24 +44,16 @@ this.func_184210_p(); } } else if (this.func_70086_ai() < this.func_205010_bg()) { -@@ -388,6 +397,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; -@@ -395,7 +405,7 @@ - } - } - +@@ -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 k = 0; k < 20; ++k) { - double d2 = this.field_70146_Z.nextGaussian() * 0.02D; -@@ -590,7 +600,7 @@ + for(int i = 0; i < 20; ++i) { + double d0 = this.field_70146_Z.nextGaussian() * 0.02D; +@@ -571,7 +580,7 @@ Effect effect = iterator.next(); EffectInstance effectinstance = this.field_70713_bf.get(effect); if (!effectinstance.func_76455_a(this)) { @@ -70,7 +62,7 @@ iterator.remove(); this.func_70688_c(effectinstance); } -@@ -640,8 +650,10 @@ +@@ -621,8 +630,10 @@ this.func_82142_c(false); } else { Collection collection = this.field_70713_bf.values(); @@ -83,19 +75,18 @@ this.func_82142_c(this.func_70644_a(Effects.field_76441_p)); } -@@ -705,7 +717,10 @@ +@@ -686,7 +697,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(); } -@@ -735,6 +750,7 @@ +@@ -716,6 +729,7 @@ return false; } else { EffectInstance effectinstance = this.field_70713_bf.get(p_195064_1_.func_188419_a()); @@ -103,7 +94,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_); -@@ -749,6 +765,9 @@ +@@ -730,6 +744,9 @@ } public boolean func_70687_e(EffectInstance p_70687_1_) { @@ -113,15 +104,15 @@ 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) { -@@ -769,6 +788,7 @@ +@@ -750,6 +767,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; ++ 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); -@@ -805,6 +825,8 @@ +@@ -786,6 +804,8 @@ } public void func_70691_i(float p_70691_1_) { @@ -130,7 +121,7 @@ float f = this.func_110143_aJ(); if (f > 0.0F) { this.func_70606_j(f + p_70691_1_); -@@ -821,6 +843,7 @@ +@@ -802,6 +822,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -138,7 +129,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; } else if (this.field_70170_p.field_72995_K) { -@@ -887,8 +910,8 @@ +@@ -868,8 +889,8 @@ if (entity1 instanceof PlayerEntity) { this.field_70718_bc = 100; this.field_70717_bb = (PlayerEntity)entity1; @@ -149,7 +140,7 @@ if (wolfentity.func_70909_n()) { this.field_70718_bc = 100; LivingEntity livingentity = wolfentity.func_70902_q(); -@@ -1070,6 +1093,7 @@ +@@ -1051,6 +1072,7 @@ } public void func_70645_a(DamageSource p_70645_1_) { @@ -157,16 +148,20 @@ if (!this.field_70729_aU) { Entity entity = p_70645_1_.func_76346_g(); LivingEntity livingentity = this.func_94060_bK(); -@@ -1091,7 +1115,7 @@ - this.func_213345_d(p_70645_1_); - boolean flag = false; - if (livingentity instanceof WitherEntity) { -- if (this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { +@@ -1082,10 +1104,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.field_70165_t, this.field_70163_u, this.field_70161_v); - 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)) { -@@ -1114,13 +1138,10 @@ + 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; + } +@@ -1102,13 +1124,10 @@ protected void func_213345_d(DamageSource p_213345_1_) { Entity entity = p_213345_1_.func_76346_g(); @@ -183,10 +178,10 @@ 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); -@@ -1128,6 +1149,10 @@ - } +@@ -1117,6 +1136,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)) @@ -194,7 +189,23 @@ } protected void func_213337_cE() { -@@ -1157,6 +1182,9 @@ +@@ -1126,6 +1149,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; +@@ -1133,6 +1157,7 @@ + } + } + ++ + } + + protected void func_213333_a(DamageSource p_213333_1_, int p_213333_2_, boolean p_213333_3_) { +@@ -1159,6 +1184,9 @@ } public void func_70653_a(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) { @@ -204,7 +215,7 @@ 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(); -@@ -1192,12 +1220,7 @@ +@@ -1194,12 +1222,7 @@ return false; } else { BlockState blockstate = this.func_213339_cH(); @@ -218,26 +229,33 @@ } } -@@ -1221,6 +1244,9 @@ +@@ -1223,6 +1246,11 @@ } - public void func_180430_e(float p_180430_1_, float p_180430_2_) { -+ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, p_180430_1_, p_180430_2_); -+ if (ret == null) return; -+ p_180430_1_ = ret[0]; p_180430_2_ = ret[1]; - super.func_180430_e(p_180430_1_, p_180430_2_); - EffectInstance effectinstance = this.func_70660_b(Effects.field_76430_j); - float f = effectinstance == null ? 0.0F : (float)(effectinstance.func_76458_c() + 1); -@@ -1233,7 +1259,7 @@ - int l = MathHelper.func_76128_c(this.field_70161_v); - BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(j, k, l)); - if (!blockstate.func_196958_f()) { + 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) { +@@ -1246,9 +1274,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(); -+ SoundType soundtype = blockstate.getSoundType(field_70170_p, new BlockPos(j, k, l), this); ++ 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); } - } -@@ -1302,6 +1328,8 @@ + +@@ -1317,6 +1346,8 @@ protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { if (!this.func_180431_b(p_70665_1_)) { @@ -245,30 +263,30 @@ + 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 f = p_70665_2_; -@@ -1312,10 +1340,11 @@ - ((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f1 * 10.0F)); + float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); +@@ -1326,10 +1357,11 @@ + ((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f * 10.0F)); } -+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, p_70665_2_); - if (p_70665_2_ != 0.0F) { - float f2 = this.func_110143_aJ(); -- this.func_70606_j(f2 - p_70665_2_); - this.func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_); -+ this.func_70606_j(f2 - p_70665_2_); // Forge: moved to fix MC-121048 - this.func_110149_m(this.func_110139_bj() - p_70665_2_); ++ 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); } } -@@ -1357,6 +1386,8 @@ +@@ -1383,6 +1415,8 @@ } - public void func_184609_a(Hand p_184609_1_) { -+ ItemStack stack = this.func_184586_b(p_184609_1_); + 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; -@@ -1715,15 +1746,16 @@ +@@ -1769,15 +1803,16 @@ } this.field_70160_al = true; @@ -287,7 +305,7 @@ } protected float func_189749_co() { -@@ -1733,11 +1765,15 @@ +@@ -1787,11 +1822,15 @@ public void func_213352_e(Vec3d p_213352_1_) { if (this.func_70613_aW() || this.func_184186_bw()) { double d0 = 0.08D; @@ -304,16 +322,16 @@ 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) { -@@ -1786,7 +1822,7 @@ +@@ -1840,7 +1879,7 @@ } } else { - BlockPos blockpos = new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v); + 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())); -@@ -1848,6 +1884,7 @@ +@@ -1902,6 +1941,7 @@ f = 0.96F; } @@ -321,7 +339,7 @@ this.func_213309_a(f1, p_213352_1_); this.func_213315_a(MoverType.SELF, this.func_213322_ci()); Vec3d vec3d1 = this.func_213322_ci(); -@@ -1923,6 +1960,7 @@ +@@ -1977,6 +2017,7 @@ } public void func_70071_h_() { @@ -329,7 +347,7 @@ super.func_70071_h_(); this.func_184608_ct(); this.func_205014_p(); -@@ -1954,7 +1992,9 @@ +@@ -2020,7 +2061,9 @@ ItemStack itemstack1 = this.func_184582_a(equipmentslottype); if (!ItemStack.func_77989_b(itemstack1, itemstack)) { @@ -339,7 +357,7 @@ if (!itemstack.func_190926_b()) { this.func_110140_aT().func_111148_a(itemstack.func_111283_C(equipmentslottype)); } -@@ -2403,13 +2443,22 @@ +@@ -2472,13 +2515,22 @@ private void func_184608_ct() { if (this.func_184587_cr()) { @@ -355,8 +373,8 @@ + } + this.field_184627_bm.func_222121_b(this.field_70170_p, this, this.func_184605_cv()); - if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0) { - this.func_184584_a(this.field_184627_bm, 5); + if (this.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()) { @@ -364,7 +382,7 @@ this.func_71036_o(); } } else { -@@ -2443,8 +2492,10 @@ +@@ -2520,8 +2572,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()) { @@ -376,28 +394,28 @@ 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); -@@ -2504,6 +2555,9 @@ +@@ -2581,6 +2635,9 @@ vec3d1 = vec3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F)); vec3d1 = vec3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F)); - vec3d1 = vec3d1.func_72441_c(this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v); + 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); } -@@ -2512,7 +2566,9 @@ - protected void func_71036_o() { - if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) { - this.func_184584_a(this.field_184627_bm, 16); -- 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(); - } +@@ -2592,7 +2649,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(); + } -@@ -2532,7 +2588,11 @@ +@@ -2613,7 +2672,11 @@ public void func_184597_cx() { if (!this.field_184627_bm.func_190926_b()) { @@ -409,7 +427,7 @@ if (this.field_184627_bm.func_222122_m()) { this.func_184608_ct(); } -@@ -2687,16 +2747,16 @@ +@@ -2770,16 +2833,16 @@ private boolean func_213359_p() { return this.func_213374_dv().map((p_213347_1_) -> { @@ -430,22 +448,18 @@ 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); }); -@@ -2711,8 +2771,13 @@ - @Nullable +@@ -2795,7 +2858,9 @@ @OnlyIn(Dist.CLIENT) public Direction func_213376_dz() { -+// this.getBedPosition().map(pos->{ // This is apparently an "optimization" by Mojang, so we'll copy their lead here for now -+// BlockState state = this.world.getBlockState(pos); -+// return !state.isBed(world, pos, this) ? Direction.UP : state.getBedDirection(world, pos); -+// }); BlockPos blockpos = this.func_213374_dv().orElse((BlockPos)null); - return blockpos != null ? BedBlock.func_220174_a(this.field_70170_p, blockpos) : null; ++ 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() { -@@ -2779,4 +2844,58 @@ +@@ -2864,4 +2929,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 34539018f..f02a86a3f 100644 --- a/patches/minecraft/net/minecraft/entity/MobEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/MobEntity.java.patch @@ -8,7 +8,7 @@ } public boolean func_213358_a(EntityType p_213358_1_) { -@@ -458,7 +459,7 @@ +@@ -460,7 +461,7 @@ public void func_70636_d() { super.func_70636_d(); this.field_70170_p.func_217381_Z().func_76320_a("looting"); @@ -17,9 +17,9 @@ 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); -@@ -548,6 +549,14 @@ - protected void func_70623_bb() { - if (!this.func_104002_bU() && !this.func_213392_I()) { +@@ -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) { @@ -32,7 +32,7 @@ if (entity != null) { double d0 = entity.func_70068_e(this); if (d0 > 16384.0D && this.func_213397_c(d0)) { -@@ -786,6 +795,8 @@ +@@ -791,6 +800,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) { -@@ -793,7 +804,7 @@ +@@ -798,7 +809,7 @@ } else if (item == Items.field_185160_cR) { return EquipmentSlotType.CHEST; } else { @@ -50,7 +50,7 @@ } } else { return EquipmentSlotType.HEAD; -@@ -1173,10 +1184,10 @@ +@@ -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; 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 6754c2361..9e6673880 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 @@ -15,7 +15,7 @@ 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); ++ p_212833_1_.func_180501_a(field_220422_a, ((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlant(p_212833_1_, field_220422_a), 3); + flag = true; + } } diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch index 6b44222c8..bba290bbf 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch @@ -26,8 +26,8 @@ if (this.field_75438_g != null) { return true; @@ -92,6 +103,18 @@ - this.field_151495_j = livingentity.func_174813_aQ().field_72338_b; - this.field_151496_k = livingentity.field_70161_v; + this.field_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; diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch index e961b5c56..22d64d6be 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch @@ -1,13 +1,11 @@ --- a/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java +++ b/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java -@@ -36,7 +36,9 @@ +@@ -36,7 +36,7 @@ } protected boolean func_188498_f() { - return this.field_188499_a.func_213382_a(Items.field_151031_f); -+ net.minecraft.item.ItemStack main = this.field_188499_a.func_184614_ca(); -+ net.minecraft.item.ItemStack off = this.field_188499_a.func_184592_cb(); -+ return main.func_77973_b() instanceof BowItem || off.func_77973_b() instanceof BowItem; ++ return this.field_188499_a.func_184614_ca().func_77973_b() instanceof BowItem || this.field_188499_a.func_184592_cb().func_77973_b() instanceof BowItem; } public boolean func_75253_b() { diff --git a/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch b/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch index 593d97d01..3619caf1b 100644 --- a/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/entity/boss/WitherEntity.java +++ b/net/minecraft/entity/boss/WitherEntity.java -@@ -207,7 +207,7 @@ +@@ -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.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v, 7.0F, false, explosion$mode); + this.field_70170_p.func_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); } -@@ -282,7 +282,7 @@ +@@ -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.field_70163_u); - int l1 = MathHelper.func_76128_c(this.field_70165_t); - int i2 = MathHelper.func_76128_c(this.field_70161_v); -@@ -296,7 +296,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 @@ int l = i2 + l2; BlockPos blockpos = new BlockPos(i3, k, l); BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); - if (func_181033_a(blockstate)) { + if (blockstate.canEntityDestroy(this.field_70170_p, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, blockstate)) { - flag = this.field_70170_p.func_175655_b(blockpos, true) || flag; + flag = this.field_70170_p.func_225521_a_(blockpos, true, this) || flag; } } -@@ -317,6 +317,7 @@ +@@ -322,6 +322,7 @@ } } diff --git a/patches/minecraft/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java.patch b/patches/minecraft/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java.patch deleted file mode 100644 index 45902066d..000000000 --- a/patches/minecraft/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java -+++ b/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java -@@ -58,7 +58,7 @@ - double d2 = this.field_188661_a.field_70986_h.field_70163_u + (double)(this.field_188661_a.field_70986_h.func_213302_cg() / 2.0F); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(d0, d2, d1); - -- while(this.field_188661_a.field_70170_p.func_175623_d(blockpos$mutableblockpos)) { -+ while(this.field_188661_a.field_70170_p.func_175623_d(blockpos$mutableblockpos) && d2 >= 0) { //Forge: Fix infinite loop if ground is missing. - --d2; - blockpos$mutableblockpos.func_189532_c(d0, d2, d1); - } diff --git a/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch b/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch index 262ca229a..c441725bf 100644 --- a/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch @@ -1,7 +1,7 @@ --- 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.field_70165_t - 3.0D, this.field_70163_u - 3.0D, this.field_70161_v - 3.0D, this.field_70165_t + 3.0D, this.field_70163_u + 6.0D + 3.0D, this.field_70161_v + 3.0D), Entity::func_70089_S); + 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)) diff --git a/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch index 7b802edb3..4b85b1c0f 100644 --- a/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/entity/item/BoatEntity.java +++ b/net/minecraft/entity/item/BoatEntity.java -@@ -459,7 +459,7 @@ - blockpos$pooledmutableblockpos.func_181079_c(l1, k2, i2); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos); - if (!(blockstate.func_177230_c() instanceof LilyPadBlock) && VoxelShapes.func_197879_c(blockstate.func_196952_d(this.field_70170_p, blockpos$pooledmutableblockpos).func_197751_a((double)l1, (double)k2, (double)i2), voxelshape, IBooleanFunction.field_223238_i_)) { +@@ -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$pooledmutableblockpos, this); ++ f += blockstate.getSlipperiness(this.field_70170_p, blockpos$pooledmutable, this); ++k1; } } -@@ -778,6 +778,20 @@ +@@ -776,6 +776,16 @@ return new SSpawnObjectPacket(this); } @@ -19,11 +19,7 @@ + super.func_184200_o(passenger); + if (this.func_184186_bw() && this.field_184476_at > 0) { + this.field_184476_at = 0; -+ this.field_70165_t = this.field_70281_h; -+ this.field_70163_u = this.field_184477_av; -+ this.field_70161_v = this.field_184478_aw; -+ this.field_70177_z = (float)this.field_70273_g; -+ this.field_70125_A = (float)this.field_184479_ay; ++ 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); + } + } + diff --git a/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch index c405cc1f6..51659f9b0 100644 --- a/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/entity/item/EnderPearlEntity.java +++ b/net/minecraft/entity/item/EnderPearlEntity.java -@@ -84,6 +84,8 @@ - if (!this.field_70170_p.field_72995_K) { +@@ -85,6 +85,8 @@ if (livingentity instanceof ServerPlayerEntity) { ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)livingentity; -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(serverplayerentity, this.field_70165_t, this.field_70163_u, this.field_70161_v, 5.0F); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { // Don't indent to lower patch size if (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.field_70165_t, this.field_70163_u, this.field_70161_v); +- 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 ++ } //Forge: End } } else if (livingentity != null) { - livingentity.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); + livingentity.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 f5cbc6795..d6935dc02 100644 --- a/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/entity/item/ExperienceOrbEntity.java +++ b/net/minecraft/entity/item/ExperienceOrbEntity.java -@@ -114,7 +114,8 @@ +@@ -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.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().func_208618_m() * 0.98F; -+ BlockPos underPos = new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v); -+ f = this.field_70170_p.func_180495_p(underPos).getSlipperiness(this.field_70170_p, underPos, this) * 0.98F; +- 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)); -@@ -143,6 +144,7 @@ +@@ -127,6 +128,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -18,11 +18,11 @@ if (this.func_180431_b(p_70097_1_)) { return false; } else { -@@ -171,13 +173,14 @@ +@@ -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.PlayerPickupXpEvent(p_70100_1_, this))) return; ++ 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_); @@ -34,15 +34,3 @@ this.field_70530_e -= this.func_184515_b(i); itemstack.func_196085_b(itemstack.func_77952_i() - i); } -@@ -258,6 +261,11 @@ - return false; - } - -+ private static int roundAverage(float value) { -+ double floor = Math.floor(value); -+ return (int) floor + (Math.random() < value - floor ? 1 : 0); -+ } -+ - public IPacket func_213297_N() { - return new SSpawnExperienceOrbPacket(this); - } diff --git a/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch index 64e8fafd5..29c838232 100644 --- a/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/item/FallingBlockEntity.java +++ b/net/minecraft/entity/item/FallingBlockEntity.java -@@ -155,7 +155,7 @@ +@@ -152,7 +152,7 @@ ((FallingBlock)block).func_176502_a_(this.field_70170_p, blockpos1, this.field_175132_d, blockstate); } diff --git a/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch index e0d016dd0..7b173e0a1 100644 --- a/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/entity/item/HangingEntity.java +++ b/net/minecraft/entity/item/HangingEntity.java -@@ -118,6 +118,8 @@ +@@ -113,6 +113,8 @@ int j1 = (j - 1) / -2; - blockpos$mutableblockpos.func_189533_g(blockpos).func_189534_c(direction, k + i1).func_189534_c(Direction.UP, l + j1); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos$mutableblockpos); -+ if (net.minecraft.block.Block.func_220055_a(this.field_70170_p, blockpos$mutableblockpos, this.field_174860_b)) + 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/minecraft/net/minecraft/entity/item/ItemEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch index 4caca1ece..80d48532a 100644 --- a/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch @@ -18,7 +18,7 @@ + this.lifespan = (p_i1710_8_.func_77973_b() == null ? 6000 : p_i1710_8_.getEntityLifespan(p_i1710_1_)); } - protected boolean func_70041_e_() { + protected boolean func_225502_at_() { @@ -65,6 +70,7 @@ } @@ -31,8 +31,8 @@ this.func_213315_a(MoverType.SELF, this.func_213322_ci()); float f = 0.98F; if (this.field_70122_E) { -- f = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().func_208618_m() * 0.98F; -+ BlockPos pos = new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v); +- f = this.field_70170_p.func_180495_p(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; } @@ -53,15 +53,16 @@ this.func_70106_y(); } -@@ -183,6 +197,7 @@ - } - - private static void func_213858_a(ItemEntity p_213858_0_, ItemStack p_213858_1_, ItemEntity p_213858_2_, ItemStack p_213858_3_) { -+ if (!p_213858_1_.areCapsCompatible(p_213858_3_)) return; - int i = Math.min(p_213858_1_.func_77976_d() - p_213858_1_.func_190916_E(), p_213858_3_.func_190916_E()); - ItemStack itemstack = p_213858_1_.func_77946_l(); - itemstack.func_190917_f(i); -@@ -206,6 +221,7 @@ +@@ -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_) { @@ -69,7 +70,7 @@ 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()) { -@@ -225,6 +241,7 @@ +@@ -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); @@ -77,7 +78,7 @@ if (this.func_200214_m() != null) { p_213281_1_.func_218657_a("Thrower", NBTUtil.func_186862_a(this.func_200214_m())); } -@@ -245,6 +262,7 @@ +@@ -255,6 +273,7 @@ if (p_70037_1_.func_74764_b("PickupDelay")) { this.field_145804_b = p_70037_1_.func_74765_d("PickupDelay"); } @@ -85,7 +86,7 @@ if (p_70037_1_.func_150297_b("Owner", 10)) { this.field_145802_g = NBTUtil.func_186860_b(p_70037_1_.func_74775_l("Owner")); -@@ -264,12 +282,20 @@ +@@ -274,12 +293,21 @@ public void func_70100_b_(PlayerEntity p_70100_1_) { if (!this.field_70170_p.field_72995_K) { @@ -93,8 +94,7 @@ 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 || 6000 - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_110124_au())) && p_70100_1_.field_71071_by.func_70441_a(itemstack)) { -- p_70100_1_.func_71001_a(this, i); +- 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; @@ -103,12 +103,13 @@ + 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); } -@@ -356,7 +382,7 @@ +@@ -366,7 +394,7 @@ public void func_174870_v() { this.func_174871_r(); diff --git a/patches/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch index b2e1278ca..01a71f9e4 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 -@@ -191,7 +191,7 @@ +@@ -192,7 +192,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 6adc2078d..a9b1db525 100644 --- a/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/entity/item/LeashKnotEntity.java +++ b/net/minecraft/entity/item/LeashKnotEntity.java -@@ -45,6 +45,7 @@ - this.field_70165_t = (double)this.field_174861_a.func_177958_n() + 0.5D; - this.field_70163_u = (double)this.field_174861_a.func_177956_o() + 0.5D; - this.field_70161_v = (double)this.field_174861_a.func_177952_p() + 0.5D; +@@ -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. } 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 b009eb67f..152260960 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 -@@ -35,7 +35,7 @@ +@@ -40,7 +40,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); -@@ -56,6 +56,7 @@ +@@ -80,6 +80,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_); -@@ -102,11 +103,12 @@ +@@ -126,11 +127,12 @@ @Nullable public AxisAlignedBB func_70114_g(Entity p_70114_1_) { @@ -31,7 +31,7 @@ } public double func_70042_X() { -@@ -214,7 +216,7 @@ +@@ -239,7 +241,7 @@ BlockPos blockpos = new BlockPos(i, j, k); BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); @@ -40,7 +40,7 @@ this.func_180460_a(blockpos, blockstate); if (blockstate.func_177230_c() == Blocks.field_150408_cc) { this.func_96095_a(i, j, k, blockstate.func_177229_b(PoweredRailBlock.field_176569_M)); -@@ -241,8 +243,11 @@ +@@ -266,8 +268,11 @@ } this.func_70101_b(this.field_70177_z, this.field_70125_A); @@ -54,7 +54,7 @@ if (!list.isEmpty()) { for(int l = 0; l < list.size(); ++l) { Entity entity1 = list.get(l); -@@ -254,7 +259,7 @@ +@@ -279,7 +284,7 @@ } } } else { @@ -63,7 +63,7 @@ if (!this.func_184196_w(entity) && entity.func_70104_M() && entity instanceof AbstractMinecartEntity) { entity.func_70108_f(this); } -@@ -262,6 +267,7 @@ +@@ -287,6 +292,7 @@ } this.func_70072_I(); @@ -71,7 +71,7 @@ } } -@@ -273,16 +279,24 @@ +@@ -298,16 +304,24 @@ } protected void func_180459_n() { @@ -80,7 +80,7 @@ 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 (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 @@ -98,60 +98,59 @@ } } -@@ -299,24 +313,24 @@ +@@ -327,24 +341,23 @@ flag1 = !flag; } -- double d0 = 0.0078125D; -+ double d0 = getSlopeAdjustment(); +- 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*d0, 0.0D, 0.0D)); - ++this.field_70163_u; ++ 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(d0, 0.0D, 0.0D)); - ++this.field_70163_u; ++ 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, d0)); - ++this.field_70163_u; ++ 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*d0)); - ++this.field_70163_u; ++ this.func_213317_d(vec3d1.func_72441_c(0.0D, 0.0D, -1*getSlopeAdjustment())); + ++d1; } -@@ -345,7 +359,7 @@ +@@ -375,7 +388,7 @@ } } - if (flag1) { + if (flag1 && shouldDoRailFunctions()) { - double d19 = Math.sqrt(func_213296_b(this.func_213322_ci())); - if (d19 < 0.03D) { + double d22 = Math.sqrt(func_213296_b(this.func_213322_ci())); + if (d22 < 0.03D) { this.func_213317_d(Vec3d.field_186680_a); -@@ -376,10 +390,7 @@ - this.field_70165_t = d20 + d1 * d11; - this.field_70161_v = d7 + d2 * d11; - this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); -- double d21 = this.func_184207_aI() ? 0.75D : 1.0D; -- double d22 = this.func_174898_m(); +@@ -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(d21 * vec3d1.field_72450_a, -d22, d22), 0.0D, MathHelper.func_151237_a(d21 * vec3d1.field_72449_c, -d22, d22))); +- 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 (aint[0][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[0][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[0][2]) { - this.func_70107_b(this.field_70165_t, this.field_70163_u + (double)aint[0][1], this.field_70161_v); - } else if (aint[1][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[1][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[1][2]) { -@@ -407,7 +418,10 @@ - this.func_213293_j(d23 * (double)(j - p_180460_1_.func_177958_n()), vec3d5.field_72448_b, d23 * (double)(i - p_180460_1_.func_177952_p())); + if (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) { @@ -160,9 +159,9 @@ + + if (flag && shouldDoRailFunctions()) { Vec3d vec3d6 = this.func_213322_ci(); - double d24 = Math.sqrt(func_213296_b(vec3d6)); - if (d24 > 0.01D) { -@@ -462,7 +476,7 @@ + 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)) { @@ -171,16 +170,16 @@ p_70495_3_ = (double)j; if (railshape.func_208092_c()) { p_70495_3_ = (double)(j + 1); -@@ -499,7 +513,7 @@ +@@ -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); - int[][] aint = field_70500_g[railshape.func_208091_a()]; - double d0 = (double)i + 0.5D + (double)aint[0][0] * 0.5D; - double d1 = (double)j + 0.0625D + (double)aint[0][1] * 0.5D; -@@ -562,6 +576,11 @@ + 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_) { @@ -192,7 +191,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_)) { -@@ -597,11 +616,11 @@ +@@ -627,11 +645,11 @@ Vec3d vec3d2 = this.func_213322_ci(); Vec3d vec3d3 = p_70108_1_.func_213322_ci(); @@ -206,7 +205,7 @@ 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)); -@@ -707,6 +726,40 @@ +@@ -737,6 +755,40 @@ return new SSpawnObjectPacket(this); } @@ -238,10 +237,10 @@ + @Override + public void moveMinecartOnRail(BlockPos pos) { //Non-default because getMaximumSpeed is protected + AbstractMinecartEntity mc = getMinecart(); -+ double d21 = mc.func_184207_aI() ? 0.75D : 1.0D; -+ double d22 = mc.func_174898_m(); ++ double d24 = mc.func_184207_aI() ? 0.75D : 1.0D; ++ double d25 = mc.func_174898_m(); + Vec3d vec3d1 = mc.func_213322_ci(); -+ mc.func_213315_a(MoverType.SELF, new Vec3d(MathHelper.func_151237_a(d21 * vec3d1.field_72450_a, -d22, d22), 0.0D, MathHelper.func_151237_a(d21 * vec3d1.field_72449_c, -d22, d22))); ++ 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 { 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 bb4031a13..c73eea583 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java +++ b/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java -@@ -111,6 +111,7 @@ +@@ -114,6 +114,7 @@ } public boolean func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { 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 f5f6136be..bd7714407 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch @@ -5,6 +5,6 @@ public boolean func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { + if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true; - if (p_184230_1_.func_70093_af()) { + if (p_184230_1_.func_226563_dT_()) { return false; } else if (this.func_184207_aI()) { 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 fc90a0d30..71e474819 100644 --- a/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch @@ -1,20 +1,21 @@ --- a/net/minecraft/entity/merchant/villager/VillagerEntity.java +++ b/net/minecraft/entity/merchant/villager/VillagerEntity.java -@@ -230,7 +230,7 @@ +@@ -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_70093_af()) { ++ } 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_); -@@ -611,7 +611,7 @@ - }); - } else { - VillagerProfession villagerprofession = this.func_213700_eh().func_221130_b(); -- ITextComponent itextcomponent1 = (new TranslationTextComponent(this.func_200600_R().func_210760_d() + '.' + Registry.field_218370_L.func_177774_c(villagerprofession).func_110623_a())).func_211710_a((p_213773_1_) -> { -+ ITextComponent itextcomponent1 = (new TranslationTextComponent(this.func_200600_R().func_210760_d() + '.' + (!"minecraft".equals(villagerprofession.getRegistryName().func_110624_b()) ? villagerprofession.getRegistryName().func_110624_b() + '.' : "") + villagerprofession.getRegistryName().func_110623_a())).func_211710_a((p_213773_1_) -> { - p_213773_1_.func_150209_a(this.func_174823_aP()).func_179989_a(this.func_189512_bd()); - }); - if (team != null) { +@@ -604,7 +604,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/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch index ceee377ad..feb536f75 100644 --- a/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch +++ b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/merchant/villager/VillagerProfession.java +++ b/net/minecraft/entity/merchant/villager/VillagerProfession.java -@@ -9,7 +9,7 @@ +@@ -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_221147_a("none", PointOfInterestType.field_221054_b); - public static final VillagerProfession field_221152_b = func_221147_a("armorer", PointOfInterestType.field_221055_c); - public static final VillagerProfession field_221153_c = func_221147_a("butcher", PointOfInterestType.field_221056_d); + 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/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch index 90ac61ca1..87798c670 100644 --- a/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch @@ -15,6 +15,6 @@ AbstractArrowEntity abstractarrowentity = this.func_213624_b(itemstack, p_82196_2_); + if (this.func_184614_ca().func_77973_b() instanceof net.minecraft.item.BowItem) + abstractarrowentity = ((net.minecraft.item.BowItem)this.func_184614_ca().func_77973_b()).customeArrow(abstractarrowentity); - double d0 = p_82196_1_.field_70165_t - this.field_70165_t; - double d1 = p_82196_1_.func_174813_aQ().field_72338_b + (double)(p_82196_1_.func_213302_cg() / 3.0F) - abstractarrowentity.field_70163_u; - double d2 = p_82196_1_.field_70161_v - this.field_70161_v; + 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 526a6156b..556916353 100644 --- a/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/monster/CreeperEntity.java +++ b/net/minecraft/entity/monster/CreeperEntity.java -@@ -208,7 +208,7 @@ +@@ -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_70830_n() ? 2.0F : 1.0F; + float f = this.func_225509_J__() ? 2.0F : 1.0F; this.field_70729_aU = true; - this.field_70170_p.func_217385_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, (float)this.field_82226_g * f, explosion$mode); + 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/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch index c06775e41..98eadfd82 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/monster/EndermanEntity.java +++ b/net/minecraft/entity/monster/EndermanEntity.java -@@ -92,7 +92,6 @@ +@@ -93,7 +93,6 @@ } public void func_70624_b(@Nullable LivingEntity p_70624_1_) { @@ -8,7 +8,7 @@ IAttributeInstance iattributeinstance = this.func_110148_a(SharedMonsterAttributes.field_111263_d); if (p_70624_1_ == null) { this.field_184721_by = 0; -@@ -106,6 +105,7 @@ +@@ -108,6 +107,7 @@ } } @@ -16,18 +16,18 @@ } protected void func_70088_a() { -@@ -226,7 +226,9 @@ - if (!this.field_70170_p.func_180495_p(blockpos$mutableblockpos).func_185904_a().func_76230_c()) { - return false; - } else { -- boolean flag = this.func_213373_a(p_70825_1_, p_70825_3_, p_70825_5_, true); +@@ -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 flag = this.func_213373_a(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true); - if (flag) { ++ 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); -@@ -371,7 +373,7 @@ +@@ -390,7 +392,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; -@@ -389,7 +391,7 @@ +@@ -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(); @@ -45,7 +45,7 @@ iworld.func_180501_a(blockpos, blockstate2, 3); this.field_179475_a.func_195406_b((BlockState)null); } -@@ -397,7 +399,7 @@ +@@ -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_) { @@ -54,7 +54,7 @@ } } -@@ -434,7 +436,7 @@ +@@ -458,7 +460,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 dc69846ab..83f3bc0b7 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 -@@ -286,7 +286,7 @@ +@@ -282,7 +282,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/IllusionerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch index 4dcc0d40f..e1047feae 100644 --- a/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch @@ -6,6 +6,6 @@ AbstractArrowEntity abstractarrowentity = ProjectileHelper.func_221272_a(this, itemstack, p_82196_2_); + if (this.func_184614_ca().func_77973_b() instanceof net.minecraft.item.BowItem) + abstractarrowentity = ((net.minecraft.item.BowItem)this.func_184614_ca().func_77973_b()).customeArrow(abstractarrowentity); - double d0 = p_82196_1_.field_70165_t - this.field_70165_t; - double d1 = p_82196_1_.func_174813_aQ().field_72338_b + (double)(p_82196_1_.func_213302_cg() / 3.0F) - abstractarrowentity.field_70163_u; - double d2 = p_82196_1_.field_70161_v - this.field_70161_v; + 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 f7bf562ab..ccef1a56d 100644 --- a/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/entity/monster/MagmaCubeEntity.java +++ b/net/minecraft/entity/monster/MagmaCubeEntity.java -@@ -79,6 +79,7 @@ +@@ -72,6 +72,7 @@ Vec3d vec3d = this.func_213322_ci(); - this.func_213293_j(vec3d.field_72450_a, (double)(0.42F + (float)this.func_70809_q() * 0.1F), vec3d.field_72449_c); + this.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); } diff --git a/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch index d6dd8705a..d1e4daa17 100644 --- a/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch @@ -1,14 +1,23 @@ --- 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.field_70165_t = (double)blockpos.func_177958_n() + 0.5D; - this.field_70163_u = (double)blockpos.func_177956_o(); - this.field_70161_v = (double)blockpos.func_177952_p() + 0.5D; + 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. - this.field_70169_q = this.field_70165_t; - this.field_70167_r = this.field_70163_u; - this.field_70166_s = this.field_70161_v; -@@ -315,6 +316,12 @@ + 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) { diff --git a/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch index 227b53bac..95b0e68a8 100644 --- a/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch @@ -7,7 +7,7 @@ - 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.field_70165_t, this.field_75457_a.field_70163_u + 0.5D, this.field_75457_a.field_70161_v)).func_177972_a(this.field_179483_b); + 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); @@ -15,6 +15,6 @@ 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_175655_b(blockpos1, true); + 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/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch index 7d0616d85..61266e095 100644 --- a/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/entity/monster/SlimeEntity.java +++ b/net/minecraft/entity/monster/SlimeEntity.java -@@ -114,7 +114,7 @@ - - public void func_70071_h_() { - if (!this.field_70170_p.field_72995_K && this.field_70170_p.func_175659_aa() == Difficulty.PEACEFUL && this.func_70809_q() > 0) { -- this.field_70128_L = true; -+ this.func_70106_y(); //Forge: Kill entity with notification to caps/subclasses. - } - - this.field_70811_b += (this.field_70813_a - this.field_70811_b) * 0.5F; -@@ -123,6 +123,7 @@ +@@ -129,6 +129,7 @@ if (this.field_70122_E && !this.field_175452_bi) { int i = this.func_70809_q(); @@ -17,7 +8,7 @@ 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; -@@ -170,9 +171,10 @@ +@@ -180,9 +181,10 @@ return (EntityType) super.func_200600_R(); } @@ -30,7 +21,7 @@ int j = 2 + this.field_70146_Z.nextInt(3); for(int k = 0; k < j; ++k) { -@@ -193,7 +195,7 @@ +@@ -204,7 +206,7 @@ } } @@ -39,7 +30,7 @@ } public void func_70108_f(Entity p_70108_1_) { -@@ -251,7 +253,7 @@ +@@ -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_) { @@ -48,7 +39,7 @@ return false; } else { if (p_223366_1_.func_175659_aa() != Difficulty.PEACEFUL) { -@@ -309,6 +311,12 @@ +@@ -320,6 +322,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/ZombieEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch index 363d0b5f0..d15a0c55e 100644 --- a/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/monster/ZombieEntity.java +++ b/net/minecraft/entity/monster/ZombieEntity.java -@@ -107,7 +107,7 @@ +@@ -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); @@ -9,34 +9,34 @@ } protected void func_70088_a() { -@@ -281,12 +281,16 @@ +@@ -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.field_70165_t); - int j = MathHelper.func_76128_c(this.field_70163_u); - int k = MathHelper.func_76128_c(this.field_70161_v); + 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() && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { ++ 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); -@@ -296,6 +300,7 @@ +@@ -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_217346_i(zombieentity) && this.field_70170_p.func_217345_j(zombieentity) && !this.field_70170_p.func_72953_d(zombieentity.func_174813_aQ())) { + 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)); -@@ -429,7 +434,7 @@ +@@ -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) { diff --git a/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch index cbfdfc6d9..8062f6f32 100644 --- a/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch @@ -1,19 +1,6 @@ --- a/net/minecraft/entity/passive/FoxEntity.java +++ b/net/minecraft/entity/passive/FoxEntity.java -@@ -573,9 +573,10 @@ - } - } - -- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double)this.field_70126_B, this.field_70161_v)); -+ BlockPos pos = new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double)this.field_70126_B, this.field_70161_v); -+ BlockState blockstate = this.field_70170_p.func_180495_p(pos); - if (!blockstate.func_196958_f() && !this.func_174814_R()) { -- SoundType soundtype = blockstate.func_215695_r(); -+ SoundType soundtype = blockstate.getSoundType(field_70170_p, pos, this); - this.field_70170_p.func_184148_a((PlayerEntity)null, this.field_70165_t, this.field_70163_u, this.field_70161_v, soundtype.func_185844_d(), this.func_184176_by(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F); - } - -@@ -767,7 +768,7 @@ +@@ -747,7 +747,7 @@ } protected void func_220730_m() { diff --git a/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch index 01c8bbec4..07c8c58e3 100644 --- a/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch @@ -1,11 +1,16 @@ --- a/net/minecraft/entity/passive/IronGolemEntity.java +++ b/net/minecraft/entity/passive/IronGolemEntity.java -@@ -106,7 +106,7 @@ - int k = MathHelper.func_76128_c(this.field_70161_v); - 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.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.func_213311_cf(), this.func_174813_aQ().field_72338_b + 0.1D, this.field_70161_v + ((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); -+ this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate).setPos(new BlockPos(i, j, k)), this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.func_213311_cf(), this.func_174813_aQ().field_72338_b + 0.1D, this.field_70161_v + ((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); +@@ -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/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch index 378fad75f..48669abe6 100644 --- a/patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch @@ -13,36 +13,37 @@ this.func_184185_a(soundevent, 1.0F, 1.0F); return true; -- } else if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) { -+ } else if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) { //Forge: Moved to onSheared - this.field_70170_p.func_195594_a(ParticleTypes.field_197627_t, this.field_70165_t, this.field_70163_u + (double)(this.func_213302_cg() / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D); +- } else if (itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70631_g_()) { ++ } else if (false && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70631_g_()) { //Forge: Moved to onSheared + this.field_70170_p.func_195594_a(ParticleTypes.field_197627_t, this.func_226277_ct_(), this.func_226283_e_(0.5D), this.func_226281_cx_(), 0.0D, 0.0D, 0.0D); if (!this.field_70170_p.field_72995_K) { this.func_70106_y(); -@@ -203,6 +203,33 @@ +@@ -209,6 +209,34 @@ return mooshroomentity$type2; } + @Override + public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, net.minecraft.util.math.BlockPos pos) { -+ return this.func_70874_b() >= 0; ++ return !this.func_70631_g_(); + } + + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, net.minecraft.util.math.BlockPos pos, int fortune) { + java.util.List ret = new java.util.ArrayList<>(); -+ this.field_70170_p.func_195594_a(ParticleTypes.field_197627_t, this.field_70165_t, this.field_70163_u + (double)(this.func_213302_cg() / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D); ++ this.field_70170_p.func_195594_a(ParticleTypes.field_197627_t, this.func_226277_ct_(), this.func_226283_e_(0.5D), this.func_226281_cx_(), 0.0D, 0.0D, 0.0D); + if (!this.field_70170_p.field_72995_K) { + this.func_70106_y(); -+ CowEntity entitycow = EntityType.field_200796_j.func_200721_a(this.field_70170_p); -+ entitycow.func_70012_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, this.field_70177_z, this.field_70125_A); -+ entitycow.func_70606_j(this.func_110143_aJ()); -+ entitycow.field_70761_aq = this.field_70761_aq; ++ CowEntity cowentity = EntityType.field_200796_j.func_200721_a(this.field_70170_p); ++ cowentity.func_70012_b(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), this.field_70177_z, this.field_70125_A); ++ cowentity.func_70606_j(this.func_110143_aJ()); ++ cowentity.field_70761_aq = this.field_70761_aq; + if (this.func_145818_k_()) { -+ entitycow.func_200203_b(this.func_200201_e()); ++ cowentity.func_200203_b(this.func_200201_e()); ++ cowentity.func_174805_g(this.func_174833_aM()); + } -+ this.field_70170_p.func_217376_c(entitycow); ++ this.field_70170_p.func_217376_c(cowentity); + for(int i = 0; i < 5; ++i) { -+ ret.add(new ItemStack(Blocks.field_150337_Q)); ++ ret.add(new ItemStack(this.func_213444_dV().field_221099_d.func_177230_c())); + } + this.func_184185_a(SoundEvents.field_187784_dt, 1.0F, 1.0F); + } diff --git a/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch index c14fb63e2..12bfcd170 100644 --- a/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/passive/OcelotEntity.java +++ b/net/minecraft/entity/passive/OcelotEntity.java -@@ -154,7 +154,7 @@ +@@ -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) { diff --git a/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch index 4b9b6e80d..3500854f2 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 -@@ -225,7 +225,7 @@ +@@ -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.func_70908_e(true); 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 e61e964c5..cf77ca9eb 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 -@@ -498,7 +498,7 @@ +@@ -492,7 +492,7 @@ public boolean func_75250_a() { if (this.field_179496_a <= 0) { diff --git a/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch index 72f2c33e8..ff620d5b8 100644 --- a/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch @@ -18,15 +18,15 @@ this.func_213612_dV(); if (!this.field_70170_p.field_72995_K) { itemstack.func_222118_a(1, p_184645_1_, (p_213613_1_) -> { -@@ -224,6 +224,7 @@ - return super.func_184645_a(p_184645_1_, p_184645_2_); +@@ -226,6 +226,7 @@ + } } + @Deprecated //Forge: Use Shearable interface public void func_213612_dV() { if (!this.field_70170_p.field_72995_K) { this.func_70893_e(true); -@@ -353,4 +354,24 @@ +@@ -354,4 +355,24 @@ protected float func_213348_b(Pose p_213348_1_, EntitySize p_213348_2_) { return 0.95F * p_213348_2_.field_220316_b; } diff --git a/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch index 9852971ee..3c6557dd6 100644 --- a/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch @@ -19,11 +19,11 @@ } @@ -99,7 +99,7 @@ - j = MathHelper.func_76128_c(this.field_70163_u); - k = MathHelper.func_76128_c(this.field_70161_v + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F)); + 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_180494_b(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_180494_b(blockpos).func_225486_c(blockpos) < 0.8F && blockstate.func_196955_c(this.field_70170_p, blockpos)) { +- 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); } } @@ -31,12 +31,12 @@ protected boolean func_184645_a(PlayerEntity p_184645_1_, Hand p_184645_2_) { ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_); -- if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o() && !this.field_70170_p.field_72995_K) { -+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o() && !this.field_70170_p.field_72995_K) { //Forge: Moved to onSheared - this.func_184747_a(false); - itemstack.func_222118_a(1, p_184645_1_, (p_213622_1_) -> { - p_213622_1_.func_213334_d(p_184645_2_); -@@ -163,4 +163,15 @@ +- 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; } diff --git a/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch index fb008f5ff..fea6b0cc8 100644 --- a/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/entity/passive/WolfEntity.java +++ b/net/minecraft/entity/passive/WolfEntity.java -@@ -348,7 +348,7 @@ - } +@@ -353,7 +353,7 @@ + itemstack.func_190918_g(1); + } - if (!this.field_70170_p.field_72995_K) { - if (this.field_70146_Z.nextInt(3) == 0) { + if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_)) { this.func_193101_c(p_184645_1_); 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 15e3b9220..e221e7abd 100644 --- a/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch @@ -1,19 +1,6 @@ --- a/net/minecraft/entity/passive/horse/AbstractHorseEntity.java +++ b/net/minecraft/entity/passive/horse/AbstractHorseEntity.java -@@ -230,9 +230,10 @@ - } - } - -- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double)this.field_70126_B, this.field_70161_v)); -+ BlockPos pos = new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double) this.field_70126_B, this.field_70161_v); -+ BlockState blockstate = this.field_70170_p.func_180495_p(pos); - if (!blockstate.func_196958_f() && !this.func_174814_R()) { -- SoundType soundtype = blockstate.func_215695_r(); -+ SoundType soundtype = blockstate.getSoundType(field_70170_p, pos, this); - this.field_70170_p.func_184148_a((PlayerEntity)null, this.field_70165_t, this.field_70163_u, this.field_70161_v, soundtype.func_185844_d(), this.func_184176_by(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F); - } - -@@ -260,6 +261,7 @@ +@@ -263,6 +263,7 @@ this.field_110296_bG.func_110134_a(this); this.func_110232_cE(); @@ -21,7 +8,7 @@ } protected void func_110232_cE() { -@@ -321,9 +323,9 @@ +@@ -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()); @@ -33,9 +20,9 @@ } if (this.func_184207_aI() && this.field_190688_bE) { -@@ -944,4 +946,22 @@ +@@ -947,4 +948,22 @@ - return p_213386_4_; + 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; 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 4e949352e..889f37dd0 100644 --- a/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch @@ -1,10 +1,9 @@ --- a/net/minecraft/entity/passive/horse/HorseEntity.java +++ b/net/minecraft/entity/passive/horse/HorseEntity.java -@@ -172,7 +172,8 @@ - this.field_70180_af.func_187230_e(); +@@ -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); } diff --git a/patches/minecraft/net/minecraft/entity/passive/horse/LlamaEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/horse/LlamaEntity.java.patch deleted file mode 100644 index 1c33eaf0d..000000000 --- a/patches/minecraft/net/minecraft/entity/passive/horse/LlamaEntity.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/entity/passive/horse/LlamaEntity.java -+++ b/net/minecraft/entity/passive/horse/LlamaEntity.java -@@ -364,9 +364,10 @@ - } - } - -- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double)this.field_70126_B, this.field_70161_v)); -+ BlockPos pos = new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double)this.field_70126_B, this.field_70161_v); -+ BlockState blockstate = this.field_70170_p.func_180495_p(pos); - if (!blockstate.func_196958_f() && !this.func_174814_R()) { -- SoundType soundtype = blockstate.func_215695_r(); -+ SoundType soundtype = blockstate.getSoundType(field_70170_p, pos, this); - this.field_70170_p.func_184148_a((PlayerEntity)null, this.field_70165_t, this.field_70163_u, this.field_70161_v, soundtype.func_185844_d(), this.func_184176_by(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F); - } - diff --git a/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch b/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch index 9664d1fdc..12239f249 100644 --- a/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/player/PlayerEntity.java +++ b/net/minecraft/entity/player/PlayerEntity.java -@@ -108,6 +108,10 @@ +@@ -109,6 +109,10 @@ import net.minecraftforge.api.distmarker.OnlyIn; public abstract class PlayerEntity extends LivingEntity { @@ -9,9 +9,9 @@ + 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.SNEAKING, EntitySize.func_220314_b(0.6F, 1.5F)).put(Pose.DYING, EntitySize.func_220311_c(0.2F, 0.2F)).build(); + 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); -@@ -150,6 +154,9 @@ +@@ -151,6 +155,9 @@ private final CooldownTracker field_184832_bU = this.func_184815_l(); @Nullable public FishingBobberEntity field_71104_cf; @@ -21,7 +21,7 @@ public PlayerEntity(World p_i45324_1_, GameProfile p_i45324_2_) { super(EntityType.field_200729_aH, p_i45324_1_); -@@ -181,6 +188,7 @@ +@@ -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); @@ -29,7 +29,7 @@ } protected void func_70088_a() { -@@ -194,6 +202,7 @@ +@@ -195,6 +203,7 @@ } public void func_70071_h_() { @@ -37,27 +37,27 @@ this.field_70145_X = this.func_175149_v(); if (this.func_175149_v()) { this.field_70122_E = false; -@@ -209,7 +218,7 @@ +@@ -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_70999_a(false, true, true); + this.func_225652_a_(false, true); } } else if (this.field_71076_b > 0) { -@@ -267,6 +276,7 @@ +@@ -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); } - protected boolean func_204229_de() { -@@ -441,10 +451,10 @@ + 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.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2); + 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; @@ -67,22 +67,22 @@ } } -@@ -557,6 +567,7 @@ +@@ -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_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); + this.func_226264_Z_(); if (!this.func_175149_v()) { -@@ -611,12 +622,14 @@ +@@ -623,12 +634,14 @@ + } - @Nullable - public ItemEntity func_71040_bB(boolean p_71040_1_) { -- return this.func_146097_a(this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_71040_1_ && !this.field_71071_by.func_70448_g().func_190926_b() ? this.field_71071_by.func_70448_g().func_190916_E() : 1), false, true); + 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 null; -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_71040_1_ && !this.field_71071_by.func_70448_g().func_190926_b() ? this.field_71071_by.func_70448_g().func_190916_E() : 1), true); ++ 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 @@ -92,7 +92,7 @@ } @Nullable -@@ -650,7 +663,12 @@ +@@ -662,7 +675,12 @@ } } @@ -105,7 +105,7 @@ float f = this.field_71071_by.func_184438_a(p_184813_1_); if (f > 1.0F) { int i = EnchantmentHelper.func_185293_e(this); -@@ -692,11 +710,12 @@ +@@ -704,11 +722,12 @@ f /= 5.0F; } @@ -119,7 +119,7 @@ } public void func_70037_a(CompoundNBT p_70037_1_) { -@@ -720,6 +739,17 @@ +@@ -732,6 +751,17 @@ this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); } @@ -137,7 +137,7 @@ 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)) { -@@ -765,9 +795,26 @@ +@@ -777,6 +807,23 @@ p_213281_1_.func_218657_a("ShoulderEntityRight", this.func_192025_dl()); } @@ -157,6 +157,11 @@ + 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_) { @@ -164,7 +169,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()) { -@@ -799,7 +846,7 @@ +@@ -825,7 +873,7 @@ protected void func_190629_c(LivingEntity p_190629_1_) { super.func_190629_c(p_190629_1_); @@ -173,7 +178,7 @@ this.func_190777_m(true); } -@@ -820,11 +867,12 @@ +@@ -846,11 +894,12 @@ } protected void func_184590_k(float p_184590_1_) { @@ -187,7 +192,7 @@ }); if (this.field_184627_bm.func_190926_b()) { if (hand == Hand.MAIN_HAND) { -@@ -842,11 +890,14 @@ +@@ -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_)) { @@ -195,23 +200,22 @@ + 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 f = p_70665_2_; - p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); - this.func_110149_m(this.func_110139_bj() - (f - p_70665_2_)); -+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, p_70665_2_); - float f1 = f - p_70665_2_; - if (f1 > 0.0F && f1 < 3.4028235E37F) { - this.func_195067_a(Stats.field_212738_J, Math.round(f1 * 10.0F)); -@@ -901,6 +952,8 @@ + 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_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l(); + ItemStack itemstack1 = itemstack.func_77946_l(); if (p_190775_1_.func_184230_a(this, p_190775_2_)) { -@@ -908,6 +961,9 @@ +@@ -933,6 +987,9 @@ itemstack.func_190920_e(itemstack1.func_190916_E()); } @@ -221,7 +225,7 @@ return ActionResultType.SUCCESS; } else { if (!itemstack.func_190926_b() && p_190775_1_ instanceof LivingEntity) { -@@ -917,6 +973,7 @@ +@@ -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) { @@ -229,7 +233,7 @@ this.func_184611_a(p_190775_2_, ItemStack.field_190927_a); } -@@ -943,6 +1000,7 @@ +@@ -1018,6 +1076,7 @@ } public void func_71059_n(Entity p_71059_1_) { @@ -237,7 +241,7 @@ 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(); -@@ -970,8 +1028,10 @@ +@@ -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(); @@ -249,7 +253,7 @@ } f = f + f1; -@@ -1059,8 +1119,10 @@ +@@ -1134,8 +1195,10 @@ } if (!this.field_70170_p.field_72995_K && !itemstack1.func_190926_b() && entity instanceof LivingEntity) { @@ -260,7 +264,7 @@ this.func_184611_a(Hand.MAIN_HAND, ItemStack.field_190927_a); } } -@@ -1102,7 +1164,7 @@ +@@ -1177,7 +1240,7 @@ } if (this.field_70146_Z.nextFloat() < f) { @@ -269,7 +273,7 @@ this.func_184602_cy(); this.field_70170_p.func_72960_a(this, (byte)30); } -@@ -1128,8 +1190,9 @@ +@@ -1203,8 +1266,9 @@ public void func_71004_bE() { } @@ -281,7 +285,7 @@ this.field_71069_bz.func_75134_a(this); if (this.field_71070_bA != null) { this.field_71070_bA.func_75134_a(this); -@@ -1146,6 +1209,9 @@ +@@ -1221,6 +1285,9 @@ } public Either func_213819_a(BlockPos p_213819_1_) { @@ -291,33 +295,33 @@ 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()) { -@@ -1156,7 +1222,7 @@ +@@ -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); } - -@@ -1197,6 +1263,8 @@ +@@ -1274,6 +1341,8 @@ private boolean func_190774_a(BlockPos p_190774_1_, Direction p_190774_2_) { - if (Math.abs(this.field_70165_t - (double)p_190774_1_.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)p_190774_1_.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)p_190774_1_.func_177952_p()) <= 3.0D) { + if (Math.abs(this.func_226277_ct_() - (double)p_190774_1_.func_177958_n()) <= 3.0D && Math.abs(this.func_226278_cu_() - (double)p_190774_1_.func_177956_o()) <= 2.0D && Math.abs(this.func_226281_cx_() - (double)p_190774_1_.func_177952_p()) <= 3.0D) { return true; + } else if (p_190774_2_ == null) { + return false; } else { BlockPos blockpos = p_190774_1_.func_177972_a(p_190774_2_.func_176734_d()); - return Math.abs(this.field_70165_t - (double)blockpos.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)blockpos.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)blockpos.func_177952_p()) <= 3.0D; -@@ -1209,6 +1277,7 @@ + return Math.abs(this.func_226277_ct_() - (double)blockpos.func_177958_n()) <= 3.0D && Math.abs(this.func_226278_cu_() - (double)blockpos.func_177956_o()) <= 2.0D && Math.abs(this.func_226281_cx_() - (double)blockpos.func_177952_p()) <= 3.0D; +@@ -1286,6 +1355,7 @@ } - public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, p_70999_2_, p_70999_3_); - Optional optional = this.func_213374_dv(); + 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_70999_2_) { -@@ -1229,17 +1298,17 @@ + if (this.field_70170_p instanceof ServerWorld && p_225652_2_) { + ((ServerWorld)this.field_70170_p).func_72854_c(); +@@ -1299,17 +1369,17 @@ } public static Optional func_213822_a(IWorldReader p_213822_0_, BlockPos p_213822_1_, boolean p_213822_2_) { @@ -339,7 +343,7 @@ } } -@@ -1254,23 +1323,67 @@ +@@ -1324,15 +1394,62 @@ public void func_146105_b(ITextComponent p_146105_1_, boolean p_146105_2_) { } @@ -376,17 +380,10 @@ + } + + @Deprecated //Forge: Use Dimension sensitive version - public void func_180473_a(BlockPos p_180473_1_, boolean p_180473_2_) { -- if (p_180473_1_ != null) { -- this.field_71077_c = p_180473_1_; -- this.field_82248_d = p_180473_2_; -- } else { -- this.field_71077_c = null; -- this.field_82248_d = false; -- } -+ setSpawnPoint(p_180473_1_, p_180473_2_, this.field_71093_bK); + 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. @@ -394,60 +391,54 @@ + * @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 pos, boolean forced, net.minecraft.world.dimension.DimensionType dim) { -+ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, pos, forced)) return; -+ if (dim != net.minecraft.world.dimension.DimensionType.field_223227_a_) { -+ if (pos == null) { -+ spawnPosMap.remove(dim.getRegistryName()); -+ spawnForcedMap.remove(dim.getRegistryName()); -+ } else { -+ spawnPosMap.put(dim.getRegistryName(), pos); -+ spawnForcedMap.put(dim.getRegistryName(), forced); -+ } -+ return; -+ } -+ if (pos != null) { -+ this.field_71077_c = pos; -+ this.field_82248_d = forced; -+ } else { -+ this.field_71077_c = null; -+ this.field_82248_d = false; -+ } - } ++ 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")); +@@ -1505,6 +1622,7 @@ - public void func_195066_a(ResourceLocation p_195066_1_) { -@@ -1436,6 +1549,8 @@ - } - - super.func_180430_e(p_180430_1_, p_180430_2_); -+ } else { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, p_180430_1_, p_180430_2_); - } - } - -@@ -1462,6 +1577,10 @@ + 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) { +@@ -1559,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); -@@ -1501,6 +1620,10 @@ +@@ -1598,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; -@@ -1703,7 +1826,10 @@ +@@ -1788,7 +1914,10 @@ } public ITextComponent func_145748_c_() { @@ -459,10 +450,11 @@ return this.func_208016_c(itextcomponent); } -@@ -1939,4 +2065,44 @@ +@@ -2028,4 +2157,45 @@ return this.field_221260_g; } } ++ + // =========== FORGE START ==============// + public net.minecraft.world.dimension.DimensionType getSpawnDimension() { + return this.spawnDimension; diff --git a/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch b/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch index 6dcea6f06..c004f20ae 100644 --- a/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/player/ServerPlayerEntity.java +++ b/net/minecraft/entity/player/ServerPlayerEntity.java -@@ -436,6 +436,7 @@ +@@ -432,6 +432,7 @@ } public void func_70645_a(DamageSource p_70645_1_) { @@ -8,16 +8,7 @@ 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(); -@@ -477,7 +478,7 @@ - livingentity.func_191956_a(this, this.field_70744_aE, p_70645_1_); - if (!this.field_70170_p.field_72995_K && livingentity instanceof WitherEntity) { - boolean flag1 = false; -- 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.field_70165_t, this.field_70163_u, this.field_70161_v); - 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)) { -@@ -568,8 +569,10 @@ +@@ -550,8 +551,10 @@ return this.field_71133_b.func_71219_W(); } @@ -28,12 +19,12 @@ this.field_184851_cj = true; DimensionType dimensiontype = this.field_71093_bK; if (dimensiontype == DimensionType.field_223229_c_ && p_212321_1_ == DimensionType.field_223227_a_) { -@@ -587,12 +590,13 @@ +@@ -569,12 +572,13 @@ this.field_71093_bK = p_212321_1_; ServerWorld serverworld1 = this.field_71133_b.func_71218_a(p_212321_1_); - WorldInfo worldinfo = this.field_70170_p.func_72912_H(); + 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_76067_t(), this.field_71134_c.func_73081_b())); + 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); @@ -41,10 +32,10 @@ - this.field_70128_L = false; + serverworld.removeEntity(this, true); //Forge: the player entity is moved to the new world, NOT cloned. So keep the data alive with no matching invalidate call. + this.revive(); - double d0 = this.field_70165_t; - double d1 = this.field_70163_u; - double d2 = this.field_70161_v; -@@ -601,13 +605,11 @@ + double d0 = this.func_226277_ct_(); + double d1 = this.func_226278_cu_(); + double d2 = this.func_226281_cx_(); +@@ -583,13 +587,11 @@ double d3 = 8.0D; float f2 = f1; serverworld.func_217381_Z().func_76320_a("moving"); @@ -52,7 +43,7 @@ + d0 *= moveFactor; + d2 *= moveFactor; if (dimensiontype == DimensionType.field_223227_a_ && p_212321_1_ == DimensionType.field_223228_b_) { - this.field_193110_cw = new Vec3d(this.field_70165_t, this.field_70163_u, this.field_70161_v); + 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_) { @@ -61,7 +52,7 @@ } 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(); -@@ -671,6 +673,7 @@ +@@ -653,6 +655,7 @@ this.field_71144_ck = -1; this.field_71149_ch = -1.0F; this.field_71146_ci = -1; @@ -69,21 +60,7 @@ return this; } } -@@ -776,11 +779,11 @@ - BlockPos blockpos = new BlockPos(i, j, k); - if (this.field_70170_p.func_175667_e(blockpos)) { - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); -- if (blockstate.func_196958_f()) { -+ if (blockstate.isAir(field_70170_p, blockpos)) { - BlockPos blockpos1 = blockpos.func_177977_b(); - BlockState blockstate1 = this.field_70170_p.func_180495_p(blockpos1); - Block block = blockstate1.func_177230_c(); -- 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, blockpos, this)) { - blockpos = blockpos1; - blockstate = blockstate1; - } -@@ -819,6 +822,7 @@ +@@ -788,6 +791,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; @@ -91,7 +68,7 @@ return OptionalInt.of(this.field_71139_cq); } } -@@ -837,6 +841,7 @@ +@@ -806,6 +810,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); @@ -99,7 +76,7 @@ } public void func_184814_a(ItemStack p_184814_1_, Hand p_184814_2_) { -@@ -894,6 +899,7 @@ +@@ -863,6 +868,7 @@ public void func_71128_l() { this.field_71070_bA.func_75134_a(this); @@ -107,7 +84,7 @@ this.field_71070_bA = this.field_71069_bz; } -@@ -1020,6 +1026,20 @@ +@@ -989,6 +995,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()); @@ -128,7 +105,7 @@ } protected void func_70670_a(EffectInstance p_70670_1_) { -@@ -1242,15 +1262,16 @@ +@@ -1207,15 +1227,16 @@ 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_); @@ -138,7 +115,7 @@ 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_76067_t(), this.field_71134_c.func_73081_b())); + 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); @@ -148,7 +125,7 @@ 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); -@@ -1259,6 +1280,7 @@ +@@ -1224,6 +1245,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); @@ -156,7 +133,7 @@ } } -@@ -1293,6 +1315,8 @@ +@@ -1261,6 +1283,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 f48744c88..4d7125243 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 -@@ -161,7 +161,7 @@ +@@ -160,7 +160,7 @@ - BlockPos blockpos = new BlockPos(this.field_70165_t, this.field_70163_u, this.field_70161_v); + 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()) { - for(AxisAlignedBB axisalignedbb : voxelshape.func_197756_d()) { -@@ -217,7 +217,7 @@ + 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)) { ++ 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/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch index a219051b4..72ac1fc65 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/projectile/DamagingProjectileEntity.java +++ b/net/minecraft/entity/projectile/DamagingProjectileEntity.java -@@ -79,7 +79,7 @@ +@@ -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); diff --git a/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch index 9d20d5541..ee544eeb7 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 -@@ -37,7 +37,7 @@ +@@ -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.field_70165_t, this.field_70163_u, this.field_70161_v, (float)this.field_92057_e, flag, flag ? Explosion.Mode.DESTROY : Explosion.Mode.NONE); + this.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 96405a1cb..bbc76d9e8 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/projectile/FishingBobberEntity.java +++ b/net/minecraft/entity/projectile/FishingBobberEntity.java -@@ -210,8 +210,8 @@ +@@ -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(); @@ -11,25 +11,25 @@ if (!this.field_146042_b.field_70128_L && this.field_146042_b.func_70089_S() && (flag || flag1) && !(this.func_70068_e(this.field_146042_b) > 1024.0D)) { return false; } else { -@@ -295,7 +295,7 @@ - double d1 = (double)((float)MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) + 1.0F); - double d2 = this.field_70161_v + (double)(f2 * (float)this.field_146038_az * 0.1F); +@@ -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); } -@@ -332,7 +332,7 @@ - double d5 = (double)((float)MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) + 1.0F); - double d6 = this.field_70161_v + (double)(MathHelper.func_76134_b(f6) * f7 * 0.1F); +@@ -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); } } -@@ -357,6 +357,7 @@ +@@ -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; @@ -37,7 +37,7 @@ 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()); -@@ -364,8 +365,15 @@ +@@ -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()); @@ -53,7 +53,7 @@ CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)this.field_146042_b, p_146034_1_, this, list); for(ItemStack itemstack : list) { -@@ -390,7 +398,7 @@ +@@ -387,7 +395,7 @@ } this.func_70106_y(); @@ -62,7 +62,7 @@ } else { return 0; } -@@ -416,8 +424,9 @@ +@@ -413,8 +421,9 @@ return false; } diff --git a/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch index 971348521..bb63e85d5 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/projectile/ProjectileHelper.java +++ b/net/minecraft/entity/projectile/ProjectileHelper.java -@@ -89,7 +89,7 @@ +@@ -86,7 +86,7 @@ Vec3d vec3d1 = optional.get(); double d1 = p_221273_1_.func_72436_e(vec3d1); if (d1 < d0 || d0 == 0.0D) { diff --git a/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch index 2b5d6a4e8..4d51dd74d 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 -@@ -251,7 +251,7 @@ - } - - RayTraceResult raytraceresult = ProjectileHelper.func_221266_a(this, true, false, this.field_184570_a, RayTraceContext.BlockMode.COLLIDER); -- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) { -+ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_184567_a(raytraceresult); - } +@@ -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/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch index 72749ee61..22b498a12 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/projectile/SmallFireballEntity.java +++ b/net/minecraft/entity/projectile/SmallFireballEntity.java -@@ -40,7 +40,7 @@ +@@ -41,7 +41,7 @@ entity.func_223308_g(i); } } diff --git a/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch index 00ff984b1..8c2c14e89 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/projectile/ThrowableEntity.java +++ b/net/minecraft/entity/projectile/ThrowableEntity.java -@@ -133,7 +133,7 @@ +@@ -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()); diff --git a/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch index 26274f373..6da8d57e0 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch @@ -9,12 +9,12 @@ } protected void func_70227_a(RayTraceResult p_70227_1_) { -@@ -81,7 +81,7 @@ +@@ -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.field_70165_t, this.field_70163_u, this.field_70161_v, 1.0F, false, explosion$mode); + 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 a670923c7..29ed2bf07 100644 --- a/patches/minecraft/net/minecraft/fluid/Fluid.java.patch +++ b/patches/minecraft/net/minecraft/fluid/Fluid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/fluid/Fluid.java +++ b/net/minecraft/fluid/Fluid.java -@@ -19,7 +19,7 @@ +@@ -18,7 +18,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -9,12 +9,12 @@ public static final ObjectIntIdentityMap field_207201_d = new ObjectIntIdentityMap<>(); protected final StateContainer field_207202_e; private IFluidState field_207200_b; -@@ -102,4 +102,26 @@ +@@ -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::getCollection); ++ 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(); diff --git a/patches/minecraft/net/minecraft/fluid/IFluidState.java.patch b/patches/minecraft/net/minecraft/fluid/IFluidState.java.patch index 59712e4e9..78269bdf9 100644 --- a/patches/minecraft/net/minecraft/fluid/IFluidState.java.patch +++ b/patches/minecraft/net/minecraft/fluid/IFluidState.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/fluid/IFluidState.java +++ b/net/minecraft/fluid/IFluidState.java -@@ -29,7 +29,7 @@ +@@ -26,7 +26,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -9,7 +9,7 @@ Fluid func_206886_c(); default boolean func_206889_d() { -@@ -107,6 +107,7 @@ +@@ -99,6 +99,7 @@ return this.func_206886_c().func_207185_a(p_206884_1_); } diff --git a/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch b/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch index 388ff810e..593382ed8 100644 --- a/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch +++ b/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/fluid/LavaFluid.java +++ b/net/minecraft/fluid/LavaFluid.java -@@ -76,7 +76,7 @@ +@@ -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)) { @@ -9,7 +9,7 @@ return; } } else if (blockstate.func_185904_a().func_76230_c()) { -@@ -91,7 +91,7 @@ +@@ -85,7 +85,7 @@ } if (p_207186_1_.func_175623_d(blockpos1.func_177984_a()) && this.func_176368_m(p_207186_1_, blockpos1)) { @@ -18,7 +18,7 @@ } } } -@@ -169,7 +169,7 @@ +@@ -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) { diff --git a/patches/minecraft/net/minecraft/inventory/container/Container.java.patch b/patches/minecraft/net/minecraft/inventory/container/Container.java.patch index 113363262..2650329de 100644 --- a/patches/minecraft/net/minecraft/inventory/container/Container.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/Container.java.patch @@ -5,7 +5,7 @@ ItemStack itemstack1 = this.field_75153_a.get(i); if (!ItemStack.func_77989_b(itemstack1, itemstack)) { + boolean clientStackChanged = !itemstack1.equals(itemstack, true); - itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l(); + itemstack1 = itemstack.func_77946_l(); this.field_75153_a.set(i, itemstack1); + if (clientStackChanged) diff --git a/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch index 230354f5b..166ad22be 100644 --- a/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/inventory/container/PlayerContainer.java +++ b/net/minecraft/inventory/container/PlayerContainer.java -@@ -43,7 +43,7 @@ +@@ -50,7 +50,7 @@ } public boolean func_75214_a(ItemStack p_75214_1_) { diff --git a/patches/minecraft/net/minecraft/inventory/container/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/container/Slot.java.patch index c4872bb47..7a99868fa 100644 --- a/patches/minecraft/net/minecraft/inventory/container/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/Slot.java.patch @@ -1,69 +1,20 @@ --- a/net/minecraft/inventory/container/Slot.java +++ b/net/minecraft/inventory/container/Slot.java -@@ -13,6 +13,9 @@ - public int field_75222_d; - public int field_75223_e; - public int field_75221_f; -+ protected String backgroundName = null; -+ protected net.minecraft.util.ResourceLocation backgroundLocation = null; -+ protected Object backgroundMap; - - public Slot(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) { - this.field_75224_c = p_i1824_1_; -@@ -75,7 +78,7 @@ +@@ -77,7 +77,7 @@ @Nullable @OnlyIn(Dist.CLIENT) - public String func_178171_c() { + public Pair func_225517_c_() { - return null; -+ return backgroundName; ++ return backgroundPair; } public ItemStack func_75209_a(int p_75209_1_) { -@@ -90,4 +93,62 @@ +@@ -92,4 +92,36 @@ public boolean func_111238_b() { return true; } + + /** -+ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. -+ * @return The resource location for the background image -+ */ -+ @OnlyIn(Dist.CLIENT) -+ public net.minecraft.util.ResourceLocation getBackgroundLocation() { -+ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.AtlasTexture.field_110575_b : backgroundLocation); -+ } -+ -+ /** -+ * Sets the texture file to use for the background image of the slot when it's empty. -+ * @param texture the resourcelocation for the texture -+ */ -+ @OnlyIn(Dist.CLIENT) -+ public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture) { -+ this.backgroundLocation = texture; -+ } -+ -+ /** -+ * Sets which icon index to use as the background image of the slot when it's empty. -+ * @param name The icon to use, null for none -+ */ -+ public void setBackgroundName(@Nullable String name) { -+ this.backgroundName = name; -+ } -+ -+ @Nullable -+ @OnlyIn(Dist.CLIENT) -+ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() { -+ String name = func_178171_c(); -+ return name == null ? null : getBackgroundMap().func_110572_b(name); -+ } -+ -+ @OnlyIn(Dist.CLIENT) -+ protected net.minecraft.client.renderer.texture.AtlasTexture getBackgroundMap() { -+ if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.func_71410_x().func_147117_R(); -+ return (net.minecraft.client.renderer.texture.AtlasTexture)backgroundMap; -+ } -+ -+ /** + * Retrieves the index in the inventory for this slot, this value should typically not + * be used, but can be useful for some occasions. + * @@ -80,5 +31,18 @@ + */ + 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/minecraft/net/minecraft/inventory/container/StonecutterContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/StonecutterContainer.java.patch deleted file mode 100644 index 8cf072cd1..000000000 --- a/patches/minecraft/net/minecraft/inventory/container/StonecutterContainer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/inventory/container/StonecutterContainer.java -+++ b/net/minecraft/inventory/container/StonecutterContainer.java -@@ -183,7 +183,7 @@ - if (!this.func_75135_a(itemstack1, 2, 38, false)) { - return ItemStack.field_190927_a; - } -- } else if (field_217084_c.contains(item)) { -+ } else if (!this.field_217090_i.func_199532_z().func_215370_b(IRecipeType.field_222154_f, new Inventory(itemstack1), this.field_217090_i).isEmpty()) { - if (!this.func_75135_a(itemstack1, 0, 1, false)) { - return ItemStack.field_190927_a; - } diff --git a/patches/minecraft/net/minecraft/item/ArmorItem.java.patch b/patches/minecraft/net/minecraft/item/ArmorItem.java.patch index 8d20a9c2f..ac2688615 100644 --- a/patches/minecraft/net/minecraft/item/ArmorItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ArmorItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/ArmorItem.java +++ b/net/minecraft/item/ArmorItem.java -@@ -104,4 +104,8 @@ +@@ -102,4 +102,8 @@ public int func_200881_e() { return this.field_77879_b; } diff --git a/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch b/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch index cdade6cce..69195f1f5 100644 --- a/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/BoneMealItem.java +++ b/net/minecraft/item/BoneMealItem.java -@@ -26,7 +26,7 @@ +@@ -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()); @@ -9,7 +9,7 @@ if (!world.field_72995_K) { world.func_217379_c(2005, blockpos, 0); } -@@ -47,8 +47,17 @@ +@@ -48,8 +48,17 @@ } } @@ -27,7 +27,7 @@ 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)) { -@@ -84,7 +93,9 @@ +@@ -87,7 +96,9 @@ } } @@ -38,7 +38,7 @@ 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) { -@@ -124,7 +135,7 @@ +@@ -126,7 +137,7 @@ } BlockState blockstate = p_195965_0_.func_180495_p(p_195965_1_); diff --git a/patches/minecraft/net/minecraft/item/BowItem.java.patch b/patches/minecraft/net/minecraft/item/BowItem.java.patch index 7d6a6f68f..e4cfa098a 100644 --- a/patches/minecraft/net/minecraft/item/BowItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BowItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/BowItem.java +++ b/net/minecraft/item/BowItem.java -@@ -22,7 +22,7 @@ +@@ -21,7 +21,7 @@ if (p_210310_2_ == null) { return 0.0F; } else { @@ -9,7 +9,7 @@ } }); this.func_185043_a(new ResourceLocation("pulling"), (p_210309_0_, p_210309_1_, p_210309_2_) -> { -@@ -35,18 +35,23 @@ +@@ -34,18 +34,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_); @@ -35,7 +35,7 @@ abstractarrowentity.func_184547_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); -@@ -111,6 +116,10 @@ +@@ -110,6 +115,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(); @@ -44,9 +44,9 @@ + if (ret != null) return ret; + if (!p_77659_2_.field_71075_bZ.field_75098_d && !flag) { - return flag ? new ActionResult<>(ActionResultType.PASS, itemstack) : new ActionResult<>(ActionResultType.FAIL, itemstack); + return ActionResult.func_226251_d_(itemstack); } else { -@@ -122,4 +131,8 @@ +@@ -121,4 +130,8 @@ public Predicate func_220004_b() { return field_220007_a; } diff --git a/patches/minecraft/net/minecraft/item/BucketItem.java.patch b/patches/minecraft/net/minecraft/item/BucketItem.java.patch index d253969e7..756ecfeb2 100644 --- a/patches/minecraft/net/minecraft/item/BucketItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BucketItem.java.patch @@ -27,21 +27,21 @@ + ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(p_77659_2_, p_77659_1_, itemstack, raytraceresult); + if (ret != null) return ret; if (raytraceresult.func_216346_c() == RayTraceResult.Type.MISS) { - return new ActionResult<>(ActionResultType.PASS, itemstack); + return ActionResult.func_226250_c_(itemstack); } else if (raytraceresult.func_216346_c() != RayTraceResult.Type.BLOCK) { -@@ -52,7 +66,10 @@ +@@ -54,7 +68,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)); - p_77659_2_.func_184185_a(fluid.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187633_N : SoundEvents.field_187630_M, 1.0F, 1.0F); + + 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; ++ 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()); if (!p_77659_1_.field_72995_K) { CriteriaTriggers.field_204813_j.func_204817_a((ServerPlayerEntity)p_77659_2_, new ItemStack(fluid.func_204524_b())); -@@ -147,7 +164,19 @@ +@@ -148,7 +165,19 @@ } 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 bb4092122..8fce4c2bd 100644 --- a/patches/minecraft/net/minecraft/item/DyeColor.java.patch +++ b/patches/minecraft/net/minecraft/item/DyeColor.java.patch @@ -16,7 +16,7 @@ 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_; } -@@ -115,4 +117,25 @@ +@@ -111,4 +113,25 @@ public String func_176610_l() { return this.field_176785_v; } diff --git a/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch b/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch index 4d12cc523..19b52fe96 100644 --- a/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch +++ b/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/FilledMapItem.java +++ b/net/minecraft/item/FilledMapItem.java -@@ -51,6 +51,16 @@ +@@ -52,6 +52,16 @@ @Nullable public static MapData func_195950_a(ItemStack p_195950_0_, World p_195950_1_) { diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 36f7ad79e..f00f3c81b 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/Item.java +++ b/net/minecraft/item/Item.java -@@ -38,8 +38,8 @@ +@@ -40,8 +40,8 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -11,7 +11,7 @@ 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; }; -@@ -96,6 +96,10 @@ +@@ -98,6 +98,10 @@ this.func_185043_a(new ResourceLocation("damaged"), field_185046_b); this.func_185043_a(new ResourceLocation("damage"), field_185047_c); } @@ -22,7 +22,7 @@ } -@@ -155,10 +159,12 @@ +@@ -157,10 +161,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; } -@@ -213,10 +219,12 @@ +@@ -215,10 +221,12 @@ } @Nullable @@ -48,7 +48,7 @@ public boolean func_77634_r() { return this.field_77700_c != null; } -@@ -277,7 +285,7 @@ +@@ -278,7 +286,7 @@ } public boolean func_77616_k(ItemStack p_77616_1_) { @@ -57,7 +57,7 @@ } protected static RayTraceResult func_219968_a(World p_219968_0_, PlayerEntity p_219968_1_, RayTraceContext.FluidMode p_219968_2_) { -@@ -290,8 +298,8 @@ +@@ -291,8 +299,8 @@ float f5 = MathHelper.func_76126_a(-f * ((float)Math.PI / 180F)); float f6 = f3 * f4; float f7 = f2 * f4; @@ -68,7 +68,7 @@ return p_219968_0_.func_217299_a(new RayTraceContext(vec3d, vec3d1, RayTraceContext.BlockMode.OUTLINE, p_219968_2_, p_219968_1_)); } -@@ -307,6 +315,7 @@ +@@ -308,6 +316,7 @@ } protected boolean func_194125_a(ItemGroup p_194125_1_) { @@ -76,7 +76,7 @@ ItemGroup itemgroup = this.func_77640_w(); return itemgroup != null && (p_194125_1_ == ItemGroup.field_78027_g || p_194125_1_ == itemgroup); } -@@ -320,10 +329,44 @@ +@@ -321,10 +330,44 @@ return false; } @@ -121,7 +121,7 @@ public boolean func_219970_i(ItemStack p_219970_1_) { return p_219970_1_.func_77973_b() == Items.field_222114_py; } -@@ -353,6 +396,9 @@ +@@ -362,6 +405,9 @@ private ItemGroup field_200923_d; private Rarity field_208104_e = Rarity.COMMON; private Food field_221541_f; @@ -131,7 +131,7 @@ public Item.Properties func_221540_a(Food p_221540_1_) { this.field_221541_f = p_221540_1_; -@@ -392,5 +438,20 @@ +@@ -401,5 +447,20 @@ this.field_208104_e = p_208103_1_; return this; } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index a96f03f82..343e52451 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/ItemStack.java +++ b/net/minecraft/item/ItemStack.java -@@ -65,7 +65,7 @@ +@@ -66,7 +66,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,7 +9,7 @@ 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(); -@@ -81,6 +81,9 @@ +@@ -82,6 +82,9 @@ private CachedBlockInfo field_179550_j; private boolean field_179551_k; @@ -19,23 +19,27 @@ private static DecimalFormat func_208306_D() { DecimalFormat decimalformat = new DecimalFormat("#.##"); decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); -@@ -91,10 +94,14 @@ +@@ -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_) { 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() { -@@ -103,6 +110,8 @@ +@@ -108,6 +115,8 @@ } private ItemStack(CompoundNBT p_i47263_1_) { @@ -44,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)) { -@@ -115,6 +124,7 @@ +@@ -120,6 +129,7 @@ } this.func_190923_F(); @@ -52,7 +56,7 @@ } public static ItemStack func_199557_a(CompoundNBT p_199557_0_) { -@@ -129,7 +139,7 @@ +@@ -134,7 +144,7 @@ public boolean func_190926_b() { if (this == field_190927_a) { return true; @@ -61,7 +65,7 @@ return this.field_77994_a <= 0; } else { return true; -@@ -145,10 +155,19 @@ +@@ -150,10 +160,19 @@ } public Item func_77973_b() { @@ -82,7 +86,7 @@ PlayerEntity playerentity = p_196084_1_.func_195999_j(); BlockPos blockpos = p_196084_1_.func_195995_a(); CachedBlockInfo cachedblockinfo = new CachedBlockInfo(p_196084_1_.func_195991_k(), blockpos, false); -@@ -156,7 +175,7 @@ +@@ -161,7 +180,7 @@ return ActionResultType.PASS; } else { Item item = this.func_77973_b(); @@ -91,9 +95,9 @@ if (playerentity != null && actionresulttype == ActionResultType.SUCCESS) { playerentity.func_71029_a(Stats.field_75929_E.func_199076_b(item)); } -@@ -184,12 +203,15 @@ +@@ -189,12 +208,15 @@ if (this.field_77990_d != null) { - p_77955_1_.func_218657_a("tag", this.field_77990_d); + p_77955_1_.func_218657_a("tag", this.field_77990_d.func_74737_b()); } - + CompoundNBT cnbt = this.serializeCaps(); @@ -109,7 +113,7 @@ } public boolean func_77985_e() { -@@ -197,7 +219,7 @@ +@@ -202,7 +224,7 @@ } public boolean func_77984_f() { @@ -118,7 +122,7 @@ CompoundNBT compoundnbt = this.func_77978_p(); return compoundnbt == null || !compoundnbt.func_74767_n("Unbreakable"); } else { -@@ -206,19 +228,19 @@ +@@ -211,19 +233,19 @@ } public boolean func_77951_h() { @@ -142,7 +146,7 @@ } public boolean func_96631_a(int p_96631_1_, Random p_96631_2_, @Nullable ServerPlayerEntity p_96631_3_) { -@@ -254,6 +276,7 @@ +@@ -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()) { @@ -150,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(); -@@ -286,7 +309,7 @@ +@@ -291,7 +314,7 @@ } public boolean func_150998_b(BlockState p_150998_1_) { @@ -159,16 +163,16 @@ } public boolean func_111282_a(PlayerEntity p_111282_1_, LivingEntity p_111282_2_, Hand p_111282_3_) { -@@ -294,7 +317,7 @@ - } - - public ItemStack func_77946_l() { -- 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(); -@@ -310,7 +333,7 @@ +@@ -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 { @@ -177,7 +181,7 @@ } } else { return false; -@@ -333,7 +356,7 @@ +@@ -342,7 +365,7 @@ } else if (this.field_77990_d == null && p_77959_1_.field_77990_d != null) { return false; } else { @@ -186,7 +190,7 @@ } } -@@ -639,6 +662,7 @@ +@@ -648,6 +671,7 @@ } } @@ -194,7 +198,7 @@ return list; } -@@ -760,7 +784,7 @@ +@@ -768,7 +792,7 @@ } } } else { @@ -202,12 +206,11 @@ + multimap = this.func_77973_b().getAttributeModifiers(p_111283_1_, this); } - return multimap; -@@ -899,4 +923,33 @@ - public boolean func_222117_E() { + multimap.values().forEach((p_226631_0_) -> { +@@ -911,6 +935,35 @@ return this.func_77973_b().func_219971_r(); } -+ + + // FORGE START + public void deserializeNBT(CompoundNBT nbt) { + final ItemStack itemStack = ItemStack.func_199557_a(nbt); @@ -236,4 +239,7 @@ + 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/minecraft/net/minecraft/item/LilyPadItem.java.patch b/patches/minecraft/net/minecraft/item/LilyPadItem.java.patch index 9d123736d..6f6375d5f 100644 --- a/patches/minecraft/net/minecraft/item/LilyPadItem.java.patch +++ b/patches/minecraft/net/minecraft/item/LilyPadItem.java.patch @@ -10,7 +10,7 @@ p_77659_1_.func_180501_a(blockpos1, Blocks.field_196651_dG.func_176223_P(), 11); + if (net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_77659_2_, blocksnapshot, net.minecraft.util.Direction.UP)) { + blocksnapshot.restore(true, false); -+ return new ActionResult(ActionResultType.FAIL, itemstack); ++ return ActionResult.func_226251_d_(itemstack); + } + if (p_77659_2_ instanceof ServerPlayerEntity) { diff --git a/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch b/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch index 4c0dcf930..a9efaeda7 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 -@@ -16,6 +16,8 @@ +@@ -15,6 +15,8 @@ } public ItemStack func_77654_b(ItemStack p_77654_1_, World p_77654_2_, LivingEntity p_77654_3_) { @@ -9,9 +9,9 @@ if (p_77654_3_ instanceof ServerPlayerEntity) { ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)p_77654_3_; CriteriaTriggers.field_193138_y.func_193148_a(serverplayerentity, p_77654_1_); -@@ -45,4 +47,9 @@ +@@ -44,4 +46,9 @@ p_77659_2_.func_184598_c(p_77659_3_); - return new ActionResult<>(ActionResultType.SUCCESS, p_77659_2_.func_184586_b(p_77659_3_)); + return ActionResult.func_226248_a_(p_77659_2_.func_184586_b(p_77659_3_)); } + + @Override diff --git a/patches/minecraft/net/minecraft/item/ShearsItem.java.patch b/patches/minecraft/net/minecraft/item/ShearsItem.java.patch index fd9b081b4..2cb1d3f8e 100644 --- a/patches/minecraft/net/minecraft/item/ShearsItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ShearsItem.java.patch @@ -11,7 +11,7 @@ + if (entity.field_70170_p.field_72995_K) return false; + if (entity instanceof net.minecraftforge.common.IShearable) { + net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; -+ BlockPos pos = new BlockPos(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v); ++ 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)); diff --git a/patches/minecraft/net/minecraft/item/ShovelItem.java.patch b/patches/minecraft/net/minecraft/item/ShovelItem.java.patch index fdacac06f..4e504aa46 100644 --- a/patches/minecraft/net/minecraft/item/ShovelItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ShovelItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/ShovelItem.java +++ b/net/minecraft/item/ShovelItem.java -@@ -21,7 +21,7 @@ +@@ -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_) { @@ -9,12 +9,12 @@ } public boolean func_150897_b(BlockState p_150897_1_) { -@@ -32,7 +32,7 @@ - public ActionResultType func_195939_a(ItemUseContext p_195939_1_) { - World world = p_195939_1_.func_195991_k(); - BlockPos blockpos = p_195939_1_.func_195995_a(); -- if (p_195939_1_.func_196000_l() != Direction.DOWN && world.func_180495_p(blockpos.func_177984_a()).func_196958_f()) { -+ if (p_195939_1_.func_196000_l() != Direction.DOWN && world.func_180495_p(blockpos.func_177984_a()).isAir(world, blockpos.func_177984_a())) { - BlockState blockstate = field_195955_e.get(world.func_180495_p(blockpos).func_177230_c()); - if (blockstate != null) { - PlayerEntity playerentity = p_195939_1_.func_195999_j(); +@@ -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/minecraft/net/minecraft/nbt/CompoundNBT.java.patch b/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch index 4c14a9a4b..eaca9d010 100644 --- a/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch @@ -1,6 +1,14 @@ --- a/net/minecraft/nbt/CompoundNBT.java +++ b/net/minecraft/nbt/CompoundNBT.java -@@ -72,6 +72,7 @@ +@@ -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_) { @@ -8,7 +16,7 @@ return this.field_74784_a.put(p_218657_1_, p_218657_2_); } -@@ -390,6 +391,7 @@ +@@ -410,11 +412,12 @@ } private static byte func_152447_a(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException { @@ -16,11 +24,9 @@ return p_152447_0_.readByte(); } -@@ -398,6 +400,7 @@ + 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()); } - static INBT func_152449_a(byte p_152449_0_, String p_152449_1_, DataInput p_152449_2_, int p_152449_3_, NBTSizeTracker p_152449_4_) throws IOException { -+ p_152449_4_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. - INBT inbt = INBT.func_150284_a(p_152449_0_); - - try { + 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/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index bb7e1d677..cf6e70f88 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -6,11 +6,11 @@ byte b0 = p_152455_0_.readByte(); + p_152455_2_.func_152450_a(8); // Forge: Count everything! if (b0 == 0) { - return new EndNBT(); + return EndNBT.field_229686_b_; } else { - p_152455_0_.readUTF(); -+ NBTSizeTracker.readUTF(p_152455_2_, p_152455_0_.readUTF()); //Forge: Count this string. ++ 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. - INBT inbt = INBT.func_150284_a(b0); try { + return NBTTypes.func_229710_a_(b0).func_225649_b_(p_152455_0_, p_152455_1_, p_152455_2_); diff --git a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch index 2c2d1ec90..8bde6e848 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/nbt/NBTSizeTracker.java +++ b/net/minecraft/nbt/NBTSizeTracker.java -@@ -18,4 +18,32 @@ +@@ -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); } } @@ -16,10 +16,10 @@ + * + * This will accurately count the correct byte length to encode this string, plus the 2 bytes for it's length prefix. + */ -+ public static void readUTF(NBTSizeTracker tracker, String data) { -+ tracker.func_152450_a(16); //Header length ++ public String readUTF(String data) { ++ func_152450_a(16); //Header length + if (data == null) -+ return; ++ return data; + + int len = data.length(); + int utflen = 0; @@ -30,6 +30,8 @@ + else if (c > 0x07FF) utflen += 3; + else utflen += 2; + } -+ tracker.func_152450_a(8 * utflen); ++ func_152450_a(8 * utflen); ++ ++ return data; + } } diff --git a/patches/minecraft/net/minecraft/nbt/StringNBT.java.patch b/patches/minecraft/net/minecraft/nbt/StringNBT.java.patch index 3399f81ce..1a2c869e8 100644 --- a/patches/minecraft/net/minecraft/nbt/StringNBT.java.patch +++ b/patches/minecraft/net/minecraft/nbt/StringNBT.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/nbt/StringNBT.java +++ b/net/minecraft/nbt/StringNBT.java -@@ -26,7 +26,7 @@ - public void func_152446_a(DataInput p_152446_1_, int p_152446_2_, NBTSizeTracker p_152446_3_) throws IOException { - p_152446_3_.func_152450_a(288L); - this.field_74751_a = p_152446_1_.readUTF(); -- p_152446_3_.func_152450_a((long)(16 * this.field_74751_a.length())); -+ NBTSizeTracker.readUTF(p_152446_3_, this.field_74751_a); // Forge: Correctly read String length including header. - } +@@ -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); + } - public byte func_74732_a() { diff --git a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch index dce759fab..fd756db38 100644 --- a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -33,7 +33,7 @@ final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND); + networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel; Class oclass; - LazyLoadBase lazyloadbase; + LazyValue lazyvalue; if (Epoll.isAvailable() && p_181124_2_) { @@ -285,6 +289,7 @@ @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch index f40a170de..53b4733d3 100644 --- a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -1,16 +1,15 @@ --- a/net/minecraft/network/NetworkSystem.java +++ b/net/minecraft/network/NetworkSystem.java -@@ -41,12 +41,13 @@ - import org.apache.logging.log4j.Logger; +@@ -42,11 +42,12 @@ public class NetworkSystem { -+ private static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("forge.readTimeout", "30")); private static final Logger field_151275_b = LogManager.getLogger(); - public static final LazyLoadBase field_151276_c = new LazyLoadBase<>(() -> { ++ 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 LazyLoadBase field_181141_b = new LazyLoadBase<>(() -> { + 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()); }); @@ -23,7 +22,7 @@ + if (p_151265_1_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false"); synchronized(this.field_151274_e) { Class oclass; - LazyLoadBase lazyloadbase; + LazyValue lazyvalue; @@ -80,7 +82,7 @@ ; } diff --git a/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch b/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch index b6b3c9608..9b6d57a65 100644 --- a/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch +++ b/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch @@ -5,7 +5,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; -public class PacketBuffer extends ByteBuf { -+public class PacketBuffer extends ByteBuf implements net.minecraftforge.common.extensions.IForgePacketBuffer{ ++public class PacketBuffer extends ByteBuf implements net.minecraftforge.common.extensions.IForgePacketBuffer { private final ByteBuf field_150794_a; public PacketBuffer(ByteBuf p_i45154_1_) { diff --git a/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch b/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch index 495c11300..a76cabf10 100644 --- a/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch +++ b/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/network/play/ServerPlayNetHandler.java +++ b/net/minecraft/network/play/ServerPlayNetHandler.java -@@ -337,9 +337,11 @@ +@@ -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_195586_b(entity, entity.func_174813_aQ().func_186664_h(0.0625D)); + 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; } -@@ -839,7 +841,9 @@ +@@ -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()) { @@ -20,10 +20,10 @@ + 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)) { - this.field_147369_b.field_71134_c.func_219441_a(this.field_147369_b, serverworld, itemstack, hand, blockraytraceresult); - } - } else { -@@ -959,7 +963,9 @@ + 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 { @@ -34,15 +34,15 @@ this.field_147367_d.func_184103_al().func_148544_a(itextcomponent, false); } -@@ -1057,6 +1063,7 @@ +@@ -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; - entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), hand1); - } else if (p_147340_1_.func_149565_c() == CUseEntityPacket.Action.ATTACK) { - if (entity instanceof ItemEntity || entity instanceof ExperienceOrbEntity || entity instanceof AbstractArrowEntity || entity == this.field_147369_b) { -@@ -1087,7 +1094,7 @@ + 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; } @@ -51,7 +51,7 @@ 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); -@@ -1264,6 +1271,8 @@ +@@ -1268,6 +1275,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 e7cab8999..042734589 100644 --- a/patches/minecraft/net/minecraft/network/play/server/SJoinGamePacket.java.patch +++ b/patches/minecraft/net/minecraft/network/play/server/SJoinGamePacket.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/network/play/server/SJoinGamePacket.java +++ b/net/minecraft/network/play/server/SJoinGamePacket.java -@@ -19,6 +19,7 @@ - private WorldType field_149201_g; +@@ -21,6 +21,7 @@ private int field_218729_g; private boolean field_179745_h; + private boolean field_229741_j_; + private int dimensionInt; public SJoinGamePacket() { } -@@ -40,7 +41,7 @@ +@@ -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)); - if (this.field_149201_g == null) { -@@ -87,7 +88,7 @@ +@@ -100,7 +101,7 @@ @OnlyIn(Dist.CLIENT) public DimensionType func_212642_e() { 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 018bce9b2..70c58689e 100644 --- a/patches/minecraft/net/minecraft/network/play/server/SRespawnPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/play/server/SRespawnPacket.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/network/play/server/SRespawnPacket.java +++ b/net/minecraft/network/play/server/SRespawnPacket.java -@@ -14,6 +14,7 @@ - private DimensionType field_149088_a; +@@ -15,6 +15,7 @@ + private long field_229746_b_; private GameType field_149087_c; private WorldType field_149085_d; + private int dimensionInt; public SRespawnPacket() { } -@@ -29,7 +30,7 @@ +@@ -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)); - if (this.field_149085_d == null) { -@@ -46,7 +47,7 @@ +@@ -50,7 +51,7 @@ @OnlyIn(Dist.CLIENT) public DimensionType func_212643_b() { diff --git a/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch b/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch index b8ae970f3..e0438e948 100644 --- a/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch +++ b/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch @@ -4,7 +4,7 @@ import net.minecraft.util.registry.Registry; -+//@net.minecraftforge.registries.ObjectHolder("minecraft") ++@net.minecraftforge.registries.ObjectHolder("minecraft") public class ParticleTypes { public static final BasicParticleType field_197608_a = func_218415_a("ambient_entity_effect", false); public static final BasicParticleType field_197609_b = func_218415_a("angry_villager", false); diff --git a/patches/minecraft/net/minecraft/pathfinding/FlyingNodeProcessor.java.patch b/patches/minecraft/net/minecraft/pathfinding/FlyingNodeProcessor.java.patch deleted file mode 100644 index afa20676b..000000000 --- a/patches/minecraft/net/minecraft/pathfinding/FlyingNodeProcessor.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/pathfinding/FlyingNodeProcessor.java -+++ b/net/minecraft/pathfinding/FlyingNodeProcessor.java -@@ -207,7 +207,9 @@ - EnumSet enumset = EnumSet.noneOf(PathNodeType.class); - PathNodeType pathnodetype = PathNodeType.BLOCKED; - BlockPos blockpos = new BlockPos(p_186319_5_); -+ this.currentEntity = p_186319_5_; - pathnodetype = this.func_193577_a(p_186319_1_, p_186319_2_, p_186319_3_, p_186319_4_, p_186319_6_, p_186319_7_, p_186319_8_, p_186319_9_, p_186319_10_, enumset, pathnodetype, blockpos); -+ this.currentEntity = null; - if (enumset.contains(PathNodeType.FENCE)) { - return PathNodeType.FENCE; - } else { -@@ -239,6 +241,8 @@ - if (pathnodetype1 != PathNodeType.DAMAGE_FIRE && block != Blocks.field_196814_hQ && pathnodetype1 != PathNodeType.LAVA && block != Blocks.field_222433_lV) { - if (pathnodetype1 == PathNodeType.DAMAGE_CACTUS) { - pathnodetype = PathNodeType.DAMAGE_CACTUS; -+ } else if (pathnodetype1 == PathNodeType.DAMAGE_OTHER) { // Forge: consider modded damage types -+ pathnodetype = PathNodeType.DAMAGE_OTHER; - } else if (pathnodetype1 == PathNodeType.DAMAGE_OTHER) { - pathnodetype = PathNodeType.DAMAGE_OTHER; - } else { diff --git a/patches/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch b/patches/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch index d2d49626e..f835e5179 100644 --- a/patches/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/pathfinding/PathNavigator.java +++ b/net/minecraft/pathfinding/PathNavigator.java -@@ -195,7 +195,8 @@ +@@ -204,7 +204,8 @@ Vec3d vec3d = this.func_75502_i(); this.field_188561_o = this.field_75515_a.func_213311_cf() > 0.75F ? this.field_75515_a.func_213311_cf() / 2.0F : 0.75F - this.field_75515_a.func_213311_cf() / 2.0F; Vec3d vec3d1 = this.field_75514_c.func_186310_f(); -- if (Math.abs(this.field_75515_a.field_70165_t - (vec3d1.field_72450_a + 0.5D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.field_70161_v - (vec3d1.field_72449_c + 0.5D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.field_70163_u - vec3d1.field_72448_b) < 1.0D) { +- if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d1.field_72450_a + 0.5D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d1.field_72449_c + 0.5D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d1.field_72448_b) < 1.0D) { + // Forge: fix MC-94054 -+ if (Math.abs(this.field_75515_a.field_70165_t - (vec3d1.field_72450_a + (this.field_75515_a.func_213311_cf() + 1) / 2D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.field_70161_v - (vec3d1.field_72449_c + (this.field_75515_a.func_213311_cf() + 1) / 2D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.field_70163_u - vec3d1.field_72448_b) < 1.0D) { ++ if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d1.field_72450_a + ((this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d1.field_72449_c + ((this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d1.field_72448_b) < 1.0D) { this.field_75514_c.func_75872_c(this.field_75514_c.func_75873_e() + 1); } diff --git a/patches/minecraft/net/minecraft/pathfinding/SwimmerPathNavigator.java.patch b/patches/minecraft/net/minecraft/pathfinding/SwimmerPathNavigator.java.patch index 641e2a9e2..a5cbe885b 100644 --- a/patches/minecraft/net/minecraft/pathfinding/SwimmerPathNavigator.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/SwimmerPathNavigator.java.patch @@ -4,9 +4,9 @@ int i = 6; Vec3d vec3d2 = this.field_75514_c.func_186310_f(); -- if (Math.abs(this.field_75515_a.field_70165_t - (vec3d2.field_72450_a + 0.5D)) < (double)f1 && Math.abs(this.field_75515_a.field_70161_v - (vec3d2.field_72449_c + 0.5D)) < (double)f1 && Math.abs(this.field_75515_a.field_70163_u - vec3d2.field_72448_b) < (double)(f1 * 2.0F)) { +- 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.field_70165_t - (vec3d2.field_72450_a + (this.field_75515_a.func_213311_cf() + 1) / 2D)) < (double)f1 && Math.abs(this.field_75515_a.field_70161_v - (vec3d2.field_72449_c + (this.field_75515_a.func_213311_cf() + 1) / 2D)) < (double)f1 && Math.abs(this.field_75515_a.field_70163_u - vec3d2.field_72448_b) < (double)(f1 * 2.0F)) { ++ if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d2.field_72450_a + ((this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)f1 && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d2.field_72449_c + ((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 731e58e85..41d0757a8 100644 --- a/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch @@ -1,60 +1,35 @@ --- a/net/minecraft/pathfinding/WalkNodeProcessor.java +++ b/net/minecraft/pathfinding/WalkNodeProcessor.java -@@ -27,6 +27,7 @@ - - public class WalkNodeProcessor extends NodeProcessor { - protected float field_176183_h; -+ protected MobEntity currentEntity; - - public void func_186315_a(IWorldReader p_186315_1_, MobEntity p_186315_2_) { - super.func_186315_a(p_186315_1_, p_186315_2_); -@@ -269,7 +270,9 @@ - PathNodeType pathnodetype = PathNodeType.BLOCKED; - double d0 = (double)p_186319_5_.func_213311_cf() / 2.0D; - BlockPos blockpos = new BlockPos(p_186319_5_); -+ this.currentEntity = p_186319_5_; - pathnodetype = this.func_193577_a(p_186319_1_, p_186319_2_, p_186319_3_, p_186319_4_, p_186319_6_, p_186319_7_, p_186319_8_, p_186319_9_, p_186319_10_, enumset, pathnodetype, blockpos); -+ this.currentEntity = p_186319_5_; - if (enumset.contains(PathNodeType.FENCE)) { - return PathNodeType.FENCE; - } else { -@@ -359,6 +362,7 @@ - if (pathnodetype1 == PathNodeType.DAMAGE_OTHER) { - pathnodetype = PathNodeType.DAMAGE_OTHER; - } -+ if (pathnodetype1 == PathNodeType.DAMAGE_OTHER) pathnodetype = PathNodeType.DAMAGE_OTHER; // Forge: consider modded damage types - } - - pathnodetype = this.func_193578_a(p_186330_1_, p_186330_2_, p_186330_3_, p_186330_4_, pathnodetype); -@@ -371,12 +375,14 @@ - for(int i = -1; i <= 1; ++i) { - for(int j = -1; j <= 1; ++j) { - if (i != 0 || j != 0) { -- Block block = p_193578_1_.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(i + p_193578_2_, p_193578_3_, j + p_193578_4_)).func_177230_c(); +@@ -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) { -+ BlockState state = p_193578_1_.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(i + p_193578_2_, p_193578_3_, j + p_193578_4_)); -+ Block block = state.func_177230_c(); -+ PathNodeType type = block.getAiPathNodeType(state, p_193578_1_, blockpos$pooledmutableblockpos, this.currentEntity); -+ if (block == Blocks.field_150434_aF || type == PathNodeType.DAMAGE_CACTUS) { - p_193578_5_ = PathNodeType.DANGER_CACTUS; -- } else if (block == Blocks.field_150480_ab) { -+ } else if (block == Blocks.field_150480_ab || type == PathNodeType.DAMAGE_FIRE) { - p_193578_5_ = PathNodeType.DANGER_FIRE; -- } else if (block == Blocks.field_222434_lW) { -+ } else if (block == Blocks.field_222434_lW || type == PathNodeType.DAMAGE_OTHER) { - p_193578_5_ = PathNodeType.DANGER_OTHER; - } +- 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_, p_193578_2_, p_193578_3_); ++ if (type == PathNodeType.DANGER_CACTUS || type == PathNodeType.DANGER_FIRE || type == PathNodeType.DANGER_OTHER) ++ p_193578_4_ = type; } -@@ -391,9 +397,11 @@ - protected PathNodeType func_189553_b(IBlockReader p_189553_1_, int p_189553_2_, int p_189553_3_, int p_189553_4_) { - BlockPos blockpos = new BlockPos(p_189553_2_, p_189553_3_, p_189553_4_); - BlockState blockstate = p_189553_1_.func_180495_p(blockpos); -+ PathNodeType type = blockstate.getAiPathNodeType(p_189553_1_, blockpos, this.currentEntity); + } + } +@@ -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_1_, blockpos)) { ++ 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/minecraft/net/minecraft/resources/VanillaPack.java.patch b/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch index d955a3a67..91b1519a3 100644 --- a/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch +++ b/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/VanillaPack.java +++ b/net/minecraft/resources/VanillaPack.java -@@ -183,7 +183,7 @@ +@@ -176,7 +176,7 @@ try { URL url = VanillaPack.class.getResource(s); @@ -9,7 +9,7 @@ } catch (IOException var6) { return VanillaPack.class.getResourceAsStream(s); } -@@ -199,7 +199,7 @@ +@@ -192,7 +192,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_) { -@@ -239,4 +239,18 @@ +@@ -232,4 +232,18 @@ public void close() { } diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index d67492126..2be345ab0 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -191,7 +191,7 @@ +@@ -196,7 +196,7 @@ private final GameProfileRepository field_152365_W; private final PlayerProfileCache field_152366_X; private long field_147142_T; @@ -9,7 +9,7 @@ p_213187_0_.setUncaughtExceptionHandler((p_213206_0_, p_213206_1_) -> { field_147145_h.error(p_213206_1_); }); -@@ -327,6 +327,8 @@ +@@ -336,6 +336,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); @@ -18,7 +18,7 @@ WorldInfo worldinfo = savehandler.func_75757_d(); WorldSettings worldsettings; if (worldinfo == null) { -@@ -347,13 +349,13 @@ +@@ -356,13 +358,13 @@ } this.func_195560_a(savehandler.func_75765_b(), worldinfo); @@ -33,7 +33,7 @@ if (this.func_71242_L()) { p_213194_2_.func_176127_a(field_213219_c); } -@@ -395,6 +397,7 @@ +@@ -406,6 +408,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_)); } @@ -41,7 +41,7 @@ } } -@@ -552,6 +555,7 @@ +@@ -564,6 +567,7 @@ for(ServerWorld serverworld1 : this.func_212370_w()) { if (serverworld1 != null) { try { @@ -49,7 +49,7 @@ serverworld1.close(); } catch (IOException ioexception) { field_147145_h.error("Exception closing the level", (Throwable)ioexception); -@@ -592,6 +596,7 @@ +@@ -604,6 +608,7 @@ public void run() { try { if (this.func_71197_b()) { @@ -57,7 +57,7 @@ this.field_211151_aa = Util.func_211177_b(); this.field_147147_p.func_151315_a(new StringTextComponent(this.field_71286_C)); this.field_147147_p.func_151321_a(new ServerStatusResponse.Version(SharedConstants.func_215069_a().getName(), SharedConstants.func_215069_a().getProtocolVersion())); -@@ -623,9 +628,15 @@ +@@ -635,9 +640,15 @@ this.field_71304_b.func_219897_b(); this.field_71296_Q = true; } @@ -73,7 +73,7 @@ } catch (Throwable throwable1) { field_147145_h.error("Encountered an unexpected exception", throwable1); CrashReport crashreport; -@@ -642,6 +653,7 @@ +@@ -654,6 +665,7 @@ field_147145_h.error("We were unable to save this crash report to disk."); } @@ -81,7 +81,7 @@ this.func_71228_a(crashreport); } finally { try { -@@ -650,6 +662,7 @@ +@@ -662,6 +674,7 @@ } catch (Throwable throwable) { field_147145_h.error("Exception stopping the server", throwable); } finally { @@ -89,7 +89,7 @@ this.func_71240_o(); } -@@ -746,6 +759,7 @@ +@@ -758,6 +771,7 @@ protected void func_71217_p(BooleanSupplier p_71217_1_) { long i = Util.func_211178_c(); @@ -97,7 +97,7 @@ ++this.field_71315_w; this.func_71190_q(p_71217_1_); if (i - this.field_147142_T >= 5000000000L) { -@@ -760,6 +774,7 @@ +@@ -772,6 +786,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.field_147147_p.func_151318_b().func_151330_a(agameprofile); @@ -105,7 +105,7 @@ } if (this.field_71315_w % 6000 == 0) { -@@ -787,6 +802,7 @@ +@@ -799,6 +814,7 @@ long i1 = Util.func_211178_c(); this.field_213215_ap.func_181747_a(i1 - i); this.field_71304_b.func_76319_b(); @@ -113,7 +113,7 @@ } protected void func_71190_q(BooleanSupplier p_71190_1_) { -@@ -794,7 +810,8 @@ +@@ -806,7 +822,8 @@ this.func_193030_aL().func_73660_a(); this.field_71304_b.func_219895_b("levels"); @@ -123,7 +123,7 @@ 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()); -@@ -806,6 +823,7 @@ +@@ -818,6 +835,7 @@ } this.field_71304_b.func_76320_a("tick"); @@ -131,7 +131,7 @@ try { serverworld.func_72835_b(p_71190_1_); -@@ -814,12 +832,16 @@ +@@ -826,12 +844,16 @@ serverworld.func_72914_a(crashreport); throw new ReportedException(crashreport); } @@ -148,7 +148,7 @@ this.field_71304_b.func_219895_b("connection"); this.func_147137_ag().func_151269_c(); this.field_71304_b.func_219895_b("players"); -@@ -856,6 +878,7 @@ +@@ -872,6 +894,7 @@ OptionSpec optionspec10 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1); OptionSpec optionspec11 = optionparser.accepts("serverId").withRequiredArg(); OptionSpec optionspec12 = optionparser.nonOptions(); @@ -156,7 +156,7 @@ try { OptionSet optionset = optionparser.parse(p_main_0_); -@@ -887,6 +910,10 @@ +@@ -903,6 +926,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); @@ -167,7 +167,7 @@ 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)); -@@ -904,6 +931,7 @@ +@@ -920,6 +947,7 @@ Thread thread = new Thread("Server Shutdown Thread") { public void run() { dedicatedserver.func_71263_m(true); @@ -175,7 +175,7 @@ } }; thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(field_147145_h)); -@@ -948,7 +976,7 @@ +@@ -964,7 +992,7 @@ } public ServerWorld func_71218_a(DimensionType p_71218_1_) { @@ -184,7 +184,7 @@ } public Iterable func_212370_w() { -@@ -987,7 +1015,7 @@ +@@ -1003,7 +1031,7 @@ } public String getServerModName() { @@ -193,7 +193,7 @@ } public CrashReport func_71230_b(CrashReport p_71230_1_) { -@@ -1529,6 +1557,31 @@ +@@ -1558,6 +1586,31 @@ public abstract boolean func_213199_b(GameProfile p_213199_1_); diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch index e62556ef6..2aea7ead8 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 -@@ -76,7 +76,7 @@ +@@ -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); @@ -8,8 +8,8 @@ + if (blockstate.isAir(field_73092_a, field_180241_i)) { this.field_73097_j = false; } else { - float f = this.func_225417_a(blockstate, this.field_180241_i); -@@ -87,7 +87,7 @@ + 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); @@ -18,24 +18,24 @@ 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; -@@ -115,7 +115,15 @@ - double d1 = this.field_73090_b.field_70163_u - ((double)p_225416_1_.func_177956_o() + 0.5D) + 1.5D; - double d2 = this.field_73090_b.field_70161_v - ((double)p_225416_1_.func_177952_p() + 0.5D); +@@ -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)); ++ 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)); + 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)); -@@ -145,12 +153,13 @@ + 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_); @@ -48,10 +48,10 @@ - if (!blockstate.func_196958_f() && f >= 1.0F) { + if (!blockstate.isAir(field_73092_a, p_225416_1_) && f >= 1.0F) { - this.func_225415_a(p_225416_1_, p_225416_2_); + this.func_229860_a_(p_225416_1_, p_225416_2_, "insta mine"); } else { - this.field_73088_d = true; -@@ -203,7 +212,8 @@ + 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_); @@ -61,7 +61,7 @@ return false; } else { TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_); -@@ -211,25 +221,30 @@ +@@ -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; @@ -81,25 +81,25 @@ 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); -+ ItemStack copy = itemstack.func_77946_l(); ++ + 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() && !copy.func_190926_b()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, copy, Hand.MAIN_HAND); -+ } ++ 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) { - ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l(); 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); -+ } ++ if (flag && exp > 0) ++ blockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); ++ return true; } -@@ -237,12 +252,22 @@ + } } } @@ -122,7 +122,7 @@ 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_); -@@ -285,12 +310,19 @@ +@@ -296,9 +321,16 @@ return ActionResultType.PASS; } } else { @@ -134,14 +134,19 @@ + 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_70093_af() && flag; -- if (!flag1 && blockstate.func_215687_a(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_)) { -+ boolean flag1 = !(p_219441_1_.func_70093_af() && 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 && blockstate.func_215687_a(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_)) { - return ActionResultType.SUCCESS; - } else if (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b())) { +- 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 actionresulttype = p_219441_3_.func_196084_a(itemusecontext); + 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 68aefc59a..3a62040f9 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch @@ -29,19 +29,19 @@ 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_); - serverplaynethandler.func_147359_a(new SJoinGamePacket(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), serverworld.field_73011_w.func_186058_p(), this.func_72352_l(), worldinfo.func_76067_t(), this.field_72402_d, serverworld.func_82736_K().func_223586_b(GameRules.field_223612_o))); - serverplaynethandler.func_147359_a(new SCustomPayloadPlayPacket(SCustomPayloadPlayPacket.field_209911_b, (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName()))); - serverplaynethandler.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z())); -@@ -142,7 +153,7 @@ + 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_.field_70165_t, p_72355_2_.field_70163_u, p_72355_2_.field_70161_v, p_72355_2_.field_70177_z, p_72355_2_.field_70125_A); + 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_)); -@@ -163,8 +174,9 @@ +@@ -166,8 +177,9 @@ if (compoundnbt != null && compoundnbt.func_150297_b("RootVehicle", 10)) { CompoundNBT compoundnbt1 = compoundnbt.func_74775_l("RootVehicle"); @@ -52,7 +52,7 @@ }); if (entity1 != null) { UUID uuid = compoundnbt1.func_186857_a("Attach"); -@@ -191,6 +203,7 @@ +@@ -194,6 +206,7 @@ } p_72355_2_.func_71116_b(); @@ -60,7 +60,7 @@ } protected void func_96456_a(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) { -@@ -252,6 +265,7 @@ +@@ -255,6 +268,7 @@ compoundnbt1 = compoundnbt; p_72380_1_.func_70020_e(compoundnbt); field_148546_d.debug("loading single player"); @@ -68,7 +68,7 @@ } else { compoundnbt1 = this.field_72412_k.func_75752_b(p_72380_1_); } -@@ -260,6 +274,7 @@ +@@ -263,6 +277,7 @@ } protected void func_72391_b(ServerPlayerEntity p_72391_1_) { @@ -76,7 +76,7 @@ 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) { -@@ -274,6 +289,7 @@ +@@ -277,6 +292,7 @@ } public void func_72367_e(ServerPlayerEntity p_72367_1_) { @@ -84,7 +84,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_); -@@ -295,7 +311,7 @@ +@@ -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(); @@ -93,7 +93,7 @@ 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); -@@ -364,10 +380,18 @@ +@@ -367,10 +383,18 @@ } public ServerPlayerEntity func_72368_a(ServerPlayerEntity p_72368_1_, DimensionType p_72368_2_, boolean p_72368_3_) { @@ -116,7 +116,7 @@ p_72368_1_.field_71093_bK = p_72368_2_; PlayerInteractionManager playerinteractionmanager; if (this.field_72400_f.func_71242_L()) { -@@ -379,6 +403,8 @@ +@@ -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_); @@ -125,24 +125,24 @@ serverplayerentity.func_145769_d(p_72368_1_.func_145782_y()); serverplayerentity.func_184819_a(p_72368_1_.func_184591_cq()); -@@ -393,7 +419,7 @@ +@@ -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_180473_a(blockpos, flag); -+ serverplayerentity.setSpawnPoint(blockpos, flag, p_72368_2_); +- 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)); } -@@ -404,6 +430,7 @@ +@@ -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_76067_t(), serverplayerentity.field_71134_c.func_73081_b())); + 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.field_70165_t, serverplayerentity.field_70163_u, serverplayerentity.field_70161_v, serverplayerentity.field_70177_z, serverplayerentity.field_70125_A); -@@ -413,10 +440,11 @@ + 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); @@ -155,7 +155,7 @@ return serverplayerentity; } -@@ -736,7 +764,7 @@ +@@ -739,7 +767,7 @@ } public List func_181057_v() { @@ -164,7 +164,7 @@ } @Nullable -@@ -766,4 +794,12 @@ +@@ -769,4 +797,12 @@ public boolean func_206257_x() { return this.field_72407_n; } diff --git a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch index 67ca59e78..c8762c1a6 100644 --- a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/BlockTags.java +++ b/net/minecraft/tags/BlockTags.java -@@ -70,6 +70,10 @@ +@@ -76,6 +76,10 @@ return field_199899_c; } diff --git a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch b/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch index 64fe2de17..31102526c 100644 --- a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/EntityTypeTags.java +++ b/net/minecraft/tags/EntityTypeTags.java -@@ -22,6 +22,10 @@ +@@ -24,6 +24,10 @@ return field_219766_c; } diff --git a/patches/minecraft/net/minecraft/tags/FluidTags.java.patch b/patches/minecraft/net/minecraft/tags/FluidTags.java.patch index 29a710c6c..d2cca2bdc 100644 --- a/patches/minecraft/net/minecraft/tags/FluidTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/FluidTags.java.patch @@ -1,13 +1,9 @@ --- a/net/minecraft/tags/FluidTags.java +++ b/net/minecraft/tags/FluidTags.java -@@ -18,6 +18,14 @@ - ++field_206962_d; +@@ -22,6 +22,10 @@ + return field_206961_c; } -+ public static TagCollection getCollection() { -+ return field_206961_c; -+ } -+ + public static int getGeneration() { + return field_206962_d; + } diff --git a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch index 2ce2f918c..2764b38c2 100644 --- a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/ItemTags.java +++ b/net/minecraft/tags/ItemTags.java -@@ -59,6 +59,10 @@ +@@ -62,6 +62,10 @@ return field_199906_c; } diff --git a/patches/minecraft/net/minecraft/tags/Tag.java.patch b/patches/minecraft/net/minecraft/tags/Tag.java.patch index 022aa8faf..8c9026aa4 100644 --- a/patches/minecraft/net/minecraft/tags/Tag.java.patch +++ b/patches/minecraft/net/minecraft/tags/Tag.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/Tag.java +++ b/net/minecraft/tags/Tag.java -@@ -21,6 +21,7 @@ +@@ -22,6 +22,7 @@ private final ResourceLocation field_199888_a; private final Set field_199889_b; private final Collection> field_200150_c; @@ -8,7 +8,7 @@ public Tag(ResourceLocation p_i48236_1_) { this.field_199888_a = p_i48236_1_; -@@ -29,6 +30,9 @@ +@@ -30,6 +31,9 @@ } public Tag(ResourceLocation p_i48224_1_, Collection> p_i48224_2_, boolean p_i48224_3_) { @@ -18,7 +18,7 @@ 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_; -@@ -47,7 +51,7 @@ +@@ -48,7 +52,7 @@ itagentry.func_200576_a(jsonarray, p_200571_1_); } @@ -27,7 +27,7 @@ jsonobject.add("values", jsonarray); return jsonobject; } -@@ -76,6 +80,7 @@ +@@ -77,6 +81,7 @@ public static class Builder { private final Set> field_200052_a = Sets.newLinkedHashSet(); private boolean field_200053_b; @@ -35,7 +35,7 @@ public static Tag.Builder func_200047_a() { return new Tag.Builder<>(); -@@ -102,6 +107,22 @@ +@@ -103,6 +108,22 @@ return this; } @@ -58,7 +58,7 @@ public Tag.Builder func_200045_a(boolean p_200045_1_) { this.field_200053_b = p_200045_1_; return this; -@@ -118,7 +139,7 @@ +@@ -119,7 +140,7 @@ } public Tag func_200051_a(ResourceLocation p_200051_1_) { @@ -67,7 +67,7 @@ } public Tag.Builder func_219783_a(Function> p_219783_1_, JsonObject p_219783_2_) { -@@ -142,8 +163,10 @@ +@@ -143,8 +164,10 @@ } this.field_200052_a.addAll(list); @@ -78,7 +78,7 @@ } public interface ITagEntry { -@@ -182,6 +205,8 @@ +@@ -183,6 +206,8 @@ public Collection func_200578_a() { return this.field_200165_a; } @@ -87,7 +87,7 @@ } public static class TagEntry implements Tag.ITagEntry { -@@ -228,5 +253,7 @@ +@@ -229,5 +254,7 @@ public void func_200576_a(JsonArray p_200576_1_, Function p_200576_2_) { p_200576_1_.add("#" + this.func_200577_a()); } diff --git a/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch b/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch index a4b6ecef6..a2e4469c2 100644 --- a/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tileentity/BannerPattern.java +++ b/net/minecraft/tileentity/BannerPattern.java -@@ -13,7 +13,7 @@ +@@ -14,7 +14,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.apache.commons.lang3.tuple.Pair; @@ -9,7 +9,7 @@ BASE("base", "b"), SQUARE_BOTTOM_LEFT("square_bottom_left", "bl", " ", " ", "# "), SQUARE_BOTTOM_RIGHT("square_bottom_right", "br", " ", " ", " #"), -@@ -100,6 +100,14 @@ +@@ -107,6 +107,14 @@ return null; } diff --git a/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch index a74e0756c..aeb6a29f3 100644 --- a/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch @@ -8,7 +8,7 @@ protected ChestTileEntity(TileEntityType p_i48287_1_) { super(p_i48287_1_); -@@ -212,7 +213,7 @@ +@@ -202,7 +203,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_); @@ -17,7 +17,7 @@ TileEntity tileentity = p_195481_0_.func_175625_s(p_195481_1_); if (tileentity instanceof ChestTileEntity) { return ((ChestTileEntity)tileentity).field_145987_o; -@@ -231,4 +232,57 @@ +@@ -221,4 +222,56 @@ protected Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_) { return ChestContainer.func_216992_a(p_213906_1_, p_213906_2_, this); } @@ -34,9 +34,8 @@ + @Override + public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability cap, Direction side) { + if (!this.field_145846_f && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { -+ if (this.chestHandler == null) { ++ if (this.chestHandler == null) + this.chestHandler = net.minecraftforge.common.util.LazyOptional.of(this::createHandler); -+ } + return this.chestHandler.cast(); + } + return super.getCapability(cap, side); diff --git a/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch index 23ab27459..2f91940c2 100644 --- a/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tileentity/HopperTileEntity.java +++ b/net/minecraft/tileentity/HopperTileEntity.java -@@ -147,6 +147,7 @@ +@@ -133,6 +133,7 @@ } private boolean func_145883_k() { @@ -8,7 +8,7 @@ IInventory iinventory = this.func_145895_l(); if (iinventory == null) { return false; -@@ -191,6 +192,8 @@ +@@ -177,6 +178,8 @@ } public static boolean func_145891_a(IHopper p_145891_0_) { @@ -17,7 +17,7 @@ IInventory iinventory = func_145884_b(p_145891_0_); if (iinventory != null) { Direction direction = Direction.DOWN; -@@ -339,7 +342,7 @@ +@@ -325,7 +328,7 @@ Block block = blockstate.func_177230_c(); if (block instanceof ISidedInventoryProvider) { iinventory = ((ISidedInventoryProvider)block).func_219966_a(blockstate, p_145893_0_, blockpos); @@ -26,7 +26,7 @@ TileEntity tileentity = p_145893_0_.func_175625_s(blockpos); if (tileentity instanceof IInventory) { iinventory = (IInventory)tileentity; -@@ -418,4 +421,13 @@ +@@ -404,4 +407,13 @@ protected Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_) { return new HopperContainer(p_213906_1_, p_213906_2_, this); } diff --git a/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch index 6bb5812d4..f73a95fca 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,23 @@ +@@ -80,4 +80,22 @@ } protected abstract Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_); @@ -12,9 +12,8 @@ + + @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 ) { ++ if (!this.field_145846_f && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ) + return itemHandler.cast(); -+ } + return super.getCapability(cap, side); + } + diff --git a/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch index b47c2e500..3d6a3748b 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 -@@ -106,7 +106,7 @@ +@@ -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, this.func_190610_a(axisalignedbb, direction, d0).func_111270_a(axisalignedbb)); + 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.func_177230_c().isStickyBlock(this.field_200231_a); ++ boolean flag = this.field_200231_a.isSlimeBlock(); //TODO: Merge with isStickyBlock? Look into further how vanilla splits slime vs honey - for(int i = 0; i < list1.size(); ++i) { - Entity entity = list1.get(i); + for(Entity entity : list1) { + 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 76d9fcb71..201050a88 100644 --- a/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tileentity/ShulkerBoxTileEntity.java +++ b/net/minecraft/tileentity/ShulkerBoxTileEntity.java -@@ -288,6 +288,11 @@ +@@ -280,6 +280,11 @@ return new ShulkerBoxContainer(p_213906_1_, p_213906_2_, this); } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 19add8f08..d8048f17b 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -22,7 +22,7 @@ } @Nullable -@@ -46,6 +49,8 @@ +@@ -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")); @@ -31,7 +31,7 @@ } public CompoundNBT func_189515_b(CompoundNBT p_189515_1_) { -@@ -61,6 +66,8 @@ +@@ -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()); @@ -40,7 +40,7 @@ return p_189516_1_; } } -@@ -93,7 +100,7 @@ +@@ -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); @@ -49,7 +49,7 @@ this.field_145850_b.func_175666_e(this.field_174879_c, this.field_195045_e.func_177230_c()); } } -@@ -139,6 +146,8 @@ +@@ -140,6 +147,8 @@ public void func_145843_s() { this.field_145846_f = true; @@ -58,7 +58,7 @@ } public void func_145829_t() { -@@ -181,6 +190,13 @@ +@@ -182,6 +191,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 d0dac6399..5083d1d95 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 -@@ -16,7 +16,7 @@ +@@ -18,7 +18,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,12 +9,3 @@ 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)); -@@ -64,7 +64,7 @@ - - try { - type = DataFixesManager.func_210901_a().getSchema(DataFixUtils.makeKey(SharedConstants.func_215069_a().getWorldVersion())).getChoiceType(TypeReferences.field_211294_j, p_200966_0_); -- } catch (IllegalStateException illegalstateexception) { -+ } catch (IllegalArgumentException illegalstateexception) { - if (SharedConstants.field_206244_b) { - throw illegalstateexception; - } diff --git a/patches/minecraft/net/minecraft/util/ActionResult.java.patch b/patches/minecraft/net/minecraft/util/ActionResult.java.patch deleted file mode 100644 index b00b66422..000000000 --- a/patches/minecraft/net/minecraft/util/ActionResult.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/util/ActionResult.java -+++ b/net/minecraft/util/ActionResult.java -@@ -16,4 +16,9 @@ - public T func_188398_b() { - return this.field_188400_b; - } -+ -+ //Just a generic helper function to make typecasing easier... -+ public static ActionResult newResult(ActionResultType result, T value) { -+ return new ActionResult(result, value); -+ } - } diff --git a/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch b/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch index 2c3cb9a0a..2f06251ec 100644 --- a/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch +++ b/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch @@ -1,40 +1,31 @@ --- a/net/minecraft/util/ScreenShotHelper.java +++ b/net/minecraft/util/ScreenShotHelper.java -@@ -34,19 +34,34 @@ - NativeImage nativeimage = func_198052_a(p_148259_2_, p_148259_3_, p_148259_4_); - File file1 = new File(p_148259_0_, "screenshots"); - file1.mkdir(); -- File file2; -+ File target; - if (p_148259_1_ == null) { -- file2 = func_74290_a(file1); -+ target = func_74290_a(file1); - } else { -- file2 = new File(file1, p_148259_1_); -+ target = new File(file1, p_148259_1_); +@@ -51,12 +51,25 @@ + file2 = new File(file1, p_228051_1_); } -+ try { -+ target = target.getCanonicalFile(); // FORGE: Fix errors on Windows with paths that include \.\ -+ } catch (java.io.IOException e) {} -+ net.minecraftforge.client.event.ScreenshotEvent event = net.minecraftforge.client.ForgeHooksClient.onScreenshot(nativeimage, target); ++ ++ net.minecraftforge.client.event.ScreenshotEvent event = net.minecraftforge.client.ForgeHooksClient.onScreenshot(nativeimage, file2); + if (event.isCanceled()) { -+ p_148259_5_.accept(event.getCancelMessage()); ++ p_228051_5_.accept(event.getCancelMessage()); + return; -+ } else { -+ target = event.getScreenshotFile(); + } + -+ final File file2 = target; ++ final File target = event.getScreenshotFile(); ++ SimpleResource.field_199031_a.execute(() -> { try { - nativeimage.func_209271_a(file2); - ITextComponent itextcomponent = (new StringTextComponent(file2.getName())).func_211708_a(TextFormatting.UNDERLINE).func_211710_a((p_212451_1_) -> { - p_212451_1_.func_150241_a(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath())); +- nativeimage.func_209271_a(file2); +- ITextComponent itextcomponent = (new StringTextComponent(file2.getName())).func_211708_a(TextFormatting.UNDERLINE).func_211710_a((p_228050_1_) -> { +- p_228050_1_.func_150241_a(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath())); ++ nativeimage.func_209271_a(target); ++ ITextComponent itextcomponent = (new StringTextComponent(target.getName())).func_211708_a(TextFormatting.UNDERLINE).func_211710_a((p_228050_1_) -> { ++ p_228050_1_.func_150241_a(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath())); }); -+ if (event.getResultMessage() != null) { -+ p_148259_5_.accept(event.getResultMessage()); -+ } else - p_148259_5_.accept(new TranslationTextComponent("screenshot.success", itextcomponent)); ++ ++ if (event.getResultMessage() != null) ++ p_228051_5_.accept(event.getResultMessage()); ++ else + p_228051_5_.accept(new TranslationTextComponent("screenshot.success", itextcomponent)); } catch (Exception exception) { field_148261_a.warn("Couldn't save screenshot", (Throwable)exception); 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 6984ae786..6e95eb98c 100644 --- a/patches/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch +++ b/patches/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch @@ -9,15 +9,15 @@ + + protected EntitySelectionContext(@javax.annotation.Nullable Entity entityIn, boolean p_i51181_1_, double p_i51181_2_, Item p_i51181_4_) { + this.entity = entityIn; - this.field_216380_b = p_i51181_1_; + 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_70093_af(), p_i51182_1_.func_174813_aQ().field_72338_b, 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_70093_af(), p_i51182_1_.func_174813_aQ().field_72338_b, p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).func_184614_ca().func_77973_b() : Items.field_190931_a); +- 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_) { diff --git a/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch b/patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch similarity index 67% rename from patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch rename to patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch index 45936c7bb..5c5ec295b 100644 --- a/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch +++ b/patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch @@ -1,21 +1,25 @@ ---- a/net/minecraft/world/chunk/BlockStateContainer.java -+++ b/net/minecraft/world/chunk/BlockStateContainer.java -@@ -65,6 +65,9 @@ +--- 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 p_186012_1_, boolean forceBits) { - if (p_186012_1_ != this.field_186024_e) { - this.field_186024_e = p_186012_1_; ++ 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 = p_186012_1_; ++ this.field_186024_e = bitsIn; } this.field_186022_c.func_186041_a(this.field_205526_g); diff --git a/patches/minecraft/net/minecraft/util/registry/Registry.java.patch b/patches/minecraft/net/minecraft/util/registry/Registry.java.patch index a11d1cd3e..1b3b0c16b 100644 --- a/patches/minecraft/net/minecraft/util/registry/Registry.java.patch +++ b/patches/minecraft/net/minecraft/util/registry/Registry.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/util/registry/Registry.java +++ b/net/minecraft/util/registry/Registry.java -@@ -66,76 +66,78 @@ +@@ -70,47 +70,51 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +/* + * Attention Modders: This SHOULD NOT be used, you should use ForgeRegistries instead. As it has a cleaner modder facing API. -+ * We will be wrapping all of these in our API as nessasary for syncing and management. ++ * 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(); @@ -64,6 +64,11 @@ + @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", () -> { +@@ -125,33 +129,31 @@ + public static final Registry> field_229390_w_ = func_222935_a("tree_decorator_type", () -> { + 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; @@ -102,7 +107,7 @@ public static final Registry field_218362_C = func_222935_a("structure_piece", () -> { return IStructurePieceType.field_214782_c; }); -@@ -148,37 +150,37 @@ +@@ -164,37 +166,37 @@ public static final Registry field_218365_F = func_222935_a("structure_pool_element", () -> { return IJigsawDeserializer.field_214931_e; }); @@ -149,7 +154,7 @@ return Activity.field_221366_b; }); -@@ -230,6 +232,14 @@ +@@ -246,6 +248,14 @@ return ((MutableRegistry)p_218343_0_).func_218382_a(p_218343_1_, new ResourceLocation(p_218343_2_), p_218343_3_); } @@ -162,5 +167,5 @@ + } + static { - field_218376_a.entrySet().forEach((p_218326_0_) -> { - if (p_218326_0_.getValue().get() == null) { + field_218376_a.entrySet().forEach((p_229397_0_) -> { + if (p_229397_0_.getValue().get() == null) { diff --git a/patches/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch b/patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch similarity index 60% rename from patches/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch rename to patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch index 4baa28593..5f9fad508 100644 --- a/patches/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch +++ b/patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch @@ -1,10 +1,9 @@ ---- a/net/minecraft/util/text/translation/LanguageMap.java -+++ b/net/minecraft/util/text/translation/LanguageMap.java -@@ -35,7 +35,7 @@ - String s = field_111053_a.matcher(JSONUtils.func_151206_a(entry.getValue(), entry.getKey())).replaceAll("%$1s"); +--- 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) { diff --git a/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch b/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch index 0d8ad18a1..38a1be77c 100644 --- a/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch +++ b/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/text/TranslationTextComponent.java +++ b/net/minecraft/util/text/TranslationTextComponent.java -@@ -104,6 +104,10 @@ +@@ -100,6 +100,10 @@ } } diff --git a/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch b/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch index 414a0b5ec..5a5b12d7b 100644 --- a/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch +++ b/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/village/PointOfInterestType.java +++ b/net/minecraft/village/PointOfInterestType.java -@@ -21,7 +21,7 @@ - import net.minecraft.util.SoundEvents; +@@ -19,7 +19,7 @@ + import net.minecraft.util.Util; import net.minecraft.util.registry.Registry; -public class PointOfInterestType { diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index b516db296..8c6e8b342 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/Explosion.java +++ b/net/minecraft/world/Explosion.java -@@ -48,6 +48,7 @@ +@@ -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(); @@ -8,7 +8,7 @@ @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_) { -@@ -70,6 +71,7 @@ +@@ -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); @@ -16,7 +16,7 @@ } public static float func_222259_a(Vec3d p_222259_0_, Entity p_222259_1_) { -@@ -129,8 +131,8 @@ +@@ -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); @@ -27,7 +27,7 @@ if (this.field_77283_e != null) { f2 = this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, blockstate, ifluidstate, f2); } -@@ -160,6 +162,7 @@ +@@ -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)); @@ -35,38 +35,32 @@ Vec3d vec3d = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); for(int k2 = 0; k2 < list.size(); ++k2) { -@@ -230,9 +233,9 @@ - this.field_77287_j.func_195594_a(ParticleTypes.field_197601_L, d0, d1, d2, d3, d4, d5); - } - +@@ -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.isAir(this.field_77287_j, blockpos)) { -+ if (this.field_77287_j instanceof ServerWorld && blockstate.canDropFromExplosion(this.field_77287_j, blockpos, this)) { ++ 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); + 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); -@@ -241,15 +244,14 @@ - Block.func_220078_b(blockstate, lootcontext$builder); +@@ -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(); } } - } - - if (this.field_77286_a) { - for(BlockPos blockpos1 : this.field_77281_g) { -- if (this.field_77287_j.func_180495_p(blockpos1).func_196958_f() && this.field_77287_j.func_180495_p(blockpos1.func_177977_b()).func_200015_d(this.field_77287_j, blockpos1.func_177977_b()) && this.field_77290_i.nextInt(3) == 0) { -+ if (this.field_77287_j.func_180495_p(blockpos1).isAir(field_77287_j, blockpos1) && this.field_77287_j.func_180495_p(blockpos1.func_177977_b()).func_200015_d(this.field_77287_j, blockpos1.func_177977_b()) && this.field_77290_i.nextInt(3) == 0) { - this.field_77287_j.func_175656_a(blockpos1, Blocks.field_150480_ab.func_176223_P()); - } - } -@@ -288,6 +290,10 @@ +@@ -311,6 +313,10 @@ return this.field_77281_g; } diff --git a/patches/minecraft/net/minecraft/world/IWorld.java.patch b/patches/minecraft/net/minecraft/world/IWorld.java.patch index dcd6808fe..bbf0a19ef 100644 --- a/patches/minecraft/net/minecraft/world/IWorld.java.patch +++ b/patches/minecraft/net/minecraft/world/IWorld.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/IWorld.java +++ b/net/minecraft/world/IWorld.java -@@ -25,16 +25,16 @@ +@@ -26,16 +26,16 @@ long func_72905_C(); default float func_130001_d() { diff --git a/patches/minecraft/net/minecraft/world/IWorldReader.java.patch b/patches/minecraft/net/minecraft/world/IWorldReader.java.patch index 20a64d6af..97515e7f6 100644 --- a/patches/minecraft/net/minecraft/world/IWorldReader.java.patch +++ b/patches/minecraft/net/minecraft/world/IWorldReader.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/IWorldReader.java +++ b/net/minecraft/world/IWorldReader.java -@@ -29,7 +29,7 @@ +@@ -57,7 +57,7 @@ + } - public interface IWorldReader extends IEnviromentBlockReader { default boolean func_175623_d(BlockPos p_175623_1_) { - return this.func_180495_p(p_175623_1_).func_196958_f(); + return this.func_180495_p(p_175623_1_).isAir(this, p_175623_1_); } default boolean func_175710_j(BlockPos p_175710_1_) { -@@ -233,6 +233,10 @@ +@@ -148,6 +148,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 8ab6a3d00..19359bd83 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 -@@ -78,9 +78,8 @@ +@@ -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(); @@ -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); -@@ -184,12 +183,14 @@ +@@ -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); diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index f8e56c031..e42c37bc4 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -4,8 +4,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; --public abstract class World implements IEnviromentBlockReader, IWorld, AutoCloseable { -+public abstract class World extends net.minecraftforge.common.capabilities.CapabilityProvider implements IEnviromentBlockReader, IWorld, AutoCloseable, net.minecraftforge.common.extensions.IForgeWorld { +-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(); @@ -13,13 +13,13 @@ protected final List field_147484_a = Lists.newArrayList(); - protected final List field_147483_b = Lists.newArrayList(); + protected final java.util.Set field_147483_b = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); // Forge: faster "contains" makes removal much more efficient - private final long field_73001_c = 16777215L; private final Thread field_217407_c; private int field_73008_k; -@@ -87,8 +87,12 @@ - public final boolean field_72995_K; + protected 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(); @@ -29,18 +29,7 @@ this.field_72984_F = p_i50005_4_; this.field_72986_A = p_i50005_1_; this.field_73011_w = p_i50005_2_.func_218270_a(this); -@@ -99,6 +103,10 @@ - } - - public Biome func_180494_b(BlockPos p_180494_1_) { -+ return this.field_73011_w.getBiome(p_180494_1_); -+ } -+ -+ public Biome getBiomeBody(BlockPos p_180494_1_) { - AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); - Chunk chunk = abstractchunkprovider.func_217205_a(p_180494_1_.func_177958_n() >> 4, p_180494_1_.func_177952_p() >> 4, false); - if (chunk != null) { -@@ -169,23 +177,51 @@ +@@ -158,23 +162,51 @@ } else { Chunk chunk = this.func_175726_f(p_180501_1_); Block block = p_180501_2_.func_177230_c(); @@ -94,7 +83,7 @@ this.func_184138_a(p_180501_1_, blockstate, p_180501_2_, p_180501_3_); } -@@ -205,8 +241,6 @@ +@@ -194,8 +226,6 @@ this.func_217393_a(p_180501_1_, blockstate, blockstate1); } @@ -103,32 +92,32 @@ } } } -@@ -221,13 +255,13 @@ +@@ -210,13 +240,13 @@ - public boolean func_175655_b(BlockPos p_175655_1_, boolean p_175655_2_) { - BlockState blockstate = this.func_180495_p(p_175655_1_); + 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_175655_1_)) { ++ if (blockstate.isAir(this, p_225521_1_)) { return false; } else { - IFluidState ifluidstate = this.func_204610_c(p_175655_1_); - this.func_217379_c(2001, p_175655_1_, Block.func_196246_j(blockstate)); - if (p_175655_2_) { -- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? this.func_175625_s(p_175655_1_) : null; -+ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_175655_1_) : null; - Block.func_220059_a(blockstate, this, p_175655_1_, tileentity); + 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); } -@@ -252,6 +286,8 @@ +@@ -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()) ++ 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_); -@@ -261,6 +297,11 @@ +@@ -250,6 +282,11 @@ } public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, Direction p_175695_3_) { @@ -140,7 +129,7 @@ if (p_175695_3_ != Direction.WEST) { this.func_190524_a(p_175695_1_.func_177976_e(), p_175695_2_, p_175695_1_); } -@@ -298,9 +339,9 @@ +@@ -287,9 +324,9 @@ CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block being updated"); crashreportcategory.func_189529_a("Source block type", () -> { try { @@ -152,75 +141,20 @@ } }); CrashReportCategory.func_175750_a(crashreportcategory, p_190524_1_, blockstate); -@@ -363,7 +404,7 @@ +@@ -336,7 +373,7 @@ } public boolean func_72935_r() { -- return this.field_73008_k < 4; +- return this.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ && this.field_73008_k < 4; + return this.field_73011_w.isDaytime(); } - public void func_184133_a(@Nullable PlayerEntity p_184133_1_, BlockPos p_184133_2_, SoundEvent p_184133_3_, SoundCategory p_184133_4_, float p_184133_5_, float p_184133_6_) { -@@ -391,6 +432,10 @@ - } - - public float func_72971_b(float p_72971_1_) { -+ return this.field_73011_w.getSunBrightness(p_72971_1_); -+ } -+ -+ public float getSunBrightnessBody(float p_72971_1_) { - float f = this.func_72826_c(p_72971_1_); - float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F); - f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -@@ -402,12 +447,15 @@ - - @OnlyIn(Dist.CLIENT) - public Vec3d func_217382_a(BlockPos p_217382_1_, float p_217382_2_) { -+ return this.field_73011_w.getSkyColor(p_217382_1_, p_217382_2_); -+ } -+ -+ @OnlyIn(Dist.CLIENT) -+ public Vec3d getSkyColorBody(BlockPos p_217382_1_, float p_217382_2_) { - float f = this.func_72826_c(p_217382_2_); - float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; - f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -- Biome biome = this.func_180494_b(p_217382_1_); -- float f2 = biome.func_225486_c(p_217382_1_); -- int i = biome.func_76731_a(f2); -+ int i = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, p_217382_1_); - float f3 = (float)(i >> 16 & 255) / 255.0F; - float f4 = (float)(i >> 8 & 255) / 255.0F; - float f5 = (float)(i & 255) / 255.0F; -@@ -454,6 +502,11 @@ - - @OnlyIn(Dist.CLIENT) - public Vec3d func_72824_f(float p_72824_1_) { -+ return this.field_73011_w.getCloudColor(p_72824_1_); -+ } -+ -+ @OnlyIn(Dist.CLIENT) -+ public Vec3d getCloudColorBody(float p_72824_1_) { - float f = this.func_72826_c(p_72824_1_); - float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; - f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -@@ -492,17 +545,24 @@ - - @OnlyIn(Dist.CLIENT) - public float func_72880_h(float p_72880_1_) { -- float f = this.func_72826_c(p_72880_1_); -+ return this.field_73011_w.getStarBrightness(p_72880_1_); -+ } -+ -+ @OnlyIn(Dist.CLIENT) -+ public float getStarBrightnessBody(float partialTicks) { -+ float f = this.func_72826_c(partialTicks); - float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F); - f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); - return f1 * f1 * 0.5F; + public 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_145834_a(this); // Forge - set the world early as vanilla doesn't set it until next tick ++ if (p_175700_1_.func_145831_w() != this) p_175700_1_.func_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()); @@ -229,7 +163,7 @@ } boolean flag = this.field_147482_g.add(p_175700_1_); -@@ -510,6 +570,8 @@ +@@ -384,6 +423,8 @@ this.field_175730_i.add(p_175700_1_); } @@ -238,20 +172,19 @@ if (this.field_72995_K) { BlockPos blockpos = p_175700_1_.func_174877_v(); BlockState blockstate = this.func_180495_p(blockpos); -@@ -521,6 +583,7 @@ +@@ -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_145834_a(this)); // Forge - set the world early as vanilla doesn't set it until next tick ++ 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_) { -@@ -533,13 +596,15 @@ +@@ -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); @@ -263,7 +196,7 @@ Iterator iterator = this.field_175730_i.iterator(); while(iterator.hasNext()) { -@@ -548,8 +613,9 @@ +@@ -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 { @@ -274,7 +207,7 @@ }); if (tileentity.func_200662_C().func_223045_a(this.func_180495_p(blockpos).func_177230_c())) { ((ITickableTileEntity)tileentity).func_73660_a(); -@@ -562,8 +628,16 @@ +@@ -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); @@ -291,19 +224,19 @@ } } -@@ -571,7 +645,10 @@ +@@ -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()); ++ //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()); } } } -@@ -603,12 +680,15 @@ +@@ -477,12 +532,15 @@ public void func_217390_a(Consumer p_217390_1_, Entity p_217390_2_) { try { @@ -319,27 +252,27 @@ } } -@@ -625,7 +705,7 @@ +@@ -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$pooledmutableblockpos.func_181079_c(k1, l1, 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$pooledmutableblockpos)) { ++ if (!blockstate.isAir(this, blockpos$pooledmutable)) { boolean flag = true; return flag; } -@@ -649,8 +729,8 @@ +@@ -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$pooledmutableblockpos.func_181079_c(k1, l1, i2)).func_177230_c(); +- 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$pooledmutableblockpos.func_181079_c(k1, l1, i2)); -+ if (state.isBurning(this, blockpos$pooledmutableblockpos)) { ++ 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; } -@@ -721,6 +801,7 @@ +@@ -594,6 +652,7 @@ if (p_217401_2_ != null) { explosion.func_199592_a(p_217401_2_); } @@ -347,20 +280,15 @@ explosion.func_77278_a(); explosion.func_77279_a(true); -@@ -781,9 +862,12 @@ +@@ -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_174878_a(p_175690_1_); -+ if (p_175690_2_.func_145831_w() != this) -+ p_175690_2_.func_145834_a(this); // Forge - set the world early as vanilla doesn't set it until next tick - Iterator iterator = this.field_147484_a.iterator(); - - while(iterator.hasNext()) { -@@ -796,7 +880,8 @@ + p_175690_2_.func_226984_a_(this, p_175690_1_); +@@ -669,7 +729,8 @@ this.field_147484_a.add(p_175690_2_); } else { @@ -370,7 +298,7 @@ this.func_175700_a(p_175690_2_); } } -@@ -809,6 +894,8 @@ +@@ -682,6 +743,8 @@ if (tileentity != null && this.field_147481_N) { tileentity.func_145843_s(); this.field_147484_a.remove(tileentity); @@ -379,7 +307,7 @@ } else { if (tileentity != null) { this.field_147484_a.remove(tileentity); -@@ -818,7 +905,7 @@ +@@ -691,7 +754,7 @@ this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); } @@ -388,7 +316,7 @@ } public boolean func_195588_v(BlockPos p_195588_1_) { -@@ -843,9 +930,14 @@ +@@ -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_); @@ -403,7 +331,7 @@ if (this.field_72986_A.func_76059_o()) { this.field_73004_o = 1.0F; if (this.field_72986_A.func_76061_m()) { -@@ -865,10 +957,10 @@ +@@ -739,10 +807,10 @@ public List func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate p_175674_3_) { List list = Lists.newArrayList(); @@ -418,10 +346,10 @@ for(int i1 = i; i1 <= j; ++i1) { for(int j1 = k; j1 <= l; ++j1) { -@@ -883,10 +975,10 @@ +@@ -757,10 +825,10 @@ } - public List func_217394_a(@Nullable EntityType p_217394_1_, AxisAlignedBB p_217394_2_, Predicate p_217394_3_) { + public List func_217394_a(@Nullable EntityType p_217394_1_, AxisAlignedBB p_217394_2_, Predicate p_217394_3_) { - int i = MathHelper.func_76128_c((p_217394_2_.field_72340_a - 2.0D) / 16.0D); - int j = MathHelper.func_76143_f((p_217394_2_.field_72336_d + 2.0D) / 16.0D); - int k = MathHelper.func_76128_c((p_217394_2_.field_72339_c - 2.0D) / 16.0D); @@ -430,10 +358,10 @@ + 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(); + List list = Lists.newArrayList(); for(int i1 = i; i1 < j; ++i1) { -@@ -902,10 +994,10 @@ +@@ -776,10 +844,10 @@ } public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate p_175647_3_) { @@ -448,7 +376,22 @@ List list = Lists.newArrayList(); AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); -@@ -952,7 +1044,8 @@ +@@ -796,10 +864,10 @@ + } + + public List func_225316_b(Class p_225316_1_, AxisAlignedBB p_225316_2_, @Nullable Predicate p_225316_3_) { +- 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(); + +@@ -826,7 +894,8 @@ } public int func_181545_F() { @@ -458,7 +401,7 @@ } public World func_201672_e() { -@@ -1000,7 +1093,7 @@ +@@ -874,7 +943,7 @@ public int func_175651_c(BlockPos p_175651_1_, Direction p_175651_2_) { BlockState blockstate = this.func_180495_p(p_175651_1_); @@ -467,7 +410,7 @@ } public boolean func_175640_z(BlockPos p_175640_1_) { -@@ -1045,7 +1138,7 @@ +@@ -919,7 +988,7 @@ } public long func_72905_C() { @@ -476,7 +419,7 @@ } public long func_82737_E() { -@@ -1053,11 +1146,11 @@ +@@ -927,11 +996,11 @@ } public long func_72820_D() { @@ -490,7 +433,7 @@ } protected void func_217389_a() { -@@ -1069,7 +1162,7 @@ +@@ -943,7 +1012,7 @@ } public BlockPos func_175694_M() { @@ -499,7 +442,7 @@ 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())); } -@@ -1078,10 +1171,14 @@ +@@ -952,10 +1021,14 @@ } public void func_175652_B(BlockPos p_175652_1_) { @@ -508,24 +451,24 @@ } public boolean func_175660_a(PlayerEntity p_175660_1_, BlockPos p_175660_2_) { -+ return field_73011_w.canMineBlock(p_175660_1_, p_175660_2_); ++ return field_73011_w.canMineBlock(p_175660_1_, p_175660_2_); + } + + public boolean canMineBlockBody(PlayerEntity player, BlockPos pos) { return true; } -@@ -1149,8 +1246,7 @@ +@@ -1023,8 +1096,7 @@ } public boolean func_180502_D(BlockPos p_180502_1_) { -- Biome biome = this.func_180494_b(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 -@@ -1164,11 +1260,11 @@ +@@ -1038,7 +1110,7 @@ } public int func_72940_L() { @@ -533,13 +476,8 @@ + return this.field_73011_w.getActualHeight(); } - public double func_72919_O() { -- return this.field_72986_A.func_76067_t() == WorldType.field_77138_c ? 0.0D : 63.0D; -+ return this.field_73011_w.getHorizon(); - } - public CrashReportCategory func_72914_a(CrashReport p_72914_1_) { -@@ -1199,16 +1295,15 @@ +@@ -1069,16 +1141,15 @@ public abstract Scoreboard func_96441_U(); public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { @@ -560,9 +498,9 @@ blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false); } } -@@ -1287,4 +1382,16 @@ - public BlockPos func_205770_a(Heightmap.Type p_205770_1_, BlockPos p_205770_2_) { - return new BlockPos(p_205770_2_.func_177958_n(), this.func_201676_a(p_205770_1_, p_205770_2_.func_177958_n(), p_205770_2_.func_177952_p()), p_205770_2_.func_177952_p()); +@@ -1146,4 +1217,16 @@ + public BiomeManager func_225523_d_() { + return this.field_226689_w_; } + + private double maxEntityRadius = 2.0D; diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 9266648d1..a9af1b9ef 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -28,15 +28,14 @@ this.field_77133_f = p_i49778_2_; this.field_211890_l = p_i49778_3_; this.field_77134_g = p_i49778_4_; -@@ -40,6 +45,17 @@ +@@ -40,6 +45,16 @@ field_77139_a[p_i49778_1_] = this; } + private static int getNextID() { + for (int x = 0; x < field_77139_a.length; x++) { -+ if (field_77139_a[x] == null) { ++ if (field_77139_a[x] == null) + return x; -+ } + } + int old = field_77139_a.length; + field_77139_a = java.util.Arrays.copyOf(field_77139_a, old + 16); diff --git a/patches/minecraft/net/minecraft/world/biome/Biome.java.patch b/patches/minecraft/net/minecraft/world/biome/Biome.java.patch index 3df1066b2..0e7e4063d 100644 --- a/patches/minecraft/net/minecraft/world/biome/Biome.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/Biome.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/biome/Biome.java +++ b/net/minecraft/world/biome/Biome.java -@@ -58,7 +58,7 @@ +@@ -54,7 +54,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,7 +9,7 @@ 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<>(); -@@ -145,11 +145,11 @@ +@@ -143,11 +143,11 @@ } protected void func_201866_a(EntityClassification p_201866_1_, Biome.SpawnListEntry p_201866_2_) { @@ -23,18 +23,18 @@ } public Biome.RainType func_201851_b() { -@@ -198,7 +198,7 @@ +@@ -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_175642_b(LightType.BLOCK, p_201854_2_) < 10) { -+ if (p_201854_2_.func_177956_o() >= 0 && p_201854_2_.func_177956_o() < p_201854_1_.func_201675_m().getHeight() && p_201854_1_.func_175642_b(LightType.BLOCK, p_201854_2_) < 10) { +- 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) { -@@ -223,7 +223,7 @@ +@@ -221,7 +221,7 @@ } else { - if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_175642_b(LightType.BLOCK, p_201850_2_) < 10) { + 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_)) { diff --git a/patches/minecraft/net/minecraft/world/biome/DefaultBiomeFeatures.java.patch b/patches/minecraft/net/minecraft/world/biome/DefaultBiomeFeatures.java.patch new file mode 100644 index 000000000..c19a2f7ef --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/DefaultBiomeFeatures.java.patch @@ -0,0 +1,49 @@ +--- a/net/minecraft/world/biome/DefaultBiomeFeatures.java ++++ b/net/minecraft/world/biome/DefaultBiomeFeatures.java +@@ -132,26 +132,26 @@ + private static final BlockState field_226805_bm_ = Blocks.field_150419_aX.func_176223_P().func_206870_a(HugeMushroomBlock.field_196460_A, Boolean.valueOf(false)); + private static final BlockState field_226806_bn_ = Blocks.field_150420_aW.func_176223_P().func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(true)).func_206870_a(HugeMushroomBlock.field_196460_A, Boolean.valueOf(false)); + private static final BlockState field_226807_bo_ = Blocks.field_196706_do.func_176223_P().func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(false)).func_206870_a(HugeMushroomBlock.field_196460_A, Boolean.valueOf(false)); +- public static final TreeFeatureConfig field_226739_a_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_225568_b_(); +- public static final TreeFeatureConfig field_226792_b_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226775_aj_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(8).func_227360_i_(3).func_227353_a_(ImmutableList.of(new CocoaTreeDecorator(0.2F), new TrunkVineTreeDecorator(), new LeaveVineTreeDecorator())).func_227352_a_().func_225568_b_(); +- public static final TreeFeatureConfig field_226808_c_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226775_aj_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(8).func_227360_i_(3).func_227352_a_().func_225568_b_(); +- public static final TreeFeatureConfig field_226809_d_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_), new PineFoliagePlacer(1, 0))).func_225569_d_(7).func_227354_b_(4).func_227358_g_(1).func_227360_i_(3).func_227361_j_(1).func_227352_a_().func_225568_b_(); +- public static final TreeFeatureConfig field_226810_e_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_), new SpruceFoliagePlacer(2, 1))).func_225569_d_(6).func_227354_b_(3).func_227356_e_(1).func_227357_f_(1).func_227359_h_(2).func_227352_a_().func_225568_b_(); +- public static final TreeFeatureConfig field_226811_f_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226778_am_), new SimpleBlockStateProvider(field_226779_an_), new AcaciaFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(2).func_227356_e_(0).func_227352_a_().func_225568_b_(); +- public static final TreeFeatureConfig field_226812_g_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_225568_b_(); +- public static final TreeFeatureConfig field_226813_h_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(6).func_227360_i_(3).func_227352_a_().func_225568_b_(); +- public static final TreeFeatureConfig field_226814_i_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(3, 0))).func_225569_d_(5).func_227354_b_(3).func_227360_i_(3).func_227362_k_(1).func_227353_a_(ImmutableList.of(new LeaveVineTreeDecorator())).func_225568_b_(); +- public static final TreeFeatureConfig field_226815_j_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_225568_b_(); +- public static final TreeFeatureConfig field_226816_k_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).func_225568_b_(); +- public static final TreeFeatureConfig field_226817_l_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).func_225568_b_(); +- public static final TreeFeatureConfig field_226818_m_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).func_225568_b_(); +- public static final TreeFeatureConfig field_226819_n_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).func_225568_b_(); +- public static final TreeFeatureConfig field_226820_o_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).func_225568_b_(); +- public static final BaseTreeFeatureConfig field_226821_p_ = (new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226773_ah_))).func_225569_d_(4).func_225568_b_(); +- public static final HugeTreeFeatureConfig field_226822_q_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226782_aq_), new SimpleBlockStateProvider(field_226783_ar_))).func_225569_d_(6).func_225568_b_(); +- public static final HugeTreeFeatureConfig field_226823_r_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_))).func_225569_d_(13).func_227283_b_(15).func_227284_c_(13).func_227282_a_(ImmutableList.of(new AlterGroundTreeDecorator(new SimpleBlockStateProvider(field_226771_af_)))).func_225568_b_(); +- public static final HugeTreeFeatureConfig field_226824_s_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_))).func_225569_d_(13).func_227283_b_(15).func_227284_c_(3).func_227282_a_(ImmutableList.of(new AlterGroundTreeDecorator(new SimpleBlockStateProvider(field_226771_af_)))).func_225568_b_(); +- public static final HugeTreeFeatureConfig field_226825_t_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226775_aj_))).func_225569_d_(10).func_227283_b_(20).func_227282_a_(ImmutableList.of(new TrunkVineTreeDecorator(), new LeaveVineTreeDecorator())).func_225568_b_(); ++ public static final TreeFeatureConfig field_226739_a_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); ++ public static final TreeFeatureConfig field_226792_b_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226775_aj_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(8).func_227360_i_(3).func_227353_a_(ImmutableList.of(new CocoaTreeDecorator(0.2F), new TrunkVineTreeDecorator(), new LeaveVineTreeDecorator())).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196678_w).func_225568_b_(); ++ public static final TreeFeatureConfig field_226808_c_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226775_aj_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(8).func_227360_i_(3).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196678_w).func_225568_b_(); ++ public static final TreeFeatureConfig field_226809_d_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_), new PineFoliagePlacer(1, 0))).func_225569_d_(7).func_227354_b_(4).func_227358_g_(1).func_227360_i_(3).func_227361_j_(1).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u).func_225568_b_(); ++ public static final TreeFeatureConfig field_226810_e_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_), new SpruceFoliagePlacer(2, 1))).func_225569_d_(6).func_227354_b_(3).func_227356_e_(1).func_227357_f_(1).func_227359_h_(2).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u).func_225568_b_(); ++ public static final TreeFeatureConfig field_226811_f_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226778_am_), new SimpleBlockStateProvider(field_226779_an_), new AcaciaFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(2).func_227356_e_(0).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196679_x).func_225568_b_(); ++ public static final TreeFeatureConfig field_226812_g_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_(); ++ public static final TreeFeatureConfig field_226813_h_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(6).func_227360_i_(3).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_(); ++ public static final TreeFeatureConfig field_226814_i_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(3, 0))).func_225569_d_(5).func_227354_b_(3).func_227360_i_(3).func_227362_k_(1).func_227353_a_(ImmutableList.of(new LeaveVineTreeDecorator())).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); ++ public static final TreeFeatureConfig field_226815_j_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); ++ public static final TreeFeatureConfig field_226816_k_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); ++ public static final TreeFeatureConfig field_226817_l_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); ++ public static final TreeFeatureConfig field_226818_m_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); ++ public static final TreeFeatureConfig field_226819_n_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); ++ public static final TreeFeatureConfig field_226820_o_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_(); ++ public static final BaseTreeFeatureConfig field_226821_p_ = (new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226773_ah_))).func_225569_d_(4).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); ++ public static final HugeTreeFeatureConfig field_226822_q_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226782_aq_), new SimpleBlockStateProvider(field_226783_ar_))).func_225569_d_(6).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196680_y).func_225568_b_(); ++ public static final HugeTreeFeatureConfig field_226823_r_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_))).func_225569_d_(13).func_227283_b_(15).func_227284_c_(13).func_227282_a_(ImmutableList.of(new AlterGroundTreeDecorator(new SimpleBlockStateProvider(field_226771_af_)))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u).func_225568_b_(); ++ public static final HugeTreeFeatureConfig field_226824_s_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_))).func_225569_d_(13).func_227283_b_(15).func_227284_c_(3).func_227282_a_(ImmutableList.of(new AlterGroundTreeDecorator(new SimpleBlockStateProvider(field_226771_af_)))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u).func_225568_b_(); ++ public static final HugeTreeFeatureConfig field_226825_t_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226775_aj_))).func_225569_d_(10).func_227283_b_(20).func_227282_a_(ImmutableList.of(new TrunkVineTreeDecorator(), new LeaveVineTreeDecorator())).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196678_w).func_225568_b_(); + public static final BlockClusterFeatureConfig field_226826_u_ = (new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(field_226769_ad_), new SimpleBlockPlacer())).func_227315_a_(32).func_227322_d_(); + public static final BlockClusterFeatureConfig field_226827_v_ = (new BlockClusterFeatureConfig.Builder((new WeightedBlockStateProvider()).func_227407_a_(field_226769_ad_, 1).func_227407_a_(field_226770_ae_, 4), new SimpleBlockPlacer())).func_227315_a_(32).func_227322_d_(); + public static final BlockClusterFeatureConfig field_226828_w_ = (new BlockClusterFeatureConfig.Builder((new WeightedBlockStateProvider()).func_227407_a_(field_226769_ad_, 3).func_227407_a_(field_226770_ae_, 1), new SimpleBlockPlacer())).func_227319_b_(ImmutableSet.of(field_226771_af_)).func_227315_a_(32).func_227322_d_(); diff --git a/patches/minecraft/net/minecraft/world/biome/provider/BiomeProviderType.java.patch b/patches/minecraft/net/minecraft/world/biome/provider/BiomeProviderType.java.patch index 7b5a87de5..db58e82b4 100644 --- a/patches/minecraft/net/minecraft/world/biome/provider/BiomeProviderType.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/provider/BiomeProviderType.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/biome/provider/BiomeProviderType.java +++ b/net/minecraft/world/biome/provider/BiomeProviderType.java @@ -4,7 +4,7 @@ - import java.util.function.Supplier; import net.minecraft.util.registry.Registry; + import net.minecraft.world.storage.WorldInfo; -public class BiomeProviderType { +public class BiomeProviderType extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final BiomeProviderType field_205460_b = func_212581_a("checkerboard", CheckerboardBiomeProvider::new, CheckerboardBiomeProviderSettings::new); - public static final BiomeProviderType field_205461_c = func_212581_a("fixed", SingleBiomeProvider::new, SingleBiomeProviderSettings::new); - public static final BiomeProviderType field_206859_d = func_212581_a("vanilla_layered", OverworldBiomeProvider::new, OverworldBiomeProviderSettings::new); + public static final BiomeProviderType field_205460_b = func_226841_a_("checkerboard", CheckerboardBiomeProvider::new, CheckerboardBiomeProviderSettings::new); + public static final BiomeProviderType field_205461_c = func_226841_a_("fixed", SingleBiomeProvider::new, SingleBiomeProviderSettings::new); + public static final BiomeProviderType field_206859_d = func_226841_a_("vanilla_layered", OverworldBiomeProvider::new, OverworldBiomeProviderSettings::new); diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 8e412c047..080b1cf44 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/chunk/Chunk.java +++ b/net/minecraft/world/chunk/Chunk.java -@@ -57,7 +57,7 @@ +@@ -58,7 +58,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,23 +9,24 @@ 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]; -@@ -90,6 +90,7 @@ +@@ -91,6 +91,7 @@ } - public Chunk(World p_i49946_1_, ChunkPos p_i49946_2_, Biome[] p_i49946_3_, UpgradeData p_i49946_4_, ITickList p_i49946_5_, ITickList p_i49946_6_, long p_i49946_7_, @Nullable ChunkSection[] p_i49946_9_, @Nullable Consumer p_i49946_10_) { + 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_i49946_1_; - this.field_212816_F = p_i49946_2_; -@@ -117,6 +118,7 @@ - field_150817_t.warn("Could not set level chunk sections, array length is {} instead of {}", p_i49946_9_.length, this.field_76652_q.length); + this.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(); - } -@@ -262,14 +264,14 @@ + 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_); @@ -42,7 +43,7 @@ TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.CreateEntityType.CHECK); if (tileentity != null) { tileentity.func_145836_u(); -@@ -280,10 +282,10 @@ +@@ -281,10 +282,10 @@ p_177436_2_.func_215705_a(this.field_76637_e, p_177436_1_, blockstate, p_177436_3_); } @@ -55,7 +56,7 @@ this.field_76637_e.func_175690_a(p_177436_1_, tileentity1); } else { tileentity1.func_145836_u(); -@@ -323,11 +325,13 @@ +@@ -320,11 +321,13 @@ k = this.field_76645_j.length - 1; } @@ -69,7 +70,7 @@ } public void func_201607_a(Heightmap.Type p_201607_1_, long[] p_201607_2_) { -@@ -348,6 +352,7 @@ +@@ -345,6 +348,7 @@ } this.field_76645_j[p_76608_2_].remove(p_76608_1_); @@ -77,7 +78,7 @@ } public int func_201576_a(Heightmap.Type p_201576_1_, int p_201576_2_, int p_201576_3_) { -@@ -358,7 +363,7 @@ +@@ -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(); @@ -86,7 +87,7 @@ } @Nullable -@@ -369,6 +374,10 @@ +@@ -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_); @@ -97,7 +98,7 @@ if (tileentity == null) { CompoundNBT compoundnbt = this.field_201618_i.remove(p_177424_1_); if (compoundnbt != null) { -@@ -384,9 +393,6 @@ +@@ -381,9 +389,6 @@ tileentity = this.func_177422_i(p_177424_1_); this.field_76637_e.func_175690_a(p_177424_1_, tileentity); } @@ -107,17 +108,16 @@ } return tileentity; -@@ -401,7 +407,8 @@ +@@ -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()) { -+ if (p_177426_2_.func_145831_w() != this.field_76637_e) //Forge don't call unless it's changed, could screw up bad mods. - p_177426_2_.func_145834_a(this.field_76637_e); - p_177426_2_.func_174878_a(p_177426_1_); + p_177426_2_.func_226984_a_(this.field_76637_e, p_177426_1_); p_177426_2_.func_145829_t(); -@@ -421,9 +428,14 @@ + 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()) { @@ -132,7 +132,7 @@ } else { CompoundNBT compoundnbt = this.field_201618_i.get(p_223134_1_); if (compoundnbt != null) { -@@ -458,8 +470,8 @@ +@@ -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_) { @@ -143,10 +143,10 @@ 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); -@@ -486,8 +498,8 @@ +@@ -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_) { + 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); @@ -154,7 +154,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); -@@ -502,8 +514,8 @@ +@@ -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_) { @@ -165,7 +165,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); -@@ -534,6 +546,11 @@ +@@ -531,6 +541,11 @@ }; Sets.newHashSet(this.field_150816_i.keySet()).stream().filter(predicate).forEach(this.field_76637_e::func_175713_t); @@ -176,8 +176,8 @@ + for(int i = 0; i < this.field_76652_q.length; ++i) { ChunkSection chunksection = this.field_76652_q[i]; - if ((p_217326_3_ & 1 << i) == 0) { -@@ -599,7 +616,7 @@ + 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_) -> { @@ -186,7 +186,7 @@ }); } -@@ -704,9 +721,9 @@ +@@ -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"))) { @@ -199,7 +199,7 @@ } 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_)); -@@ -798,4 +815,30 @@ +@@ -790,4 +805,30 @@ QUEUED, CHECK; } diff --git a/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch index 7a7fc663b..d430dfe3d 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 -@@ -175,4 +175,9 @@ +@@ -151,4 +151,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 c2d353027..ec8afb354 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/chunk/storage/ChunkSerializer.java +++ b/net/minecraft/world/chunk/storage/ChunkSerializer.java -@@ -147,6 +147,7 @@ - ichunk = new Chunk(p_222656_0_.func_201672_e(), p_222656_3_, abiome, upgradedata, iticklist, iticklist1, i2, achunksection, (p_222648_1_) -> { +@@ -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, chunkprimerticklist1, chunkprimerticklist); - ichunk = chunkprimer; -@@ -314,12 +315,22 @@ + ChunkPrimer chunkprimer = new ChunkPrimer(p_222656_3_, upgradedata, achunksection, chunkprimerticklist, chunkprimerticklist1); + chunkprimer.func_225548_a_(biomecontainer); +@@ -294,12 +295,22 @@ for(int k = 0; k < chunk.func_177429_s().length; ++k) { for(Entity entity : chunk.func_177429_s()[k]) { CompoundNBT compoundnbt3 = new CompoundNBT(); @@ -31,11 +31,3 @@ } else { ChunkPrimer chunkprimer = (ChunkPrimer)p_222645_1_; listnbt2.addAll(chunkprimer.func_201652_l()); -@@ -363,6 +374,7 @@ - - compoundnbt1.func_218657_a("Heightmaps", compoundnbt6); - compoundnbt1.func_218657_a("Structures", func_222649_a(chunkpos, p_222645_1_.func_201609_c(), p_222645_1_.func_201604_d())); -+ - return compoundnbt; - } - diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch index b2f1a1579..f88acb306 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -1,103 +1,102 @@ --- a/net/minecraft/world/chunk/storage/RegionFile.java +++ b/net/minecraft/world/chunk/storage/RegionFile.java -@@ -19,13 +19,19 @@ - import net.minecraft.util.math.ChunkPos; +@@ -32,6 +32,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 class RegionFile implements AutoCloseable { -+ // Minecraft is limited to 256 sections per chunk. So 1MB. This can easily be override. -+ // So we extend this to use the REAL size when the count is maxed by seeking to that section and reading the length. -+ private static final boolean FORGE_ENABLE_EXTENDED_SAVE = Boolean.parseBoolean(System.getProperty("forge.enableExtendedSave", "true")); -+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); - private static final byte[] field_76720_a = new byte[4096]; - private final RandomAccessFile field_76719_c; - private final int[] field_76716_d = new int[1024]; - private final int[] field_76717_e = new int[1024]; - private final List field_76714_f; -+ private final File filepath; + 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_); +@@ -39,6 +40,7 @@ - public RegionFile(File p_i2001_1_) throws IOException { -+ this.filepath = p_i2001_1_; - this.field_76719_c = new RandomAccessFile(p_i2001_1_, "rw"); - if (this.field_76719_c.length() < 4096L) { - this.field_76719_c.write(field_76720_a); -@@ -52,11 +58,21 @@ - for(int j1 = 0; j1 < 1024; ++j1) { - int k = this.field_76719_c.readInt(); - this.field_76716_d[j1] = k; -- if (k != 0 && (k >> 8) + (k & 255) <= this.field_76714_f.size()) { -- for(int l = 0; l < (k & 255); ++l) { -+ int length = k & 255; -+ if (length == 255) { -+ if ((k >> 8) <= this.field_76714_f.size()) { // We're maxed out, so we need to read the proper length from the section -+ this.field_76719_c.seek((k >> 8) * 4096); -+ length = (this.field_76719_c.readInt() + 4) / 4096 + 1; -+ this.field_76719_c.seek(j1 * 4 + 4); //Go back to where we were -+ } -+ } -+ if (k != 0 && (k >> 8) + length <= this.field_76714_f.size()) { -+ for (int l = 0; l < length; ++l) { - this.field_76714_f.set((k >> 8) + l, false); - } - } -+ else if (length > 0) -+ LOGGER.warn("Invalid chunk: ({}, {}) Offset: {} Length: {} runs off end file. {}", j1 % 32, (int)(j1 / 32), k >> 8, length, p_i2001_1_); - } - - for(int k1 = 0; k1 < 1024; ++k1) { -@@ -74,14 +90,20 @@ + 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 { - int j = i >> 8; - int k = i & 255; -+ if (k == 255) { -+ this.field_76719_c.seek(j * 4096); -+ k = (this.field_76719_c.readInt() + 4) / 4096 + 1; -+ } - if (j + k > this.field_76714_f.size()) { - return null; - } else { - this.field_76719_c.seek((long)(j * 4096)); - int l = this.field_76719_c.readInt(); - if (l > 4096 * k) { -+ LOGGER.warn("Invalid chunk: ({}, {}) Offset: {} Invalid Size: {}>{} {}", p_222666_1_.field_77276_a, p_222666_1_.field_77275_b, j, l, k * 4096, filepath); - return null; - } else if (l <= 0) { -+ LOGGER.warn("Invalid chunk: ({}, {}) Offset: {} Invalid Size: {} {}", p_222666_1_.field_77276_a, p_222666_1_.field_77275_b, j, l, filepath); - return null; - } else { - byte b0 = this.field_76719_c.readByte(); -@@ -134,10 +156,16 @@ - int i = this.func_222660_e(p_222664_1_); - int j = i >> 8; - int k = i & 255; -+ if (k == 255) { -+ this.field_76719_c.seek(j * 4096); -+ k = (this.field_76719_c.readInt() + 4) / 4096 + 1; -+ } - int l = (p_222664_3_ + 5) / 4096 + 1; -- if (l >= 256) { -+ if (l >= 256 && !FORGE_ENABLE_EXTENDED_SAVE) { - throw new RuntimeException(String.format("Too big to save, %d > 1048576", p_222664_3_)); - } else { -+ if (l >= 256) LOGGER.warn("Large Chunk Detected: ({}, {}) Size: {} {}", p_222664_1_.field_77276_a, p_222664_1_.field_77275_b, l, filepath); -+ - if (j != 0 && k == l) { - this.func_76712_a(j, p_222664_2_, p_222664_3_); - } else { -@@ -168,7 +196,7 @@ - - if (j1 >= l) { - j = l1; -- this.func_222663_a(p_222664_1_, l1 << 8 | l); -+ this.func_222663_a(p_222664_1_, l1 << 8 | (l > 255 ? 255 : l)); - - for(int i2 = 0; i2 < l; ++i2) { - this.field_76714_f.set(j + i2, false); -@@ -185,7 +213,7 @@ +@@ -61,6 +63,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); } - - this.func_76712_a(j, p_222664_2_, p_222664_3_); -- this.func_222663_a(p_222664_1_, j << 8 | l); -+ this.func_222663_a(p_222664_1_, j << 8 | (l > 255 ? 255 : l)); } - } +@@ -69,6 +73,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); ++ 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); ++ 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); ++ 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); +@@ -224,6 +288,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/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java.patch new file mode 100644 index 000000000..c72ca60da --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/chunk/storage/RegionFileCache.java ++++ b/net/minecraft/world/chunk/storage/RegionFileCache.java +@@ -33,7 +33,7 @@ + } + + File file1 = new File(this.field_219101_a, "r." + p_219098_1_.func_222241_h() + "." + p_219098_1_.func_222242_i() + ".mca"); +- RegionFile regionfile1 = new RegionFile(file1, this.field_219101_a); ++ RegionFile regionfile1 = new RegionFile(file1, this.field_219101_a).extractLargeChunks(p_219098_1_); + this.field_219102_c.putAndMoveToFirst(i, regionfile1); + return regionfile1; + } diff --git a/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch index 0143d0201..d4bf309e4 100644 --- a/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch @@ -9,7 +9,7 @@ public static final float[] field_111203_a = new float[]{1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F}; protected final World field_76579_a; private final DimensionType field_222669_f; -@@ -63,7 +63,7 @@ +@@ -59,7 +59,7 @@ @OnlyIn(Dist.CLIENT) public float func_76571_f() { @@ -18,7 +18,7 @@ } @OnlyIn(Dist.CLIENT) -@@ -78,7 +78,7 @@ +@@ -74,7 +74,7 @@ @OnlyIn(Dist.CLIENT) public double func_76565_k() { @@ -27,7 +27,7 @@ } public boolean func_177500_n() { -@@ -107,6 +107,7 @@ +@@ -103,6 +103,7 @@ public void func_186059_r() { } @@ -35,7 +35,7 @@ public abstract ChunkGenerator func_186060_c(); @Nullable -@@ -127,5 +128,64 @@ +@@ -123,5 +124,64 @@ @OnlyIn(Dist.CLIENT) public abstract boolean func_76568_b(int p_76568_1_, int p_76568_2_); diff --git a/patches/minecraft/net/minecraft/world/dimension/DimensionType.java.patch b/patches/minecraft/net/minecraft/world/dimension/DimensionType.java.patch index 850fe2eec..3b060fef9 100644 --- a/patches/minecraft/net/minecraft/world/dimension/DimensionType.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/DimensionType.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/dimension/DimensionType.java +++ b/net/minecraft/world/dimension/DimensionType.java -@@ -10,7 +10,7 @@ - import net.minecraft.util.registry.Registry; - import net.minecraft.world.World; +@@ -13,7 +13,7 @@ + import net.minecraft.world.biome.FuzzedBiomeMagnifier; + import net.minecraft.world.biome.IBiomeMagnifier; -public class DimensionType implements IDynamicSerializable { +public class DimensionType extends net.minecraftforge.registries.ForgeRegistryEntry implements IDynamicSerializable { - public static final DimensionType field_223227_a_ = func_212677_a("overworld", new DimensionType(1, "", "", OverworldDimension::new, true)); - public static final DimensionType field_223228_b_ = func_212677_a("the_nether", new DimensionType(0, "_nether", "DIM-1", NetherDimension::new, false)); - public static final DimensionType field_223229_c_ = func_212677_a("the_end", new DimensionType(2, "_end", "DIM1", EndDimension::new, false)); -@@ -19,17 +19,31 @@ - private final String field_212682_f; + public static final DimensionType field_223227_a_ = func_212677_a("overworld", new DimensionType(1, "", "", OverworldDimension::new, true, ColumnFuzzedBiomeMagnifier.INSTANCE)); + public static final DimensionType field_223228_b_ = func_212677_a("the_nether", new DimensionType(0, "_nether", "DIM-1", NetherDimension::new, false, FuzzedBiomeMagnifier.INSTANCE)); + public static final DimensionType field_223229_c_ = func_212677_a("the_end", new DimensionType(2, "_end", "DIM1", EndDimension::new, false, FuzzedBiomeMagnifier.INSTANCE)); +@@ -23,18 +23,32 @@ private final BiFunction field_201038_g; private final boolean field_218273_h; + private final IBiomeMagnifier field_227175_i_; + private final boolean isVanilla; + private final net.minecraftforge.common.ModDimension modType; + private final net.minecraft.network.PacketBuffer data; @@ -23,25 +23,26 @@ + //Forge, Internal use only. Use DimensionManager instead. + @Deprecated - protected DimensionType(int p_i49935_1_, String p_i49935_2_, String p_i49935_3_, BiFunction p_i49935_4_, boolean p_i49935_5_) { -+ this(p_i49935_1_, p_i49935_2_, p_i49935_3_, p_i49935_4_, p_i49935_5_, null, null); + protected DimensionType(int p_i225789_1_, String p_i225789_2_, String p_i225789_3_, BiFunction p_i225789_4_, boolean p_i225789_5_, IBiomeMagnifier p_i225789_6_) { ++ this(p_i225789_1_, p_i225789_2_, p_i225789_3_, p_i225789_4_, p_i225789_5_, p_i225789_6_, null, null); + } + + //Forge, Internal use only. Use DimensionManager instead. + @Deprecated -+ public DimensionType(int p_i49935_1_, String p_i49935_2_, String p_i49935_3_, BiFunction p_i49935_4_, boolean p_i49935_5_, @Nullable net.minecraftforge.common.ModDimension modType, @Nullable net.minecraft.network.PacketBuffer data) { - this.field_186074_d = p_i49935_1_; - this.field_186076_f = p_i49935_2_; - this.field_212682_f = p_i49935_3_; - this.field_201038_g = p_i49935_4_; - this.field_218273_h = p_i49935_5_; ++ public DimensionType(int p_i225789_1_, String p_i225789_2_, String p_i225789_3_, BiFunction p_i225789_4_, boolean p_i225789_5_, IBiomeMagnifier p_i225789_6_, @Nullable net.minecraftforge.common.ModDimension modType, @Nullable net.minecraft.network.PacketBuffer data) { + this.field_186074_d = p_i225789_1_; + this.field_186076_f = p_i225789_2_; + this.field_212682_f = p_i225789_3_; + this.field_201038_g = p_i225789_4_; + this.field_218273_h = p_i225789_5_; + this.field_227175_i_ = p_i225789_6_; + this.isVanilla = this.field_186074_d >= 0 && this.field_186074_d <= 2; + this.modType = modType; + this.data = data; } public static DimensionType func_218271_a(Dynamic p_218271_0_) { -@@ -44,8 +58,9 @@ +@@ -49,8 +63,9 @@ return this.field_186074_d + -1; } @@ -52,7 +53,7 @@ } public File func_212679_a(File p_212679_1_) { -@@ -57,7 +72,7 @@ +@@ -62,7 +77,7 @@ } public String toString() { @@ -61,7 +62,7 @@ } @Nullable -@@ -65,7 +80,21 @@ +@@ -70,7 +85,21 @@ return Registry.field_212622_k.func_148745_a(p_186069_0_ - -1); } diff --git a/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch index 4719be695..6817f7998 100644 --- a/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch @@ -3,7 +3,7 @@ @@ -24,8 +24,8 @@ public EndDimension(World p_i49932_1_, DimensionType p_i49932_2_) { - super(p_i49932_1_, p_i49932_2_); + super(p_i49932_1_, p_i49932_2_, 0.0F); - CompoundNBT compoundnbt = p_i49932_1_.func_72912_H().func_186347_a(DimensionType.field_223229_c_); - this.field_186064_g = p_i49932_1_ instanceof ServerWorld ? new DragonFightManager((ServerWorld)p_i49932_1_, compoundnbt.func_74775_l("DragonFight")) : null; + CompoundNBT compoundnbt = p_i49932_1_.func_72912_H().func_186347_a(p_i49932_2_); diff --git a/patches/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch index 88b2931af..23f0a9501 100644 --- a/patches/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/dimension/NetherDimension.java +++ b/net/minecraft/world/dimension/NetherDimension.java -@@ -82,8 +82,4 @@ +@@ -74,8 +74,4 @@ } }; } diff --git a/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch index ce637c4f0..a50b9a307 100644 --- a/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/dimension/OverworldDimension.java +++ b/net/minecraft/world/dimension/OverworldDimension.java @@ -51,10 +51,6 @@ - super(p_i49933_1_, p_i49933_2_); + super(p_i49933_1_, p_i49933_2_, 0.0F); } - public DimensionType func_186058_p() { diff --git a/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch b/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch index 5ca26b6c3..e53ba433b 100644 --- a/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch +++ b/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch @@ -34,7 +34,7 @@ if (this.field_186121_o != null) { compoundnbt.func_218657_a("ExitPortalLocation", NBTUtil.func_186859_a(this.field_186121_o)); } -@@ -490,6 +492,13 @@ +@@ -492,6 +494,13 @@ endercrystalentity.func_184516_a((BlockPos)null); } } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch index 1134a356d..ce970844f 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/gen/ChunkGenerator.java +++ b/net/minecraft/world/gen/ChunkGenerator.java -@@ -195,7 +195,7 @@ +@@ -196,7 +196,7 @@ public abstract void func_222537_b(IWorld p_222537_1_, IChunk p_222537_2_); public int func_222530_f() { diff --git a/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch b/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch index fad97fb48..024973d21 100644 --- a/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/gen/WorldGenRegion.java +++ b/net/minecraft/world/gen/WorldGenRegion.java -@@ -165,11 +165,11 @@ +@@ -164,11 +164,11 @@ - public boolean func_175655_b(BlockPos p_175655_1_, boolean p_175655_2_) { - BlockState blockstate = this.func_180495_p(p_175655_1_); + 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_175655_1_)) { ++ if (blockstate.isAir(this, p_225521_1_)) { return false; } else { - if (p_175655_2_) { -- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? this.func_175625_s(p_175655_1_) : null; -+ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_175655_1_) : null; - Block.func_220059_a(blockstate, this.field_201689_f, p_175655_1_, tileentity); + 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); } -@@ -187,12 +187,12 @@ +@@ -186,12 +186,12 @@ CompoundNBT compoundnbt = ichunk.func_201579_g(p_175625_1_); if (compoundnbt != null) { if ("DUMMY".equals(compoundnbt.func_74779_i("id"))) { @@ -30,7 +30,7 @@ } else { tileentity = TileEntity.func_203403_c(compoundnbt); } -@@ -203,7 +203,7 @@ +@@ -202,7 +202,7 @@ } } @@ -39,7 +39,7 @@ field_208303_a.warn("Tried to access a block entity before it was created. {}", (Object)p_175625_1_); } -@@ -219,9 +219,9 @@ +@@ -218,9 +218,9 @@ } Block block = p_180501_2_.func_177230_c(); @@ -51,7 +51,7 @@ } else { CompoundNBT compoundnbt = new CompoundNBT(); compoundnbt.func_74768_a("x", p_180501_1_.func_177958_n()); -@@ -230,7 +230,7 @@ +@@ -229,7 +229,7 @@ compoundnbt.func_74778_a("id", "DUMMY"); ichunk.func_201591_a(compoundnbt); } 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 6a13365e0..bdaef4183 100644 --- a/patches/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/gen/carver/WorldCarver.java +++ b/net/minecraft/world/gen/carver/WorldCarver.java -@@ -21,7 +21,7 @@ +@@ -22,7 +22,7 @@ import net.minecraft.world.chunk.IChunk; import net.minecraft.world.gen.feature.ProbabilityConfig; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch new file mode 100644 index 000000000..30d554c31 --- /dev/null +++ b/patches/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_).canBeReplacedByLeaves(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/minecraft/net/minecraft/world/gen/feature/AbstractSmallTreeFeature.java.patch new file mode 100644 index 000000000..a00031dfe --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/AbstractSmallTreeFeature.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/world/gen/feature/AbstractSmallTreeFeature.java ++++ b/net/minecraft/world/gen/feature/AbstractSmallTreeFeature.java +@@ -35,7 +35,7 @@ + blockpos = p_227212_5_; + } + +- if (blockpos.func_177956_o() >= 1 && blockpos.func_177956_o() + p_227212_2_ + 1 <= 256) { ++ if (blockpos.func_177956_o() >= 1 && blockpos.func_177956_o() + p_227212_2_ + 1 <= p_227212_1_.getMaxHeight()) { + for(int i1 = 0; i1 <= p_227212_2_ + 1; ++i1) { + int j1 = p_227212_6_.field_227327_a_.func_225570_a_(p_227212_3_, p_227212_2_, p_227212_4_, i1); + BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(); +@@ -44,7 +44,7 @@ + int l = -j1; + + while(l <= j1) { +- if (i1 + blockpos.func_177956_o() >= 0 && i1 + blockpos.func_177956_o() < 256) { ++ if (i1 + blockpos.func_177956_o() >= 0 && i1 + blockpos.func_177956_o() < p_227212_1_.getMaxHeight()) { + blockpos$mutable.func_181079_c(k + blockpos.func_177958_n(), i1 + blockpos.func_177956_o(), l + blockpos.func_177952_p()); + if (func_214587_a(p_227212_1_, blockpos$mutable) && (p_227212_6_.field_227337_l_ || !func_227222_d_(p_227212_1_, blockpos$mutable))) { + ++l; +@@ -59,7 +59,7 @@ + } + } + +- return func_214585_i(p_227212_1_, blockpos.func_177977_b()) && blockpos.func_177956_o() < 256 - p_227212_2_ - 1 ? Optional.of(blockpos) : Optional.empty(); ++ return isSoilOrFarm(p_227212_1_, blockpos.func_177977_b(), p_227212_6_.getSapling()) && blockpos.func_177956_o() < p_227212_1_.getMaxHeight() - p_227212_2_ - 1 ? Optional.of(blockpos) : Optional.empty(); + } else { + return Optional.empty(); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch index 9a29016ea..4592a4303 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch @@ -1,47 +1,38 @@ --- a/net/minecraft/world/gen/feature/AbstractTreeFeature.java +++ b/net/minecraft/world/gen/feature/AbstractTreeFeature.java -@@ -27,19 +27,25 @@ - import net.minecraft.world.gen.feature.template.Template; - - public abstract class AbstractTreeFeature extends Feature { -+ protected net.minecraftforge.common.IPlantable sapling = (net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196674_t; -+ - public AbstractTreeFeature(Function, ? extends T> p_i49920_1_, boolean p_i49920_2_) { - super(p_i49920_1_, p_i49920_2_); +@@ -34,6 +34,8 @@ } protected static boolean func_214587_a(IWorldGenerationBaseReader p_214587_0_, BlockPos p_214587_1_) { -+ if (!(p_214587_0_ instanceof net.minecraft.world.IWorldReader)) // FORGE: Redirect to state method when possible ++ if (p_214587_0_ instanceof net.minecraft.world.IWorldReader) // FORGE: Redirect to state method when possible ++ return p_214587_0_.func_217375_a(p_214587_1_, state -> state.canBeReplacedByLogs((net.minecraft.world.IWorldReader)p_214587_0_, p_214587_1_)); return p_214587_0_.func_217375_a(p_214587_1_, (p_214573_0_) -> { Block block = p_214573_0_.func_177230_c(); - return p_214573_0_.func_196958_f() || p_214573_0_.func_203425_a(BlockTags.field_206952_E) || block == Blocks.field_196658_i || Block.func_196245_f(block) || block.func_203417_a(BlockTags.field_200031_h) || block.func_203417_a(BlockTags.field_200030_g) || block == Blocks.field_150395_bd; - }); -+ else return p_214587_0_.func_217375_a(p_214587_1_, state -> state.canBeReplacedByLogs((net.minecraft.world.IWorldReader)p_214587_0_, p_214587_1_)); + return p_214573_0_.func_196958_f() || p_214573_0_.func_203425_a(BlockTags.field_206952_E) || func_227250_b_(block) || block.func_203417_a(BlockTags.field_200031_h) || block.func_203417_a(BlockTags.field_200030_g) || block == Blocks.field_150395_bd; +@@ -41,6 +43,8 @@ } - protected static boolean func_214574_b(IWorldGenerationBaseReader p_214574_0_, BlockPos p_214574_1_) { -+ if (!(p_214574_0_ instanceof net.minecraft.world.IBlockReader)) // FORGE: Redirect to state method when possible + public static boolean func_214574_b(IWorldGenerationBaseReader p_214574_0_, BlockPos p_214574_1_) { ++ if (p_214574_0_ instanceof net.minecraft.world.IBlockReader) // FORGE: Redirect to state method when possible ++ return p_214574_0_.func_217375_a(p_214574_1_, state -> state.isAir((net.minecraft.world.IBlockReader)p_214574_0_, p_214574_1_)); return p_214574_0_.func_217375_a(p_214574_1_, BlockState::func_196958_f); -+ else return p_214574_0_.func_217375_a(p_214574_1_, state -> state.isAir((net.minecraft.world.IBlockReader)p_214574_0_, p_214574_1_)); } - protected static boolean func_214578_c(IWorldGenerationBaseReader p_214578_0_, BlockPos p_214578_1_) { -@@ -61,11 +67,14 @@ +@@ -64,17 +68,27 @@ } - protected static boolean func_214572_g(IWorldGenerationBaseReader p_214572_0_, BlockPos p_214572_1_) { -+ if (!(p_214572_0_ instanceof net.minecraft.world.IWorldReader)) // FORGE: Redirect to state method when possible - return p_214572_0_.func_217375_a(p_214572_1_, (p_214581_0_) -> { - return p_214581_0_.func_196958_f() || p_214581_0_.func_203425_a(BlockTags.field_206952_E); + public static boolean func_214572_g(IWorldGenerationBaseReader p_214572_0_, BlockPos p_214572_1_) { ++ if (p_214572_0_ instanceof net.minecraft.world.IWorldReader) // FORGE: Redirect to state method when possible ++ return p_214572_0_.func_217375_a(p_214572_1_, state -> state.canBeReplacedByLeaves((net.minecraft.world.IWorldReader)p_214572_0_, p_214572_1_)); + return p_214572_0_.func_217375_a(p_214572_1_, (p_227223_0_) -> { + return p_227223_0_.func_196958_f() || p_227223_0_.func_203425_a(BlockTags.field_206952_E); }); -+ else return p_214572_0_.func_217375_a(p_214572_1_, state -> state.canBeReplacedByLeaves((net.minecraft.world.IWorldReader)p_214572_0_, p_214572_1_)); } + @Deprecated //Forge: moved to isSoil - protected static boolean func_214589_h(IWorldGenerationBaseReader p_214589_0_, BlockPos p_214589_1_) { - return p_214589_0_.func_217375_a(p_214589_1_, (p_214582_0_) -> { - Block block = p_214582_0_.func_177230_c(); -@@ -73,6 +82,13 @@ + public static boolean func_214589_h(IWorldGenerationBaseReader p_214589_0_, BlockPos p_214589_1_) { + return p_214589_0_.func_217375_a(p_214589_1_, (p_227221_0_) -> { + return func_227250_b_(p_227221_0_.func_177230_c()); }); } @@ -53,9 +44,9 @@ + + @Deprecated //Forge: moved to isSoilOrFarm protected static boolean func_214585_i(IWorldGenerationBaseReader p_214585_0_, BlockPos p_214585_1_) { - return p_214585_0_.func_217375_a(p_214585_1_, (p_214586_0_) -> { - Block block = p_214586_0_.func_177230_c(); -@@ -80,6 +96,12 @@ + return p_214585_0_.func_217375_a(p_214585_1_, (p_227220_0_) -> { + Block block = p_227220_0_.func_177230_c(); +@@ -82,6 +96,12 @@ }); } @@ -65,10 +56,10 @@ + return reader.func_217375_a(pos, state -> state.canSustainPlant((net.minecraft.world.IBlockReader)reader, pos, Direction.UP, sapling)); + } + - protected static boolean func_214576_j(IWorldGenerationBaseReader p_214576_0_, BlockPos p_214576_1_) { - return p_214576_0_.func_217375_a(p_214576_1_, (p_214588_0_) -> { - Material material = p_214588_0_.func_185904_a(); -@@ -87,6 +109,7 @@ + public static boolean func_214576_j(IWorldGenerationBaseReader p_214576_0_, BlockPos p_214576_1_) { + return p_214576_0_.func_217375_a(p_214576_1_, (p_227218_0_) -> { + Material material = p_227218_0_.func_185904_a(); +@@ -89,6 +109,7 @@ }); } @@ -76,8 +67,8 @@ protected void func_214584_a(IWorldGenerationReader p_214584_1_, BlockPos p_214584_2_) { if (!func_214578_c(p_214584_1_, p_214584_2_)) { this.func_202278_a(p_214584_1_, p_214584_2_, Blocks.field_150346_d.func_176223_P()); -@@ -94,6 +117,14 @@ - +@@ -116,6 +137,13 @@ + } } + protected void setDirtAt(IWorldGenerationReader reader, BlockPos pos, BlockPos origin) { @@ -87,29 +78,6 @@ + } + ((IWorld)reader).func_180495_p(pos).onPlantGrow((IWorld)reader, pos, origin); + } -+ protected void func_202278_a(IWorldWriter p_202278_1_, BlockPos p_202278_2_, BlockState p_202278_3_) { this.func_208521_b(p_202278_1_, p_202278_2_, p_202278_3_); } -@@ -104,7 +135,6 @@ - if (BlockTags.field_200031_h.func_199685_a_(p_208520_4_.func_177230_c())) { - p_208520_1_.add(p_208520_3_.func_185334_h()); - } -- - } - - private void func_208521_b(IWorldWriter p_208521_1_, BlockPos p_208521_2_, BlockState p_208521_3_) { -@@ -192,4 +222,13 @@ - } - - protected abstract boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_); -+ -+ protected net.minecraftforge.common.IPlantable getSapling() { -+ return sapling; -+ } -+ -+ public AbstractTreeFeature setSapling(net.minecraftforge.common.IPlantable sapling) { -+ this.sapling = sapling; -+ return this; -+ } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/AcaciaFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/AcaciaFeature.java.patch new file mode 100644 index 000000000..ceb7a6754 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/AcaciaFeature.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/feature/AcaciaFeature.java ++++ b/net/minecraft/world/gen/feature/AcaciaFeature.java +@@ -24,7 +24,7 @@ + return false; + } else { + BlockPos blockpos = optional.get(); +- this.func_214584_a(p_225557_1_, blockpos.func_177977_b()); ++ this.setDirtAt(p_225557_1_, blockpos.func_177977_b(), blockpos); + Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_225557_2_); + int l = i - p_225557_2_.nextInt(4) - 1; + int i1 = 3 - p_225557_2_.nextInt(3); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch new file mode 100644 index 000000000..790cce939 --- /dev/null +++ b/patches/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/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch index dfebb268a..270d75dfc 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch @@ -1,38 +1,11 @@ --- a/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java +++ b/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java -@@ -26,7 +26,7 @@ - } - - int j = p_212245_4_.func_177956_o(); -- if (j >= 1 && j + i + 1 < 256) { -+ if (j >= 1 && j + i + 1 < p_212245_1_.func_201672_e().func_201675_m().getHeight()) { - Block block = p_212245_1_.func_180495_p(p_212245_4_.func_177977_b()).func_177230_c(); - if (!Block.func_196245_f(block) && block != Blocks.field_196658_i && block != Blocks.field_150391_bh) { - return false; -@@ -39,7 +39,7 @@ - for(int i1 = -l; i1 <= l; ++i1) { - for(int j1 = -l; j1 <= l; ++j1) { - BlockState blockstate = p_212245_1_.func_180495_p(blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_196234_d(i1, k, j1)); -- if (!blockstate.func_196958_f() && !blockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (!blockstate.isAir(p_212245_1_, blockpos$mutableblockpos) && !blockstate.func_203425_a(BlockTags.field_206952_E)) { - return false; - } - } -@@ -59,7 +59,7 @@ - boolean flag4 = flag1 || flag2; - if (!flag3 || !flag4) { - blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_196234_d(l1, i, i2); -- if (!p_212245_1_.func_180495_p(blockpos$mutableblockpos).func_200015_d(p_212245_1_, blockpos$mutableblockpos)) { -+ if (p_212245_1_.func_180495_p(blockpos$mutableblockpos).canBeReplacedByLeaves(p_212245_1_, blockpos$mutableblockpos)) { - boolean flag5 = flag9 || flag4 && l1 == -2; - boolean flag6 = flag || flag4 && l1 == 2; - boolean flag7 = flag1 || flag3 && i2 == -2; -@@ -74,7 +74,7 @@ - - for(int j2 = 0; j2 < i; ++j2) { - blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_189534_c(Direction.UP, j2); -- if (!p_212245_1_.func_180495_p(blockpos$mutableblockpos).func_200015_d(p_212245_1_, blockpos$mutableblockpos)) { -+ if (p_212245_1_.func_180495_p(blockpos$mutableblockpos).canBeReplacedByLeaves(p_212245_1_, blockpos$mutableblockpos)) { - if (p_212245_5_.field_222854_a) { - p_212245_1_.func_180501_a(blockpos$mutableblockpos, blockstate2, 3); - } else { +@@ -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/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch index 192f6cdd8..434a65fa5 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch @@ -1,29 +1,11 @@ --- a/net/minecraft/world/gen/feature/BigRedMushroomFeature.java +++ b/net/minecraft/world/gen/feature/BigRedMushroomFeature.java -@@ -44,7 +44,7 @@ - for(int i1 = -l; i1 <= l; ++i1) { - for(int j1 = -l; j1 <= l; ++j1) { - BlockState blockstate = p_212245_1_.func_180495_p(blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_196234_d(i1, k, j1)); -- if (!blockstate.func_196958_f() && !blockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (!blockstate.isAir(p_212245_1_, blockpos$mutableblockpos) && !blockstate.func_203425_a(BlockTags.field_206952_E)) { - return false; - } +@@ -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))); } -@@ -67,7 +67,7 @@ - boolean flag5 = flag2 || flag3; - if (l1 >= i || flag4 != flag5) { - blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_196234_d(l2, l1, k1); -- if (!p_212245_1_.func_180495_p(blockpos$mutableblockpos).func_200015_d(p_212245_1_, blockpos$mutableblockpos)) { -+ if (p_212245_1_.func_180495_p(blockpos$mutableblockpos).canBeReplacedByLeaves(p_212245_1_, blockpos$mutableblockpos)) { - this.func_202278_a(p_212245_1_, blockpos$mutableblockpos, blockstate1.func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(l1 >= i - 1)).func_206870_a(HugeMushroomBlock.field_196464_y, Boolean.valueOf(l2 < 0)).func_206870_a(HugeMushroomBlock.field_196461_b, Boolean.valueOf(l2 > 0)).func_206870_a(HugeMushroomBlock.field_196459_a, Boolean.valueOf(k1 < 0)).func_206870_a(HugeMushroomBlock.field_196463_c, Boolean.valueOf(k1 > 0))); - } - } -@@ -79,7 +79,7 @@ - - for(int j2 = 0; j2 < i; ++j2) { - blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_189534_c(Direction.UP, j2); -- if (!p_212245_1_.func_180495_p(blockpos$mutableblockpos).func_200015_d(p_212245_1_, blockpos$mutableblockpos)) { -+ if (p_212245_1_.func_180495_p(blockpos$mutableblockpos).canBeReplacedByLeaves(p_212245_1_, blockpos$mutableblockpos)) { - if (p_212245_5_.field_222854_a) { - p_212245_1_.func_180501_a(blockpos$mutableblockpos, blockstate2, 3); - } else { + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BigTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BigTreeFeature.java.patch deleted file mode 100644 index cb51c8dee..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/BigTreeFeature.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/world/gen/feature/BigTreeFeature.java -+++ b/net/minecraft/world/gen/feature/BigTreeFeature.java -@@ -156,7 +156,7 @@ - if (i == -1) { - return false; - } else { -- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - int j = (int)((double)i * 0.618D); - if (j >= i) { - j = i - 1; -@@ -206,7 +206,7 @@ - } - - private int func_208528_b(Set p_208528_1_, IWorldGenerationReader p_208528_2_, BlockPos p_208528_3_, int p_208528_4_, MutableBoundingBox p_208528_5_) { -- if (!func_214585_i(p_208528_2_, p_208528_3_.func_177977_b())) { -+ if (!isSoilOrFarm(p_208528_2_, p_208528_3_.func_177977_b(), getSapling())) { - return -1; - } else { - int i = this.func_208523_a(p_208528_1_, p_208528_2_, p_208528_3_, p_208528_3_.func_177981_b(p_208528_4_ - 1), false, p_208528_5_); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BirchTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BirchTreeFeature.java.patch deleted file mode 100644 index 255c7bba6..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/BirchTreeFeature.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/net/minecraft/world/gen/feature/BirchTreeFeature.java -+++ b/net/minecraft/world/gen/feature/BirchTreeFeature.java -@@ -18,6 +18,7 @@ - public BirchTreeFeature(Function, ? extends NoFeatureConfig> p_i49917_1_, boolean p_i49917_2_, boolean p_i49917_3_) { - super(p_i49917_1_, p_i49917_2_); - this.field_150531_a = p_i49917_3_; -+ this.setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v); - } - - public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { -@@ -27,7 +28,7 @@ - } - - boolean flag = true; -- if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { - for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) { - int k = 1; - if (j == p_208519_4_.func_177956_o()) { -@@ -42,7 +43,7 @@ - - for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) { - for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) { -- if (j >= 0 && j < 256) { -+ if (j >= 0 && j < p_208519_2_.getMaxHeight()) { - if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { - flag = false; - } -@@ -55,8 +56,8 @@ - - if (!flag) { - return false; -- } else if (func_214585_i(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ } else if ((isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling())) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - - for(int l1 = p_208519_4_.func_177956_o() - 3 + i; l1 <= p_208519_4_.func_177956_o() + i; ++l1) { - int j2 = l1 - (p_208519_4_.func_177956_o() + i); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BonusChestFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BonusChestFeature.java.patch deleted file mode 100644 index deb19b38d..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/BonusChestFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/BonusChestFeature.java -+++ b/net/minecraft/world/gen/feature/BonusChestFeature.java -@@ -20,7 +20,7 @@ - } - - public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { -- for(BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_); (blockstate.func_196958_f() || blockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 1; blockstate = p_212245_1_.func_180495_p(p_212245_4_)) { -+ for(BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_); (blockstate.isAir(p_212245_1_, p_212245_4_) || blockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 1; blockstate = p_212245_1_.func_180495_p(p_212245_4_)) { - p_212245_4_ = p_212245_4_.func_177977_b(); - } - diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BushFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BushFeature.java.patch deleted file mode 100644 index e980e266d..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/BushFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/BushFeature.java -+++ b/net/minecraft/world/gen/feature/BushFeature.java -@@ -20,7 +20,7 @@ - - for(int j = 0; j < 64; ++j) { - BlockPos blockpos = p_212245_4_.func_177982_a(p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8), p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8)); -- if (p_212245_1_.func_175623_d(blockpos) && (!p_212245_1_.func_201675_m().func_177495_o() || blockpos.func_177956_o() < 255) && blockstate.func_196955_c(p_212245_1_, blockpos)) { -+ if (p_212245_1_.func_175623_d(blockpos) && (!p_212245_1_.func_201675_m().func_177495_o() || blockpos.func_177956_o() < p_212245_1_.func_201672_e().func_201675_m().getHeight()) && blockstate.func_196955_c(p_212245_1_, blockpos)) { - p_212245_1_.func_180501_a(blockpos, blockstate, 2); - ++i; - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch index fb259e793..098ee4558 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch @@ -1,31 +1,26 @@ --- a/net/minecraft/world/gen/feature/DarkOakTreeFeature.java +++ b/net/minecraft/world/gen/feature/DarkOakTreeFeature.java -@@ -18,6 +18,7 @@ - - public DarkOakTreeFeature(Function, ? extends NoFeatureConfig> p_i49895_1_, boolean p_i49895_2_) { - super(p_i49895_1_, p_i49895_2_); -+ setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196680_y); - } - - public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { -@@ -27,15 +28,15 @@ - int l = p_208519_4_.func_177952_p(); - if (k >= 1 && k + i + 1 < 256) { - BlockPos blockpos = p_208519_4_.func_177977_b(); -- if (!func_214589_h(p_208519_2_, blockpos)) { -+ if (!isSoil(p_208519_2_, blockpos, getSapling())) { +@@ -20,17 +20,17 @@ + int j = p_225557_3_.func_177958_n(); + int k = p_225557_3_.func_177956_o(); + int l = p_225557_3_.func_177952_p(); +- if (k >= 1 && k + i + 1 < 256) { ++ if (k >= 1 && k + i + 1 < p_225557_1_.getMaxHeight()) { + BlockPos blockpos = p_225557_3_.func_177977_b(); +- if (!func_214589_h(p_225557_1_, blockpos)) { ++ if (!isSoil(p_225557_1_, blockpos, p_225557_7_.getSapling())) { return false; - } else if (!this.func_214615_a(p_208519_2_, p_208519_4_, i)) { + } else if (!this.func_214615_a(p_225557_1_, p_225557_3_, i)) { return false; } else { -- this.func_214584_a(p_208519_2_, blockpos); -- this.func_214584_a(p_208519_2_, blockpos.func_177974_f()); -- this.func_214584_a(p_208519_2_, blockpos.func_177968_d()); -- this.func_214584_a(p_208519_2_, blockpos.func_177968_d().func_177974_f()); -+ this.setDirtAt(p_208519_2_, blockpos, p_208519_4_); -+ this.setDirtAt(p_208519_2_, blockpos.func_177974_f(), p_208519_4_); -+ this.setDirtAt(p_208519_2_, blockpos.func_177968_d(), p_208519_4_); -+ this.setDirtAt(p_208519_2_, blockpos.func_177968_d().func_177974_f(), p_208519_4_); - Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_208519_3_); - int i1 = i - p_208519_3_.nextInt(4); - int j1 = 2 - p_208519_3_.nextInt(3); +- this.func_214584_a(p_225557_1_, blockpos); +- this.func_214584_a(p_225557_1_, blockpos.func_177974_f()); +- this.func_214584_a(p_225557_1_, blockpos.func_177968_d()); +- this.func_214584_a(p_225557_1_, blockpos.func_177968_d().func_177974_f()); ++ this.setDirtAt(p_225557_1_, blockpos, p_225557_3_); ++ this.setDirtAt(p_225557_1_, blockpos.func_177974_f(), p_225557_3_); ++ this.setDirtAt(p_225557_1_, blockpos.func_177968_d(), p_225557_3_); ++ this.setDirtAt(p_225557_1_, blockpos.func_177968_d().func_177974_f(), p_225557_3_); + Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_225557_2_); + int i1 = i - p_225557_2_.nextInt(4); + int j1 = 2 - p_225557_2_.nextInt(3); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/DeadBushFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/DeadBushFeature.java.patch deleted file mode 100644 index b21bda1d6..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/DeadBushFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/DeadBushFeature.java -+++ b/net/minecraft/world/gen/feature/DeadBushFeature.java -@@ -20,7 +20,7 @@ - } - - public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { -- for(BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_); (blockstate.func_196958_f() || blockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate = p_212245_1_.func_180495_p(p_212245_4_)) { -+ for(BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_); (blockstate.isAir(p_212245_1_, p_212245_4_) || blockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate = p_212245_1_.func_180495_p(p_212245_4_)) { - p_212245_4_ = p_212245_4_.func_177977_b(); - } - diff --git a/patches/minecraft/net/minecraft/world/gen/feature/DoublePlantFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/DoublePlantFeature.java.patch deleted file mode 100644 index 990d6bef0..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/DoublePlantFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/DoublePlantFeature.java -+++ b/net/minecraft/world/gen/feature/DoublePlantFeature.java -@@ -19,7 +19,7 @@ - - for(int i = 0; i < 64; ++i) { - BlockPos blockpos = p_212245_4_.func_177982_a(p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8), p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8)); -- if (p_212245_1_.func_175623_d(blockpos) && blockpos.func_177956_o() < 254 && p_212245_5_.field_202435_a.func_196955_c(p_212245_1_, blockpos)) { -+ if (p_212245_1_.func_175623_d(blockpos) && blockpos.func_177956_o() < p_212245_1_.func_201672_e().func_201675_m().getHeight() - 2 && p_212245_5_.field_202435_a.func_196955_c(p_212245_1_, blockpos)) { - ((DoublePlantBlock)p_212245_5_.field_202435_a.func_177230_c()).func_196390_a(p_212245_1_, blockpos, 2); - flag = true; - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch index 6a635c4a5..10fb17c5c 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch @@ -1,21 +1,52 @@ --- a/net/minecraft/world/gen/feature/Feature.java +++ b/net/minecraft/world/gen/feature/Feature.java -@@ -44,7 +44,7 @@ +@@ -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(PillagerOutpostConfig::func_214642_a)); + 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)); -@@ -137,7 +137,8 @@ - public static final Feature field_214485_aM = func_214468_a("sweet_berry_bush", new ScatteredPlantFeature(NoFeatureConfig::func_214639_a, Blocks.field_222434_lW.func_176223_P().func_206870_a(SweetBerryBushBlock.field_220125_a, Integer.valueOf(3)))); - public static final Feature field_214486_aN = func_214468_a("fill_layer", new FillLayerFeature(FillLayerConfig::func_214635_a)); - public static final BonusChestFeature field_214487_aO = func_214468_a("bonus_chest", new BonusChestFeature(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/minecraft/net/minecraft/world/gen/feature/FlowersFeature.java.patch new file mode 100644 index 000000000..a63563c91 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/FlowersFeature.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/feature/FlowersFeature.java ++++ b/net/minecraft/world/gen/feature/FlowersFeature.java +@@ -20,7 +20,7 @@ + + for(int j = 0; j < this.func_225560_a_(p_212245_5_); ++j) { + BlockPos blockpos = this.func_225561_a_(p_212245_3_, p_212245_4_, p_212245_5_); +- if (p_212245_1_.func_175623_d(blockpos) && blockpos.func_177956_o() < 255 && blockstate.func_196955_c(p_212245_1_, blockpos) && this.func_225559_a_(p_212245_1_, blockpos, p_212245_5_)) { ++ if (p_212245_1_.func_175623_d(blockpos) && blockpos.func_177956_o() < p_212245_1_.getMaxHeight() - 1 && blockstate.func_196955_c(p_212245_1_, blockpos) && this.func_225559_a_(p_212245_1_, blockpos, p_212245_5_)) { + p_212245_1_.func_180501_a(blockpos, blockstate, 2); + ++i; + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java.patch new file mode 100644 index 000000000..168bc6fef --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java.patch @@ -0,0 +1,46 @@ +--- a/net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java ++++ b/net/minecraft/world/gen/feature/HugeTreeFeatureConfig.java +@@ -23,11 +23,27 @@ + return dynamic.merge(super.func_214634_a(p_214634_1_)); + } + ++ @Override ++ protected HugeTreeFeatureConfig setSapling(net.minecraftforge.common.IPlantable value) { ++ super.setSapling(value); ++ return this; ++ } ++ + public static HugeTreeFeatureConfig func_227277_a_(Dynamic p_227277_0_) { + BaseTreeFeatureConfig basetreefeatureconfig = BaseTreeFeatureConfig.func_227376_b_(p_227277_0_); + return new HugeTreeFeatureConfig(basetreefeatureconfig.field_227368_m_, basetreefeatureconfig.field_227369_n_, basetreefeatureconfig.field_227370_o_, basetreefeatureconfig.field_227371_p_, p_227277_0_.get("height_interval").asInt(0), p_227277_0_.get("crown_height").asInt(0)); + } + ++ public static HugeTreeFeatureConfig deserializeDarkOak(Dynamic data) { ++ return func_227277_a_(data).setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196680_y); ++ } ++ public static HugeTreeFeatureConfig deserializeSpruce(Dynamic data) { ++ return func_227277_a_(data).setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196675_u); ++ } ++ public static HugeTreeFeatureConfig deserializeJungle(Dynamic data) { ++ return func_227277_a_(data).setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196678_w); ++ } ++ + public static class Builder extends BaseTreeFeatureConfig.Builder { + private List field_227278_c_ = ImmutableList.of(); + private int field_227279_d_; +@@ -58,8 +74,14 @@ + return this; + } + ++ @Override ++ public HugeTreeFeatureConfig.Builder setSapling(net.minecraftforge.common.IPlantable value) { ++ super.setSapling(value); ++ return this; ++ } ++ + public HugeTreeFeatureConfig func_225568_b_() { +- return new HugeTreeFeatureConfig(this.field_227377_a_, this.field_227378_b_, this.field_227278_c_, this.field_227279_d_, this.field_227280_e_, this.field_227281_f_); ++ return new HugeTreeFeatureConfig(this.field_227377_a_, this.field_227378_b_, this.field_227278_c_, this.field_227279_d_, this.field_227280_e_, this.field_227281_f_).setSapling(this.sapling); + } + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch index 3cfad63e0..4dda8c87d 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch @@ -1,14 +1,6 @@ --- a/net/minecraft/world/gen/feature/HugeTreesFeature.java +++ b/net/minecraft/world/gen/feature/HugeTreesFeature.java -@@ -22,6 +22,7 @@ - this.field_150538_d = p_i51481_4_; - this.field_76520_b = p_i51481_5_; - this.field_76521_c = p_i51481_6_; -+ setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196674_t); - } - - protected int func_150533_a(Random p_150533_1_) { -@@ -35,7 +36,7 @@ +@@ -25,7 +25,7 @@ private boolean func_175926_c(IWorldGenerationBaseReader p_175926_1_, BlockPos p_175926_2_, int p_175926_3_) { boolean flag = true; @@ -17,7 +9,7 @@ for(int i = 0; i <= 1 + p_175926_3_; ++i) { int j = 2; if (i == 0) { -@@ -46,7 +47,7 @@ +@@ -36,7 +36,7 @@ for(int k = -j; k <= j && flag; ++k) { for(int l = -j; l <= j && flag; ++l) { @@ -26,17 +18,19 @@ flag = false; } } -@@ -61,11 +62,12 @@ +@@ -49,23 +49,28 @@ + } + } - private boolean func_202405_b(IWorldGenerationReader p_202405_1_, BlockPos p_202405_2_) { +- private boolean func_202405_b(IWorldGenerationReader p_202405_1_, BlockPos p_202405_2_) { ++ private boolean validSoil(IWorldGenerationReader p_202405_1_, BlockPos p_202405_2_, net.minecraftforge.common.IPlantable sapling) { BlockPos blockpos = p_202405_2_.func_177977_b(); - if (func_214589_h(p_202405_1_, blockpos) && p_202405_2_.func_177956_o() >= 2) { - this.func_214584_a(p_202405_1_, blockpos); - this.func_214584_a(p_202405_1_, blockpos.func_177974_f()); - this.func_214584_a(p_202405_1_, blockpos.func_177968_d()); - this.func_214584_a(p_202405_1_, blockpos.func_177968_d().func_177974_f()); -+ -+ if (isSoil(p_202405_1_, blockpos, getSapling()) && p_202405_2_.func_177956_o() >= 2) { ++ if (isSoil(p_202405_1_, blockpos, sapling) && p_202405_2_.func_177956_o() >= 2) { + setDirtAt(p_202405_1_, blockpos, p_202405_2_); + setDirtAt(p_202405_1_, blockpos.func_177974_f(), p_202405_2_); + setDirtAt(p_202405_1_, blockpos.func_177968_d(), p_202405_2_); @@ -44,3 +38,19 @@ return true; } else { return false; + } + } + ++ @Deprecated //Forge: Use config sensitive version + protected boolean func_203427_a(IWorldGenerationReader p_203427_1_, BlockPos p_203427_2_, int p_203427_3_) { +- return this.func_175926_c(p_203427_1_, p_203427_2_, p_203427_3_) && this.func_202405_b(p_203427_1_, p_203427_2_); ++ return this.func_175926_c(p_203427_1_, p_203427_2_, p_203427_3_) && this.validSoil(p_203427_1_, p_203427_2_, (net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196674_t); + } + ++ protected boolean hasRoom(IWorldGenerationReader world, BlockPos pos, int height, BaseTreeFeatureConfig config) { ++ return this.func_175926_c(world, pos, height) && this.validSoil(world, pos, config.getSapling()); ++ } ++ + protected void func_227255_a_(IWorldGenerationReader p_227255_1_, Random p_227255_2_, BlockPos p_227255_3_, int p_227255_4_, Set p_227255_5_, MutableBoundingBox p_227255_6_, BaseTreeFeatureConfig p_227255_7_) { + int i = p_227255_4_ * p_227255_4_; + 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 af07d03c1..d156b86a5 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch @@ -4,16 +4,16 @@ 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() || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { -+ if (blockstate.isAir(p_212245_1_, p_212245_4_.func_177982_a(i1, k, j1)) || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { +- 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() || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { -+ if (blockstate.isAir(p_212245_1_, p_212245_4_.func_177982_a(i1, -k, j1)) || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { +- 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()); } } @@ -21,8 +21,8 @@ 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() && !Block.func_196245_f(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { -+ if (!blockstate1.isAir(p_212245_1_, blockpos) && !Block.func_196245_f(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { +- 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/JungleGrassFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/JungleGrassFeature.java.patch deleted file mode 100644 index 1a5b0b670..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/JungleGrassFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/JungleGrassFeature.java -+++ b/net/minecraft/world/gen/feature/JungleGrassFeature.java -@@ -23,7 +23,7 @@ - public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { - BlockState blockstate = this.func_202357_a(p_212245_3_); - -- for(BlockState blockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (blockstate1.func_196958_f() || blockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { -+ for(BlockState blockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (blockstate1.isAir(p_212245_1_, p_212245_4_) || blockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { - p_212245_4_ = p_212245_4_.func_177977_b(); - } - diff --git a/patches/minecraft/net/minecraft/world/gen/feature/JungleTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/JungleTreeFeature.java.patch deleted file mode 100644 index da13ab62d..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/JungleTreeFeature.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/gen/feature/JungleTreeFeature.java -+++ b/net/minecraft/world/gen/feature/JungleTreeFeature.java -@@ -8,6 +8,7 @@ - public class JungleTreeFeature extends TreeFeature { - public JungleTreeFeature(Function, ? extends NoFeatureConfig> p_i51488_1_, boolean p_i51488_2_, int p_i51488_3_, BlockState p_i51488_4_, BlockState p_i51488_5_, boolean p_i51488_6_) { - super(p_i51488_1_, p_i51488_2_, p_i51488_3_, p_i51488_4_, p_i51488_5_, p_i51488_6_); -+ setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196678_w); - } - - protected int func_208534_a(Random p_208534_1_) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch index a721d1a6e..a04566911 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch @@ -1,10 +1,11 @@ --- a/net/minecraft/world/gen/feature/MegaJungleFeature.java +++ b/net/minecraft/world/gen/feature/MegaJungleFeature.java -@@ -16,6 +16,7 @@ - public class MegaJungleFeature extends HugeTreesFeature { - public MegaJungleFeature(Function, ? extends NoFeatureConfig> p_i51483_1_, boolean p_i51483_2_, int p_i51483_3_, int p_i51483_4_, BlockState p_i51483_5_, BlockState p_i51483_6_) { - super(p_i51483_1_, p_i51483_2_, p_i51483_3_, p_i51483_4_, p_i51483_5_, p_i51483_6_); -+ setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196678_w); - } +@@ -16,7 +16,7 @@ - public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { + public boolean func_225557_a_(IWorldGenerationReader p_225557_1_, Random p_225557_2_, BlockPos p_225557_3_, Set p_225557_4_, Set p_225557_5_, MutableBoundingBox p_225557_6_, HugeTreeFeatureConfig p_225557_7_) { + int i = this.func_227256_a_(p_225557_2_, p_225557_7_); +- if (!this.func_203427_a(p_225557_1_, p_225557_3_, i)) { ++ if (!this.hasRoom(p_225557_1_, p_225557_3_, i, p_225557_7_)) { + return false; + } else { + this.func_227252_c_(p_225557_1_, p_225557_2_, p_225557_3_.func_177981_b(i), 2, p_225557_5_, p_225557_6_, p_225557_7_); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch index 2a5e2b491..34019a0d0 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch @@ -1,19 +1,11 @@ --- a/net/minecraft/world/gen/feature/MegaPineTree.java +++ b/net/minecraft/world/gen/feature/MegaPineTree.java -@@ -20,6 +20,7 @@ - public MegaPineTree(Function, ? extends NoFeatureConfig> p_i51482_1_, boolean p_i51482_2_, boolean p_i51482_3_) { - super(p_i51482_1_, p_i51482_2_, 13, 15, field_181633_e, field_181634_f); - this.field_150542_e = p_i51482_3_; -+ setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u); - } +@@ -16,7 +16,7 @@ - public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { -@@ -98,7 +99,7 @@ - private void func_175934_c(IWorldGenerationReader p_175934_1_, BlockPos p_175934_2_) { - for(int i = 2; i >= -3; --i) { - BlockPos blockpos = p_175934_2_.func_177981_b(i); -- if (func_214589_h(p_175934_1_, blockpos)) { -+ if (isSoil(p_175934_1_, blockpos, getSapling())) { - this.func_202278_a(p_175934_1_, blockpos, field_181635_g); - break; - } + public boolean func_225557_a_(IWorldGenerationReader p_225557_1_, Random p_225557_2_, BlockPos p_225557_3_, Set p_225557_4_, Set p_225557_5_, MutableBoundingBox p_225557_6_, HugeTreeFeatureConfig p_225557_7_) { + int i = this.func_227256_a_(p_225557_2_, p_225557_7_); +- if (!this.func_203427_a(p_225557_1_, p_225557_3_, i)) { ++ if (!this.hasRoom(p_225557_1_, p_225557_3_, i, p_225557_7_)) { + return false; + } else { + this.func_227253_a_(p_225557_1_, p_225557_2_, p_225557_3_.func_177958_n(), p_225557_3_.func_177952_p(), p_225557_3_.func_177956_o() + i, 0, p_225557_5_, p_225557_6_, p_225557_7_); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/NetherSpringFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/NetherSpringFeature.java.patch deleted file mode 100644 index 9e627f496..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/NetherSpringFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/NetherSpringFeature.java -+++ b/net/minecraft/world/gen/feature/NetherSpringFeature.java -@@ -21,7 +21,7 @@ - public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, HellLavaConfig p_212245_5_) { - if (p_212245_1_.func_180495_p(p_212245_4_.func_177984_a()) != field_214552_a) { - return false; -- } else if (!p_212245_1_.func_180495_p(p_212245_4_).func_196958_f() && p_212245_1_.func_180495_p(p_212245_4_) != field_214552_a) { -+ } else if (!p_212245_1_.func_180495_p(p_212245_4_).isAir(p_212245_1_, p_212245_4_) && p_212245_1_.func_180495_p(p_212245_4_) != field_214552_a) { - return false; - } else { - int i = 0; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java.patch deleted file mode 100644 index 81e5f6d14..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java -+++ b/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java -@@ -16,6 +16,7 @@ - - public PointyTaigaTreeFeature(Function, ? extends NoFeatureConfig> p_i51469_1_) { - super(p_i51469_1_, false); -+ setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u); - } - - public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { -@@ -23,7 +24,7 @@ - int j = i - p_208519_3_.nextInt(2) - 3; - int k = i - j; - int l = 1 + p_208519_3_.nextInt(k + 1); -- if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { - boolean flag = true; - - for(int i1 = p_208519_4_.func_177956_o(); i1 <= p_208519_4_.func_177956_o() + 1 + i && flag; ++i1) { -@@ -38,7 +39,7 @@ - - for(int k1 = p_208519_4_.func_177958_n() - j1; k1 <= p_208519_4_.func_177958_n() + j1 && flag; ++k1) { - for(int l1 = p_208519_4_.func_177952_p() - j1; l1 <= p_208519_4_.func_177952_p() + j1 && flag; ++l1) { -- if (i1 >= 0 && i1 < 256) { -+ if (i1 >= 0 && i1 < p_208519_2_.getMaxHeight()) { - if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) { - flag = false; - } -@@ -51,8 +52,8 @@ - - if (!flag) { - return false; -- } else if (func_214589_h(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - int j2 = 0; - - for(int k2 = p_208519_4_.func_177956_o() + i; k2 >= p_208519_4_.func_177956_o() + j; --k2) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/SavannaTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/SavannaTreeFeature.java.patch deleted file mode 100644 index 84c936716..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/SavannaTreeFeature.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/net/minecraft/world/gen/feature/SavannaTreeFeature.java -+++ b/net/minecraft/world/gen/feature/SavannaTreeFeature.java -@@ -23,7 +23,7 @@ - public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { - int i = p_208519_3_.nextInt(3) + p_208519_3_.nextInt(3) + 5; - boolean flag = true; -- if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { - for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) { - int k = 1; - if (j == p_208519_4_.func_177956_o()) { -@@ -38,7 +38,7 @@ - - for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) { - for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) { -- if (j >= 0 && j < 256) { -+ if (j >= 0 && j < p_208519_2_.getMaxHeight()) { - if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { - flag = false; - } -@@ -51,8 +51,8 @@ - - if (!flag) { - return false; -- } else if (func_214589_h(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_208519_3_); - int k2 = i - p_208519_3_.nextInt(4) - 1; - int l2 = 3 - p_208519_3_.nextInt(3); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch index b0928f588..c082cb82e 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch @@ -1,16 +1,11 @@ --- a/net/minecraft/world/gen/feature/ShrubFeature.java +++ b/net/minecraft/world/gen/feature/ShrubFeature.java -@@ -18,11 +18,12 @@ - super(p_i49868_1_, false); - this.field_150527_b = p_i49868_2_; - this.field_150528_a = p_i49868_3_; -+ setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196678_w); - } +@@ -16,7 +16,7 @@ - public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { - p_208519_4_ = p_208519_2_.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, p_208519_4_).func_177977_b(); -- if (func_214589_h(p_208519_2_, p_208519_4_)) { -+ if (isSoil(p_208519_2_, p_208519_4_, getSapling())) { - p_208519_4_ = p_208519_4_.func_177984_a(); - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_, this.field_150527_b, p_208519_5_); + public boolean func_225557_a_(IWorldGenerationReader p_225557_1_, Random p_225557_2_, BlockPos p_225557_3_, Set p_225557_4_, Set p_225557_5_, MutableBoundingBox p_225557_6_, BaseTreeFeatureConfig p_225557_7_) { + p_225557_3_ = p_225557_1_.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, p_225557_3_).func_177977_b(); +- if (func_214589_h(p_225557_1_, p_225557_3_)) { ++ if (isSoil(p_225557_1_, p_225557_3_, p_225557_7_.getSapling())) { + p_225557_3_ = p_225557_3_.func_177984_a(); + this.func_227216_a_(p_225557_1_, p_225557_2_, p_225557_3_, p_225557_4_, p_225557_6_, p_225557_7_); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch index 98cad8742..8cd95c2b5 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/feature/SpringFeature.java +++ b/net/minecraft/world/gen/feature/SpringFeature.java -@@ -22,7 +22,7 @@ +@@ -21,7 +21,7 @@ return false; } else { BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_); -- if (!blockstate.func_196958_f() && !Block.func_196252_e(blockstate.func_177230_c())) { -+ if (!blockstate.isAir(p_212245_1_, p_212245_4_) && !Block.func_196252_e(blockstate.func_177230_c())) { +- if (!blockstate.func_196958_f() && !p_212245_5_.field_227366_f_.contains(blockstate.func_177230_c())) { ++ if (!blockstate.isAir(p_212245_1_, p_212245_4_) && !p_212245_5_.field_227366_f_.contains(blockstate.func_177230_c())) { return false; } else { int i = 0; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/SwampTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/SwampTreeFeature.java.patch deleted file mode 100644 index 0896c9a67..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/SwampTreeFeature.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/net/minecraft/world/gen/feature/SwampTreeFeature.java -+++ b/net/minecraft/world/gen/feature/SwampTreeFeature.java -@@ -25,7 +25,7 @@ - int i = p_208519_3_.nextInt(4) + 5; - p_208519_4_ = p_208519_2_.func_205770_a(Heightmap.Type.OCEAN_FLOOR, p_208519_4_); - boolean flag = true; -- if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { - for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) { - int k = 1; - if (j == p_208519_4_.func_177956_o()) { -@@ -40,7 +40,7 @@ - - for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) { - for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) { -- if (j >= 0 && j < 256) { -+ if (j >= 0 && j < p_208519_2_.getMaxHeight()) { - blockpos$mutableblockpos.func_181079_c(l, j, i1); - if (!func_214572_g(p_208519_2_, blockpos$mutableblockpos)) { - if (func_214571_e(p_208519_2_, blockpos$mutableblockpos)) { -@@ -60,8 +60,8 @@ - - if (!flag) { - return false; -- } else if (func_214589_h(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - - for(int l1 = p_208519_4_.func_177956_o() - 3 + i; l1 <= p_208519_4_.func_177956_o() + i; ++l1) { - int k2 = l1 - (p_208519_4_.func_177956_o() + i); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/TaigaGrassFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/TaigaGrassFeature.java.patch deleted file mode 100644 index e41929ab5..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/TaigaGrassFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/TaigaGrassFeature.java -+++ b/net/minecraft/world/gen/feature/TaigaGrassFeature.java -@@ -23,7 +23,7 @@ - public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { - BlockState blockstate = this.func_202388_a(p_212245_3_); - -- for(BlockState blockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (blockstate1.func_196958_f() || blockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { -+ for(BlockState blockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (blockstate1.isAir(p_212245_1_, p_212245_4_) || blockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { - p_212245_4_ = p_212245_4_.func_177977_b(); - } - diff --git a/patches/minecraft/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java.patch deleted file mode 100644 index 13d4643bb..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java -+++ b/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java -@@ -16,6 +16,7 @@ - - public TallTaigaTreeFeature(Function, ? extends NoFeatureConfig> p_i51429_1_, boolean p_i51429_2_) { - super(p_i51429_1_, p_i51429_2_); -+ setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u); - } - - public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { -@@ -24,7 +25,7 @@ - int k = i - j; - int l = 2 + p_208519_3_.nextInt(2); - boolean flag = true; -- if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { - for(int i1 = p_208519_4_.func_177956_o(); i1 <= p_208519_4_.func_177956_o() + 1 + i && flag; ++i1) { - int j1; - if (i1 - p_208519_4_.func_177956_o() < j) { -@@ -37,7 +38,7 @@ - - for(int k1 = p_208519_4_.func_177958_n() - j1; k1 <= p_208519_4_.func_177958_n() + j1 && flag; ++k1) { - for(int l1 = p_208519_4_.func_177952_p() - j1; l1 <= p_208519_4_.func_177952_p() + j1 && flag; ++l1) { -- if (i1 >= 0 && i1 < 256) { -+ if (i1 >= 0 && i1 < p_208519_2_.getMaxHeight()) { - blockpos$mutableblockpos.func_181079_c(k1, i1, l1); - if (!func_214572_g(p_208519_2_, blockpos$mutableblockpos)) { - flag = false; -@@ -51,8 +52,8 @@ - - if (!flag) { - return false; -- } else if (func_214585_i(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - int i3 = p_208519_3_.nextInt(2); - int j3 = 1; - int k3 = 0; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch index e5f2813df..1163c9f7c 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch @@ -1,31 +1,11 @@ --- a/net/minecraft/world/gen/feature/TreeFeature.java +++ b/net/minecraft/world/gen/feature/TreeFeature.java -@@ -38,7 +38,7 @@ - public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { - int i = this.func_208534_a(p_208519_3_); - boolean flag = true; -- if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { - for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) { - int k = 1; - if (j == p_208519_4_.func_177956_o()) { -@@ -53,7 +53,7 @@ - - for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) { - for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) { -- if (j >= 0 && j < 256) { -+ if (j >= 0 && j < p_208519_2_.getMaxHeight()) { - if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { - flag = false; - } -@@ -66,8 +66,8 @@ - - if (!flag) { - return false; -- } else if (func_214585_i(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - int j2 = 3; - int k2 = 0; - +@@ -23,7 +23,7 @@ + return false; + } else { + BlockPos blockpos = optional.get(); +- this.func_214584_a(p_225557_1_, blockpos.func_177977_b()); ++ this.setDirtAt(p_225557_1_, blockpos.func_177977_b(), blockpos); + p_225557_7_.field_227327_a_.func_225571_a_(p_225557_1_, p_225557_2_, p_225557_7_, i, j, k, blockpos, p_225557_5_); + this.func_227213_a_(p_225557_1_, p_225557_2_, i, blockpos, p_225557_7_.field_227332_g_ + p_225557_2_.nextInt(p_225557_7_.field_227333_h_ + 1), p_225557_4_, p_225557_6_, p_225557_7_); + return true; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/TreeFeatureConfig.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/TreeFeatureConfig.java.patch new file mode 100644 index 000000000..41b345d3d --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/TreeFeatureConfig.java.patch @@ -0,0 +1,45 @@ +--- a/net/minecraft/world/gen/feature/TreeFeatureConfig.java ++++ b/net/minecraft/world/gen/feature/TreeFeatureConfig.java +@@ -47,12 +47,26 @@ + return dynamic.merge(super.func_214634_a(p_214634_1_)); + } + ++ @Override ++ protected TreeFeatureConfig setSapling(net.minecraftforge.common.IPlantable value) { ++ super.setSapling(value); ++ return this; ++ } ++ + public static TreeFeatureConfig func_227338_a_(Dynamic p_227338_0_) { + BaseTreeFeatureConfig basetreefeatureconfig = BaseTreeFeatureConfig.func_227376_b_(p_227338_0_); + FoliagePlacerType foliageplacertype = Registry.field_229389_v_.func_82594_a(new ResourceLocation(p_227338_0_.get("foliage_placer").get("type").asString().orElseThrow(RuntimeException::new))); + return new TreeFeatureConfig(basetreefeatureconfig.field_227368_m_, basetreefeatureconfig.field_227369_n_, foliageplacertype.func_227391_a_(p_227338_0_.get("foliage_placer").orElseEmptyMap()), basetreefeatureconfig.field_227370_o_, basetreefeatureconfig.field_227371_p_, p_227338_0_.get("height_rand_a").asInt(0), p_227338_0_.get("height_rand_b").asInt(0), p_227338_0_.get("trunk_height").asInt(-1), p_227338_0_.get("trunk_height_random").asInt(0), p_227338_0_.get("trunk_top_offset").asInt(0), p_227338_0_.get("trunk_top_offset_random").asInt(0), p_227338_0_.get("foliage_height").asInt(-1), p_227338_0_.get("foliage_height_random").asInt(0), p_227338_0_.get("max_water_depth").asInt(0), p_227338_0_.get("ignore_vines").asBoolean(false)); + } + ++ public static TreeFeatureConfig deserializeJungle(Dynamic data) { ++ return func_227338_a_(data).setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196678_w); ++ } ++ ++ public static TreeFeatureConfig deserializeAcacia(Dynamic data) { ++ return func_227338_a_(data).setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196679_x); ++ } ++ + public static class Builder extends BaseTreeFeatureConfig.Builder { + private final FoliagePlacer field_227339_c_; + private List field_227340_d_ = ImmutableList.of(); +@@ -133,8 +147,14 @@ + return this; + } + ++ @Override ++ public TreeFeatureConfig.Builder setSapling(net.minecraftforge.common.IPlantable value) { ++ super.setSapling(value); ++ return this; ++ } ++ + public TreeFeatureConfig func_225568_b_() { +- return new TreeFeatureConfig(this.field_227377_a_, this.field_227378_b_, this.field_227339_c_, this.field_227340_d_, this.field_227341_e_, this.field_227342_f_, this.field_227343_g_, this.field_227344_h_, this.field_227345_i_, this.field_227346_j_, this.field_227347_k_, this.field_227348_l_, this.field_227349_m_, this.field_227350_n_, this.field_227351_o_); ++ return new TreeFeatureConfig(this.field_227377_a_, this.field_227378_b_, this.field_227339_c_, this.field_227340_d_, this.field_227341_e_, this.field_227342_f_, this.field_227343_g_, this.field_227344_h_, this.field_227345_i_, this.field_227346_j_, this.field_227347_k_, this.field_227348_l_, this.field_227349_m_, this.field_227350_n_, this.field_227351_o_).setSapling(this.sapling); + } + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch index 8bae2413a..ecc725b9e 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/world/gen/feature/VinesFeature.java @@ -21,7 +21,7 @@ public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(p_212245_4_); + BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(p_212245_4_); - for(int i = p_212245_4_.func_177956_o(); i < 256; ++i) { + for(int i = p_212245_4_.func_177956_o(); i < p_212245_1_.func_201672_e().func_201675_m().getHeight(); ++i) { - blockpos$mutableblockpos.func_189533_g(p_212245_4_); - blockpos$mutableblockpos.func_196234_d(p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), 0, p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4)); - blockpos$mutableblockpos.func_185336_p(i); + blockpos$mutable.func_189533_g(p_212245_4_); + blockpos$mutable.func_196234_d(p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), 0, p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4)); + blockpos$mutable.func_185336_p(i); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch index 6d557cbd9..ba3f680f9 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java +++ b/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java -@@ -88,7 +88,7 @@ - if (!template.func_189962_a(p_214848_2_, p_214848_3_, placementsettings, 18)) { +@@ -89,7 +89,7 @@ + if (!template.func_189962_a(p_225575_2_, p_225575_4_, placementsettings, 18)) { return false; } else { -- for(Template.BlockInfo template$blockinfo : Template.func_215387_a(p_214848_2_, p_214848_3_, placementsettings, this.func_214857_a(p_214848_1_, p_214848_3_, p_214848_4_, false))) { -+ for(Template.BlockInfo template$blockinfo : Template.processBlockInfos(template, p_214848_2_, p_214848_3_, placementsettings, this.func_214857_a(p_214848_1_, p_214848_3_, p_214848_4_, false))) { - this.func_214846_a(p_214848_2_, template$blockinfo, p_214848_3_, p_214848_4_, p_214848_6_, p_214848_5_); +- for(Template.BlockInfo template$blockinfo : Template.func_215387_a(p_225575_2_, p_225575_4_, placementsettings, this.func_214857_a(p_225575_1_, p_225575_4_, p_225575_5_, false))) { ++ for(Template.BlockInfo template$blockinfo : Template.processBlockInfos(template, p_225575_2_, p_225575_4_, placementsettings, this.func_214857_a(p_225575_1_, p_225575_4_, p_225575_5_, false))) { + this.func_214846_a(p_225575_2_, template$blockinfo, p_225575_4_, p_225575_5_, p_225575_7_, p_225575_6_); } 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 6363e20d7..4dab4c2d6 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 -@@ -206,7 +206,7 @@ +@@ -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_)); 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 928b47db4..25ded3773 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 -@@ -55,6 +55,9 @@ +@@ -56,6 +56,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 7403f42e1..007d1d630 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 -@@ -80,6 +80,9 @@ +@@ -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()) { @@ -8,5 +8,5 @@ + 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_74778_a("biome", Registry.field_212624_m.func_177774_c(this.field_202505_e).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/minecraft/net/minecraft/world/gen/feature/structure/Structures.java.patch index 975a506dc..fdf22effb 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/Structures.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/Structures.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/gen/feature/structure/Structures.java +++ b/net/minecraft/world/gen/feature/structure/Structures.java -@@ -35,6 +35,7 @@ +@@ -32,6 +32,7 @@ public static final Structure field_215157_o = func_215141_a("Village", Feature.field_214550_p); private static Structure func_215141_a(String p_215141_0_, Structure p_215141_1_) { 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 4d5017057..8e8af4b8f 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 @@ -51,7 +51,7 @@ ; } -@@ -336,13 +346,41 @@ +@@ -336,13 +346,42 @@ return list; } @@ -62,15 +62,16 @@ + 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 entityInfo1 = new Template.EntityInfo(pos, blockpos, entityInfo.field_186249_c); ++ Template.EntityInfo info = new Template.EntityInfo(pos, blockpos, entityInfo.field_186249_c); + -+ for(Iterator iterator = p_215387_2_.func_215221_j().iterator(); entityInfo1 != null && iterator.hasNext(); entityInfo1 = iterator.next().processEntity(p_215387_0_, p_215387_1_, entityInfo, entityInfo1, p_215387_2_, template)) { -+ ; ++ 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 (entityInfo1 != null) { -+ list.add(entityInfo1); -+ } ++ if (info != null) ++ list.add(info); + } + + return list; @@ -93,5 +94,5 @@ + 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(new DoubleNBT(vec3d1.field_72450_a)); - listnbt.add(new DoubleNBT(vec3d1.field_72448_b)); + listnbt.add(DoubleNBT.func_229684_a_(vec3d1.field_72450_a)); + listnbt.add(DoubleNBT.func_229684_a_(vec3d1.field_72448_b)); 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 ed7fb2cae..eb589b5eb 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/gen/layer/BiomeLayer.java +++ b/net/minecraft/world/gen/layer/BiomeLayer.java -@@ -24,17 +24,33 @@ +@@ -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); @@ -9,13 +9,13 @@ - 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]; - private final OverworldGenSettings field_175973_g; -- private int[] field_151623_c = field_202744_r; - public BiomeLayer(WorldType p_i48641_1_, OverworldGenSettings p_i48641_2_) { -+ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) { + 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(); + @@ -29,7 +29,7 @@ + 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_i48641_1_ == WorldType.field_77136_e) { + 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)); @@ -38,10 +38,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_175973_g = null; + this.field_227472_v_ = -1; } else { - this.field_175973_g = p_i48641_2_; -@@ -55,21 +71,21 @@ + 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; } @@ -67,7 +67,7 @@ default: return field_202735_i; } -@@ -78,4 +94,11 @@ +@@ -77,4 +93,11 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch index 3102fc5ec..b47c23cbe 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/world/gen/layer/LayerUtil.java +++ b/net/minecraft/world/gen/layer/LayerUtil.java -@@ -69,12 +69,11 @@ - i = 6; - } - -+ i = getModdedBiomeSize(p_202828_0_, i); -+ - IAreaFactory lvt_7_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, iareafactory, 0, p_202828_2_); - lvt_7_1_ = StartRiverLayer.INSTANCE.func_202713_a((IExtendedNoiseRandom)p_202828_2_.apply(100L), lvt_7_1_); -- IAreaFactory lvt_8_1_ = (new BiomeLayer(p_202828_0_, p_202828_1_)).func_202713_a(p_202828_2_.apply(200L), iareafactory); -- lvt_8_1_ = AddBambooForestLayer.INSTANCE.func_202713_a((IExtendedNoiseRandom)p_202828_2_.apply(1001L), lvt_8_1_); -- lvt_8_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, lvt_8_1_, 2, p_202828_2_); -- lvt_8_1_ = EdgeBiomeLayer.INSTANCE.func_202713_a((IExtendedNoiseRandom)p_202828_2_.apply(1000L), lvt_8_1_); -+ IAreaFactory lvt_8_1_ = p_202828_0_.getBiomeLayer(iareafactory, p_202828_1_, p_202828_2_); - IAreaFactory lvt_9_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, lvt_7_1_, 2, p_202828_2_); - lvt_8_1_ = HillsLayer.INSTANCE.func_202707_a((IExtendedNoiseRandom)p_202828_2_.apply(1000L), lvt_8_1_, lvt_9_1_); - lvt_7_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, lvt_7_1_, 2, p_202828_2_); -@@ -134,6 +133,15 @@ +@@ -58,13 +58,11 @@ + iareafactory = DeepOceanLayer.INSTANCE.func_202713_a(p_227475_2_.apply(4L), iareafactory); + iareafactory = func_202829_a(1000L, ZoomLayer.NORMAL, iareafactory, 0, p_227475_2_); + int i = p_227475_0_ == WorldType.field_77135_d ? 6 : p_227475_1_.func_202200_j(); ++ i = getModdedBiomeSize(p_227475_0_, i); + int j = p_227475_1_.func_202198_k(); + IAreaFactory lvt_7_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, iareafactory, 0, p_227475_2_); + lvt_7_1_ = StartRiverLayer.INSTANCE.func_202713_a((IExtendedNoiseRandom)p_227475_2_.apply(100L), lvt_7_1_); +- IAreaFactory lvt_8_1_ = (new BiomeLayer(p_227475_0_, p_227475_1_.func_202199_l())).func_202713_a(p_227475_2_.apply(200L), iareafactory); +- lvt_8_1_ = AddBambooForestLayer.INSTANCE.func_202713_a((IExtendedNoiseRandom)p_227475_2_.apply(1001L), lvt_8_1_); +- lvt_8_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, lvt_8_1_, 2, p_227475_2_); +- lvt_8_1_ = EdgeBiomeLayer.INSTANCE.func_202713_a((IExtendedNoiseRandom)p_227475_2_.apply(1000L), lvt_8_1_); ++ IAreaFactory lvt_8_1_ = p_227475_0_.getBiomeLayer(iareafactory, p_227475_1_, p_227475_2_); + IAreaFactory lvt_9_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, lvt_7_1_, 2, p_227475_2_); + lvt_8_1_ = HillsLayer.INSTANCE.func_202707_a((IExtendedNoiseRandom)p_227475_2_.apply(1000L), lvt_8_1_, lvt_9_1_); + lvt_7_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, lvt_7_1_, 2, p_227475_2_); +@@ -120,6 +118,15 @@ } } 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 94d675b9e..edab9e71e 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 -@@ -13,7 +13,7 @@ - import net.minecraft.world.gen.feature.ConfiguredFeature; +@@ -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)); - public static final Placement field_215017_c = func_214999_a("count_heightmap_32", new SurfacePlus32(FrequencyConfig::func_214721_a)); diff --git a/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch b/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch index 5bfff89fb..d368dd39b 100644 --- a/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch +++ b/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/lighting/LevelBasedGraph.java +++ b/net/minecraft/world/lighting/LevelBasedGraph.java -@@ -210,4 +210,18 @@ +@@ -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_); @@ -9,13 +9,5 @@ + + protected int queuedUpdateSize() { + return field_215488_c.size(); -+ } -+ -+ public final void bulkCancel(java.util.function.LongPredicate pred) { -+ ((Long2ByteOpenHashMap)field_215488_c).keySet().forEach((long l) -> { -+ if (pred.test(l)) { -+ func_215479_e(l); -+ } -+ }); + } } diff --git a/patches/minecraft/net/minecraft/world/lighting/LightEngine.java.patch b/patches/minecraft/net/minecraft/world/lighting/LightEngine.java.patch index 084ebfe4d..48a8ddd6b 100644 --- a/patches/minecraft/net/minecraft/world/lighting/LightEngine.java.patch +++ b/patches/minecraft/net/minecraft/world/lighting/LightEngine.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/lighting/LightEngine.java +++ b/net/minecraft/world/lighting/LightEngine.java -@@ -216,4 +216,8 @@ +@@ -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_); } diff --git a/patches/minecraft/net/minecraft/world/lighting/SectionLightStorage.java.patch b/patches/minecraft/net/minecraft/world/lighting/SectionLightStorage.java.patch deleted file mode 100644 index caef39b99..000000000 --- a/patches/minecraft/net/minecraft/world/lighting/SectionLightStorage.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/minecraft/world/lighting/SectionLightStorage.java -+++ b/net/minecraft/world/lighting/SectionLightStorage.java -@@ -154,6 +154,11 @@ - int j = SectionPos.func_218142_c(SectionPos.func_218144_c(p_215528_2_)); - int k = SectionPos.func_218142_c(SectionPos.func_218153_d(p_215528_2_)); - -+ // FORGE: Optimize loop when lighting update count is lower than section size -+ if (p_215528_1_.queuedUpdateSize() < 16 * 16 * 16) { -+ p_215528_1_.bulkCancel(l -> SectionPos.func_218162_e(l) == p_215528_2_); -+ return; -+ } - for(int l = 0; l < 16; ++l) { - for(int i1 = 0; i1 < 16; ++i1) { - for(int j1 = 0; j1 < 16; ++j1) { diff --git a/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch b/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch index 9b6749113..c0e084527 100644 --- a/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/server/ChunkHolder.java +++ b/net/minecraft/world/server/ChunkHolder.java -@@ -135,7 +135,7 @@ +@@ -136,7 +136,7 @@ Chunk chunk = this.func_219298_c(); if (chunk != null) { this.field_219322_q |= 1 << (p_219279_2_ >> 4); @@ -9,7 +9,7 @@ short short1 = (short)(p_219279_1_ << 12 | p_219279_3_ << 8 | p_219279_2_); for(int i = 0; i < this.field_219321_p; ++i) { -@@ -144,6 +144,8 @@ +@@ -145,6 +145,8 @@ } } @@ -18,7 +18,7 @@ this.field_219320_o[this.field_219321_p++] = short1; } -@@ -166,7 +168,7 @@ +@@ -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(); @@ -27,7 +27,7 @@ this.field_219323_r = -1; } -@@ -189,20 +191,19 @@ +@@ -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); diff --git a/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch b/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch index da681c22a..2505b4686 100644 --- a/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/server/ChunkManager.java +++ b/net/minecraft/world/server/ChunkManager.java -@@ -362,6 +362,7 @@ +@@ -364,6 +364,7 @@ iprofiler.func_219895_b("chunk_unload"); if (!this.field_219255_i.func_217402_u()) { this.func_223155_b(p_219204_1_); @@ -8,7 +8,7 @@ } iprofiler.func_76319_b(); -@@ -398,6 +399,7 @@ +@@ -400,6 +401,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 +16,7 @@ } this.func_219229_a(p_219185_5_); -@@ -475,6 +477,7 @@ +@@ -477,6 +479,7 @@ if (flag) { IChunk ichunk = ChunkSerializer.func_222656_a(this.field_219255_i, this.field_219269_w, this.field_219260_n, p_223172_1_, compoundnbt); ichunk.func_177432_b(this.field_219255_i.func_82737_E()); @@ -24,7 +24,7 @@ return Either.left(ichunk); } -@@ -584,6 +587,7 @@ +@@ -586,6 +589,7 @@ if (list != null) { list.forEach(chunk::func_76622_b); } @@ -32,7 +32,7 @@ } return chunk; -@@ -668,6 +672,7 @@ +@@ -670,6 +674,7 @@ } CompoundNBT compoundnbt1 = ChunkSerializer.func_222645_a(this.field_219255_i, p_219229_1_); @@ -40,7 +40,7 @@ this.func_219100_a(chunkpos, compoundnbt1); return true; } catch (Exception exception) { -@@ -804,6 +809,7 @@ +@@ -806,6 +811,7 @@ for(int l = i - this.field_219247_A; l <= i + this.field_219247_A; ++l) { for(int k = j - this.field_219247_A; k <= j + this.field_219247_A; ++k) { ChunkPos chunkpos = new ChunkPos(l, k); diff --git a/patches/minecraft/net/minecraft/world/ServerMultiWorld.java.patch b/patches/minecraft/net/minecraft/world/server/ServerMultiWorld.java.patch similarity index 89% rename from patches/minecraft/net/minecraft/world/ServerMultiWorld.java.patch rename to patches/minecraft/net/minecraft/world/server/ServerMultiWorld.java.patch index 530db1a68..1976de8a6 100644 --- a/patches/minecraft/net/minecraft/world/ServerMultiWorld.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ServerMultiWorld.java.patch @@ -1,11 +1,12 @@ ---- a/net/minecraft/world/ServerMultiWorld.java -+++ b/net/minecraft/world/ServerMultiWorld.java -@@ -11,11 +11,18 @@ +--- a/net/minecraft/world/server/ServerMultiWorld.java ++++ b/net/minecraft/world/server/ServerMultiWorld.java +@@ -10,11 +10,19 @@ import net.minecraft.world.storage.SaveHandler; public class ServerMultiWorld extends ServerWorld { + private final ServerWorld delegate; + private final IBorderListener borderListener; ++ public ServerMultiWorld(ServerWorld p_i50708_1_, MinecraftServer p_i50708_2_, Executor p_i50708_3_, SaveHandler p_i50708_4_, DimensionType p_i50708_5_, IProfiler p_i50708_6_, IChunkStatusListener p_i50708_7_) { super(p_i50708_2_, p_i50708_3_, p_i50708_4_, new DerivedWorldInfo(p_i50708_1_.func_72912_H()), p_i50708_5_, p_i50708_6_, p_i50708_7_); - p_i50708_1_.func_175723_af().func_177737_a(new IBorderListener.Impl(this.func_175723_af())); diff --git a/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch b/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch index 3db739d5e..d00a51dbc 100644 --- a/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/server/ServerWorld.java +++ b/net/minecraft/world/server/ServerWorld.java -@@ -134,7 +134,7 @@ +@@ -137,7 +137,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,13 +9,12 @@ 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<>(); -@@ -160,10 +160,14 @@ +@@ -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(); -+ public List customTeleporters = new java.util.ArrayList<>(); + private net.minecraftforge.common.util.WorldCapabilityData capabilityData; public ServerWorld(MinecraftServer p_i50703_1_, Executor p_i50703_2_, SaveHandler p_i50703_3_, WorldInfo p_i50703_4_, DimensionType p_i50703_5_, IProfiler p_i50703_6_, IChunkStatusListener p_i50703_7_) { @@ -25,15 +24,15 @@ return p_i50703_1_.func_71218_a(DimensionType.field_223227_a_).func_217481_x(); }); }, p_i50703_6_, false); -@@ -181,6 +185,7 @@ +@@ -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 void func_72835_b(BooleanSupplier p_72835_1_) { -@@ -190,6 +195,7 @@ + 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(); @@ -41,7 +40,7 @@ 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(); -@@ -251,6 +257,7 @@ +@@ -258,6 +263,7 @@ this.field_73004_o = MathHelper.func_76131_a(this.field_73004_o, 0.0F, 1.0F); } @@ -49,7 +48,7 @@ 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()); -@@ -260,15 +267,19 @@ +@@ -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()); } @@ -73,7 +72,7 @@ } if (this.func_72912_H().func_76093_s() && this.func_175659_aa() != Difficulty.HARD) { -@@ -280,8 +291,8 @@ +@@ -287,8 +297,8 @@ })) { this.field_73068_P = false; if (this.func_82736_K().func_223586_b(GameRules.field_223607_j)) { @@ -83,24 +82,16 @@ + this.func_72877_b(net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, l - l % 24000L, this.func_72820_D())); } - this.field_217491_A.stream().filter(LivingEntity::func_70608_bn).forEach((p_217444_0_) -> { -@@ -304,6 +315,7 @@ - - iprofiler.func_219895_b("portalForcer"); - this.field_85177_Q.func_85189_a(this.func_82737_E()); -+ customTeleporters.forEach(t -> t.func_85189_a(func_82737_E())); - iprofiler.func_219895_b("raid"); - this.field_217494_c.func_215171_a(); - if (this.field_217496_L != null) { -@@ -327,6 +339,7 @@ + this.func_229856_ab_(); +@@ -330,6 +340,7 @@ Entity entity = this.field_217497_w.get(i1); - this.func_217390_a((p_217473_0_) -> { - ++p_217473_0_.field_70173_aa; -+ if (p_217473_0_.canUpdate()) - p_217473_0_.func_70071_h_(); + 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) { -@@ -386,7 +399,7 @@ +@@ -395,7 +406,7 @@ if (entity2.field_70128_L) { this.func_217454_n(entity2); objectiterator.remove(); @@ -109,7 +100,7 @@ } iprofiler.func_76319_b(); -@@ -403,7 +416,7 @@ +@@ -418,7 +429,7 @@ int j = chunkpos.func_180333_d(); IProfiler iprofiler = this.func_217381_Z(); iprofiler.func_76320_a("thunder"); @@ -118,7 +109,7 @@ 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); -@@ -421,10 +434,11 @@ +@@ -436,10 +447,11 @@ } iprofiler.func_219895_b("iceandsnow"); @@ -126,12 +117,12 @@ + if (this.field_73011_w.canDoRainSnowIce(p_217441_1_) && this.field_73012_v.nextInt(16) == 0) { BlockPos blockpos2 = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, this.func_217383_a(i, 0, j, 15)); BlockPos blockpos3 = blockpos2.func_177977_b(); - Biome biome = this.func_180494_b(blockpos2); + 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()); } -@@ -511,10 +525,7 @@ +@@ -526,10 +538,7 @@ } private void func_73051_P() { @@ -143,7 +134,7 @@ } @OnlyIn(Dist.CLIENT) -@@ -527,7 +538,7 @@ +@@ -542,7 +551,7 @@ int j = this.field_72986_A.func_76074_e(); int k = 0; @@ -152,7 +143,7 @@ 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; -@@ -570,8 +581,9 @@ +@@ -583,8 +592,9 @@ if (p_217479_1_.field_70175_ag) { ++p_217479_1_.field_70173_aa; this.func_217381_Z().func_194340_a(() -> { @@ -163,7 +154,7 @@ p_217479_1_.func_70071_h_(); this.func_217381_Z().func_76319_b(); } -@@ -633,6 +645,11 @@ +@@ -644,6 +654,11 @@ } public boolean func_175660_a(PlayerEntity p_175660_1_, BlockPos p_175660_2_) { @@ -175,15 +166,15 @@ 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_); } -@@ -642,6 +659,7 @@ +@@ -653,6 +668,7 @@ } else if (this.field_72986_A.func_76067_t() == WorldType.field_180272_g) { this.field_72986_A.func_176143_a(BlockPos.field_177992_a.func_177984_a()); } else { + if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; - BiomeProvider biomeprovider = this.field_73020_y.func_201711_g().func_202090_b(); + 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()); -@@ -724,6 +742,7 @@ +@@ -726,6 +742,7 @@ p_217445_1_.func_200209_c(new TranslationTextComponent("menu.savingChunks")); } @@ -191,7 +182,7 @@ serverchunkprovider.func_217210_a(p_217445_2_); } } -@@ -799,7 +818,7 @@ +@@ -801,7 +818,7 @@ } } @@ -200,7 +191,7 @@ if (entityclassification != EntityClassification.MISC && this.func_72863_F().func_223435_b(entity)) { object2intmap.mergeInt(entityclassification, 1, Integer::sum); } -@@ -841,6 +860,7 @@ +@@ -843,6 +860,7 @@ } private void func_217448_f(ServerPlayerEntity p_217448_1_) { @@ -208,15 +199,15 @@ 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()); -@@ -865,6 +885,7 @@ +@@ -867,6 +885,7 @@ } else if (this.func_217478_l(p_72838_1_)) { return false; } else { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this))) return false; - IChunk ichunk = this.func_217353_a(MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D), MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D), ChunkStatus.field_222617_m, p_72838_1_.field_98038_p); + 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; -@@ -880,6 +901,7 @@ +@@ -882,6 +901,7 @@ if (this.func_217478_l(p_217440_1_)) { return false; } else { @@ -224,7 +215,7 @@ this.func_217465_m(p_217440_1_); return true; } -@@ -915,12 +937,17 @@ +@@ -917,12 +937,17 @@ } @@ -243,7 +234,7 @@ this.field_175741_N.remove(p_217484_1_.func_110124_au()); this.func_72863_F().func_217226_b(p_217484_1_); -@@ -934,6 +961,7 @@ +@@ -936,6 +961,7 @@ this.field_217495_I.remove(((MobEntity)p_217484_1_).func_70661_as()); } @@ -251,7 +242,7 @@ } private void func_217465_m(Entity p_217465_1_) { -@@ -954,15 +982,19 @@ +@@ -956,15 +982,19 @@ } } @@ -263,7 +254,7 @@ + } + public void removeEntity(Entity p_217467_1_, boolean keepData) { if (this.field_217492_a) { - throw new IllegalStateException("Removing entity while ticking!"); + 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()); @@ -272,7 +263,7 @@ } } -@@ -975,8 +1007,11 @@ +@@ -977,8 +1007,11 @@ } public void func_217434_e(ServerPlayerEntity p_217434_1_) { @@ -286,7 +277,7 @@ this.func_72854_c(); } -@@ -1000,10 +1035,20 @@ +@@ -1002,10 +1035,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_) { @@ -304,21 +295,22 @@ + p_217384_3_ = event.getSound(); + p_217384_4_ = event.getCategory(); + p_217384_5_ = event.getVolume(); - this.field_73061_a.func_184103_al().func_148543_a(p_217384_1_, p_217384_2_.field_70165_t, p_217384_2_.field_70163_u, p_217384_2_.field_70161_v, p_217384_5_ > 1.0F ? (double)(16.0F * p_217384_5_) : 16.0D, this.field_73011_w.func_186058_p(), new SSpawnMovingSoundEffectPacket(p_217384_3_, p_217384_4_, p_217384_2_, p_217384_5_, p_217384_6_)); + 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_)); } -@@ -1039,6 +1084,7 @@ +@@ -1041,6 +1084,7 @@ - public Explosion func_217401_a(@Nullable Entity p_217401_1_, DamageSource p_217401_2_, double p_217401_3_, double p_217401_5_, double p_217401_7_, float p_217401_9_, boolean p_217401_10_, Explosion.Mode p_217401_11_) { + 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_); } -@@ -1289,6 +1335,17 @@ - p_217489_3_.func_213739_a(p_217489_1_, p_217489_2_); +@@ -1369,4 +1413,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); @@ -329,7 +321,4 @@ + public java.util.stream.Stream getEntities() { + return field_217498_x.values().stream(); + } -+ - public void func_225322_a(Path p_225322_1_) throws IOException { - ChunkManager chunkmanager = this.func_72863_F().field_217237_a; - + } diff --git a/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch index 5b0b68b7a..8e5841963 100644 --- a/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/spawner/AbstractSpawner.java +++ b/net/minecraft/world/spawner/AbstractSpawner.java -@@ -127,7 +127,7 @@ - entity.func_70012_b(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v, world.field_73012_v.nextFloat() * 360.0F, 0.0F); +@@ -128,7 +128,7 @@ + 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.field_70165_t, (float)entity.field_70163_u, (float)entity.field_70161_v, this)) { ++ 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; } -@@ -283,4 +283,9 @@ +@@ -285,4 +285,9 @@ public double func_177223_e() { return this.field_98284_d; } diff --git a/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch index 49e3ee844..4cba4b399 100644 --- a/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch @@ -1,44 +1,44 @@ --- a/net/minecraft/world/spawner/WorldEntitySpawner.java +++ b/net/minecraft/world/spawner/WorldEntitySpawner.java -@@ -86,7 +86,7 @@ +@@ -87,7 +87,7 @@ } if (biome$spawnlistentry == null) { -- biome$spawnlistentry = func_222264_a(chunkgenerator, p_222263_0_, p_222263_1_.field_73012_v, blockpos$mutableblockpos); -+ biome$spawnlistentry = getSpawnList(chunkgenerator, p_222263_0_, p_222263_1_.field_73012_v, blockpos$mutableblockpos, p_222263_1_); +- 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; } -@@ -99,7 +99,7 @@ +@@ -100,7 +100,7 @@ } EntityType entitytype = biome$spawnlistentry.field_200702_b; -- if (!entitytype.func_200720_b() || !func_222261_a(chunkgenerator, p_222263_0_, biome$spawnlistentry, blockpos$mutableblockpos)) { -+ if (!entitytype.func_200720_b() || !getSpawnList(chunkgenerator, p_222263_0_, biome$spawnlistentry, blockpos$mutableblockpos, p_222263_1_)) { +- 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; } -@@ -122,15 +122,17 @@ +@@ -123,15 +123,17 @@ } - mobentity.func_70012_b((double)f, (double)k, (double)f1, p_222263_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); -- if (d0 > 16384.0D && mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_222263_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_222263_1_)) { -+ int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_222263_1_, f, k, f1, null, SpawnReason.NATURAL); -+ if (canSpawn == -1 || (canSpawn == 0 && (d0 > 16384.0D && mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_222263_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_222263_1_)))) { + 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_222263_1_, f, k, f1, null, SpawnReason.NATURAL)) - ilivingentitydata = mobentity.func_213386_a(p_222263_1_, p_222263_1_.func_175649_E(new BlockPos(mobentity)), SpawnReason.NATURAL, ilivingentitydata, (CompoundNBT)null); ++ 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_222263_1_.func_217376_c(mobentity); + p_226701_1_.func_217376_c(mobentity); - if (i >= mobentity.func_70641_bl()) { + if (i >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(mobentity)) { return; } -@@ -153,13 +155,15 @@ +@@ -154,13 +156,15 @@ } @Nullable @@ -56,7 +56,7 @@ return list.isEmpty() ? false : list.contains(p_222261_2_); } -@@ -188,6 +192,13 @@ +@@ -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_)) { @@ -70,7 +70,7 @@ 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(); -@@ -198,14 +209,12 @@ +@@ -199,14 +210,12 @@ case ON_GROUND: default: BlockState blockstate1 = p_209382_1_.func_180495_p(blockpos1); @@ -86,7 +86,7 @@ } } -@@ -248,6 +257,7 @@ +@@ -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; diff --git a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch index 9e9ca3627..83666be1d 100644 --- a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/storage/WorldInfo.java +++ b/net/minecraft/world/storage/WorldInfo.java -@@ -348,6 +348,7 @@ +@@ -349,6 +349,7 @@ CompoundNBT compoundnbt1 = new CompoundNBT(); for(Entry entry : this.field_186348_N.entrySet()) { diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch index 34c13b68f..b7b53bc31 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/storage/loot/LootContext.java +++ b/net/minecraft/world/storage/loot/LootContext.java -@@ -76,6 +76,10 @@ +@@ -94,6 +94,10 @@ return this.field_186499_b; } diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootParameterSets.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/LootParameterSets.java.patch index 55e72acd5..d079a5b44 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootParameterSets.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/loot/LootParameterSets.java.patch @@ -1,14 +1,18 @@ --- a/net/minecraft/world/storage/loot/LootParameterSets.java +++ b/net/minecraft/world/storage/loot/LootParameterSets.java -@@ -12,9 +12,11 @@ +@@ -12,6 +12,7 @@ }); public static final LootParameterSet field_216261_b = func_216253_a("chest", (p_216259_0_) -> { p_216259_0_.func_216269_a(LootParameters.field_216286_f).func_216271_b(LootParameters.field_216281_a); + p_216259_0_.func_216271_b(LootParameters.field_216284_d); //Forge: Chest Minecarts can have killers. }); - public static final LootParameterSet field_216262_c = func_216253_a("fishing", (p_216250_0_) -> { - p_216250_0_.func_216269_a(LootParameters.field_216286_f).func_216269_a(LootParameters.field_216289_i); -+ p_216250_0_.func_216271_b(LootParameters.field_216284_d).func_216271_b(LootParameters.field_216281_a); //Forge: Allow fisher, and bobber + public static final LootParameterSet field_227557_c_ = func_216253_a("command", (p_216250_0_) -> { + p_216250_0_.func_216269_a(LootParameters.field_216286_f).func_216271_b(LootParameters.field_216281_a); +@@ -21,6 +22,7 @@ }); - public static final LootParameterSet field_216263_d = func_216253_a("entity", (p_216254_0_) -> { - p_216254_0_.func_216269_a(LootParameters.field_216281_a).func_216269_a(LootParameters.field_216286_f).func_216269_a(LootParameters.field_216283_c).func_216271_b(LootParameters.field_216284_d).func_216271_b(LootParameters.field_216285_e).func_216271_b(LootParameters.field_216282_b); + public static final LootParameterSet field_216262_c = func_216253_a("fishing", (p_216258_0_) -> { + p_216258_0_.func_216269_a(LootParameters.field_216286_f).func_216269_a(LootParameters.field_216289_i); ++ p_216258_0_.func_216271_b(LootParameters.field_216284_d).func_216271_b(LootParameters.field_216281_a); //Forge: Allow fisher, and bobber + }); + public static final LootParameterSet field_216263_d = func_216253_a("entity", (p_216251_0_) -> { + p_216251_0_.func_216269_a(LootParameters.field_216281_a).func_216269_a(LootParameters.field_216286_f).func_216269_a(LootParameters.field_216283_c).func_216271_b(LootParameters.field_216284_d).func_216271_b(LootParameters.field_216285_e).func_216271_b(LootParameters.field_216282_b); diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch index 099500986..e909bc8d8 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/storage/loot/LootPool.java +++ b/net/minecraft/world/storage/loot/LootPool.java -@@ -28,17 +28,19 @@ +@@ -25,17 +25,19 @@ import org.apache.commons.lang3.mutable.MutableInt; public class LootPool { @@ -25,28 +25,28 @@ this.field_216101_c = LootConditionManager.func_216305_a(p_i51268_2_); this.field_216102_d = p_i51268_3_; this.field_216103_e = LootFunctionManager.func_216241_a(p_i51268_3_); -@@ -95,16 +97,16 @@ +@@ -92,16 +94,16 @@ } - public void func_216099_a(ValidationResults p_216099_1_, Function p_216099_2_, Set p_216099_3_, LootParameterSet p_216099_4_) { + public void func_227505_a_(ValidationTracker p_227505_1_) { - for(int i = 0; i < this.field_186454_b.length; ++i) { -- this.field_186454_b[i].func_215856_a(p_216099_1_.func_216108_b(".condition[" + i + "]"), p_216099_2_, p_216099_3_, p_216099_4_); +- this.field_186454_b[i].func_225580_a_(p_227505_1_.func_227534_b_(".condition[" + i + "]")); + for(int i = 0; i < this.field_186454_b.size(); ++i) { -+ this.field_186454_b.get(i).func_215856_a(p_216099_1_.func_216108_b(".condition[" + i + "]"), p_216099_2_, p_216099_3_, p_216099_4_); ++ this.field_186454_b.get(i).func_225580_a_(p_227505_1_.func_227534_b_(".condition[" + i + "]")); } for(int j = 0; j < this.field_216102_d.length; ++j) { - this.field_216102_d[j].func_215856_a(p_216099_1_.func_216108_b(".functions[" + j + "]"), p_216099_2_, p_216099_3_, p_216099_4_); + this.field_216102_d[j].func_225580_a_(p_227505_1_.func_227534_b_(".functions[" + j + "]")); } - for(int k = 0; k < this.field_186453_a.length; ++k) { -- this.field_186453_a[k].func_216142_a(p_216099_1_.func_216108_b(".entries[" + k + "]"), p_216099_2_, p_216099_3_, p_216099_4_); +- this.field_186453_a[k].func_225579_a_(p_227505_1_.func_227534_b_(".entries[" + k + "]")); + for(int k = 0; k < this.field_186453_a.size(); ++k) { -+ this.field_186453_a.get(k).func_216142_a(p_216099_1_.func_216108_b(".entries[" + k + "]"), p_216099_2_, p_216099_3_, p_216099_4_); ++ this.field_186453_a.get(k).func_225579_a_(p_227505_1_.func_227534_b_(".entries[" + k + "]")); } } -@@ -119,6 +121,7 @@ +@@ -116,6 +118,7 @@ private final List field_216049_c = Lists.newArrayList(); private IRandomRange field_216050_d = new RandomValueRange(1.0F); private RandomValueRange field_216051_e = new RandomValueRange(0.0F, 0.0F); @@ -54,7 +54,7 @@ public LootPool.Builder func_216046_a(IRandomRange p_216046_1_) { this.field_216050_d = p_216046_1_; -@@ -144,15 +147,61 @@ +@@ -141,15 +144,61 @@ return this; } @@ -117,7 +117,7 @@ public static class Serializer implements JsonDeserializer, JsonSerializer { public LootPool deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException { JsonObject jsonobject = JSONUtils.func_151210_l(p_deserialize_1_, "loot pool"); -@@ -161,18 +210,20 @@ +@@ -158,18 +207,20 @@ ILootFunction[] ailootfunction = JSONUtils.func_188177_a(jsonobject, "functions", new ILootFunction[0], p_deserialize_3_, ILootFunction[].class); IRandomRange irandomrange = RandomRanges.func_216130_a(jsonobject.get("rolls"), p_deserialize_3_); RandomValueRange randomvaluerange = JSONUtils.func_188177_a(jsonobject, "bonus_rolls", new RandomValueRange(0.0F, 0.0F), p_deserialize_3_, RandomValueRange.class); diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch index 3a6dda3eb..b4d6cb466 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/storage/loot/LootTable.java +++ b/net/minecraft/world/storage/loot/LootTable.java -@@ -33,13 +33,13 @@ +@@ -31,13 +31,13 @@ public static final LootTable field_186464_a = new LootTable(LootParameterSets.field_216260_a, new LootPool[0], new ILootFunction[0]); public static final LootParameterSet field_216126_b = LootParameterSets.field_216266_g; private final LootParameterSet field_216127_d; @@ -16,18 +16,18 @@ this.field_216128_f = p_i51265_3_; this.field_216129_g = LootFunctionManager.func_216241_a(p_i51265_3_); } -@@ -92,8 +92,8 @@ +@@ -90,8 +90,8 @@ } - public void func_216117_a(ValidationResults p_216117_1_, Function p_216117_2_, Set p_216117_3_, LootParameterSet p_216117_4_) { + public void func_227506_a_(ValidationTracker p_227506_1_) { - for(int i = 0; i < this.field_186466_c.length; ++i) { -- this.field_186466_c[i].func_216099_a(p_216117_1_.func_216108_b(".pools[" + i + "]"), p_216117_2_, p_216117_3_, p_216117_4_); +- this.field_186466_c[i].func_227505_a_(p_227506_1_.func_227534_b_(".pools[" + i + "]")); + for(int i = 0; i < this.field_186466_c.size(); ++i) { -+ this.field_186466_c.get(i).func_216099_a(p_216117_1_.func_216108_b(".pools[" + i + "]"), p_216117_2_, p_216117_3_, p_216117_4_); ++ this.field_186466_c.get(i).func_227505_a_(p_227506_1_.func_227534_b_(".pools[" + i + "]")); } for(int j = 0; j < this.field_216128_f.length; ++j) { -@@ -204,6 +204,41 @@ +@@ -202,6 +202,41 @@ } } @@ -69,7 +69,7 @@ public static class Serializer implements JsonDeserializer, JsonSerializer { public LootTable deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException { JsonObject jsonobject = JSONUtils.func_151210_l(p_deserialize_1_, "loot table"); -@@ -229,7 +264,7 @@ +@@ -227,7 +262,7 @@ } } diff --git a/patches_old/minecraft/net/minecraft/block/Block.java.patch b/patches_old/minecraft/net/minecraft/block/Block.java.patch deleted file mode 100644 index cf5d34c92..000000000 --- a/patches_old/minecraft/net/minecraft/block/Block.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/block/Block.java -+++ b/net/minecraft/block/Block.java -@@ -543,7 +555,7 @@ - } - } - -- return raytraceresult; -+ return p_180636_0_.func_177230_c().getRayTraceResult(p_180636_0_, p_180636_1_, p_180636_2_, p_180636_3_, p_180636_4_, raytraceresult); - } - - public void func_180652_a(World p_180652_1_, BlockPos p_180652_2_, Explosion p_180652_3_) { \ No newline at end of file diff --git a/patches_old/minecraft/net/minecraft/block/ChestBlock.java.patch b/patches_old/minecraft/net/minecraft/block/ChestBlock.java.patch deleted file mode 100644 index 150eaa751..000000000 --- a/patches_old/minecraft/net/minecraft/block/ChestBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/block/ChestBlock.java -+++ b/net/minecraft/block/ChestBlock.java -@@ -258,7 +258,7 @@ - } - - private boolean func_176456_n(IBlockReader p_176456_1_, BlockPos p_176456_2_) { -- return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).func_185915_l(); -+ return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).doesSideBlockChestOpening(p_176456_1_, p_176456_2_.func_177984_a(), Direction.DOWN); - } - - private boolean func_176453_o(World p_176453_1_, BlockPos p_176453_2_) { diff --git a/patches_old/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch b/patches_old/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch deleted file mode 100644 index 4b9f5aa98..000000000 --- a/patches_old/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch +++ /dev/null @@ -1,116 +0,0 @@ ---- a/net/minecraft/client/multiplayer/PlayerController.java -+++ b/net/minecraft/client/multiplayer/PlayerController.java -@@ -118,24 +120,23 @@ - } else if (iblockstate.func_196958_f()) { - return false; - } else { -- block.func_176208_a(world, p_187103_1_, iblockstate, this.field_78776_a.field_71439_g); - IFluidState ifluidstate = world.func_204610_c(p_187103_1_); -- boolean flag = world.func_180501_a(p_187103_1_, ifluidstate.func_206883_i(), 11); -- if (flag) { -- block.func_176206_d(world, p_187103_1_, iblockstate); -- } - - this.field_178895_c = new BlockPos(this.field_178895_c.func_177958_n(), -1, this.field_178895_c.func_177952_p()); - if (!this.field_78779_k.func_77145_d()) { - ItemStack itemstack1 = this.field_78776_a.field_71439_g.func_184614_ca(); -+ ItemStack copyBeforeUse = itemstack1.func_77946_l(); - if (!itemstack1.func_190926_b()) { - itemstack1.func_179548_a(world, iblockstate, p_187103_1_, this.field_78776_a.field_71439_g); - if (itemstack1.func_190926_b()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_78776_a.field_71439_g, copyBeforeUse, Hand.MAIN_HAND); - this.field_78776_a.field_71439_g.func_184611_a(Hand.MAIN_HAND, ItemStack.field_190927_a); - } - } - } - -+ boolean flag = iblockstate.removedByPlayer(world, p_187103_1_, field_78776_a.field_71439_g, false, ifluidstate); -+ if (flag) block.func_176206_d(world, p_187103_1_, iblockstate); - return flag; - } - } -@@ -166,21 +167,25 @@ - if (this.field_78779_k.func_77145_d()) { - this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_), 1.0F); - this.field_78774_b.func_147297_a(new CPlayerDiggingPacket(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_)); -+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1)).isCanceled()) - func_178891_a(this.field_78776_a, this, p_180511_1_, p_180511_2_); - this.field_78781_i = 5; - } else if (!this.field_78778_j || !this.func_178893_a(p_180511_1_)) { - if (this.field_78778_j) { - this.field_78774_b.func_147297_a(new CPlayerDiggingPacket(CPlayerDiggingPacket.Action.ABORT_DESTROY_BLOCK, this.field_178895_c, p_180511_2_)); - } -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1)); - - BlockState iblockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_); - this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, iblockstate, 0.0F); - this.field_78774_b.func_147297_a(new CPlayerDiggingPacket(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_)); - boolean flag = !iblockstate.func_196958_f(); - if (flag && this.field_78770_f == 0.0F) { -+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) - iblockstate.func_196942_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71439_g); - } - -+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; - if (flag && iblockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180511_1_) >= 1.0F) { - this.func_187103_a(p_180511_1_); - } else { -@@ -294,17 +300,35 @@ - float f = (float)(p_187099_5_.field_72450_a - (double)p_187099_3_.func_177958_n()); - float f1 = (float)(p_187099_5_.field_72448_b - (double)p_187099_3_.func_177956_o()); - float f2 = (float)(p_187099_5_.field_72449_c - (double)p_187099_3_.func_177952_p()); -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks -+ .onRightClickBlock(p_187099_1_, p_187099_6_, p_187099_3_, p_187099_4_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(p_187099_1_, func_78757_d() + 1)); -+ if (event.isCanceled()) { -+ // Give the server a chance to fire event as well. That way server event is not dependant on client event. -+ this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); -+ return event.getCancellationResult(); -+ } - if (this.field_78779_k == GameType.SPECTATOR) { - this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); - return ActionResultType.SUCCESS; - } else { -- boolean flag = !p_187099_1_.func_184614_ca().func_190926_b() || !p_187099_1_.func_184592_cb().func_190926_b(); -+ ActionResultType ret = itemstack.onItemUseFirst(new ItemUseContext(p_187099_1_, p_187099_1_.func_184586_b(p_187099_6_), p_187099_3_, p_187099_4_, f, f1, f2)); -+ if (ret != ActionResultType.PASS) { -+ // The server needs to process the item use as well. Otherwise onItemUseFirst won't ever be called on the server without causing weird bugs -+ this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); -+ return ret; -+ } -+ boolean flag = !(p_187099_1_.func_184614_ca().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_) && p_187099_1_.func_184592_cb().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_)); - boolean flag1 = p_187099_1_.func_70093_af() && flag; -- if (!flag1 && p_187099_2_.func_180495_p(p_187099_3_).func_196943_a(p_187099_2_, p_187099_3_, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2)) { -+ if (!flag1 || event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW) { -+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) { -+ if (p_187099_2_.func_180495_p(p_187099_3_).func_196943_a(p_187099_2_, p_187099_3_, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2)) { -+ this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); -+ return ActionResultType.SUCCESS; -+ } -+ } -+ } -+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { - this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); -- return ActionResultType.SUCCESS; -- } else { -- this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); - if (!itemstack.func_190926_b() && !p_187099_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { - ItemUseContext itemusecontext = new ItemUseContext(p_187099_1_, p_187099_1_.func_184586_b(p_187099_6_), p_187099_3_, p_187099_4_, f, f1, f2); - ActionResultType enumactionresult; -@@ -313,7 +337,9 @@ - enumactionresult = itemstack.func_196084_a(itemusecontext); - itemstack.func_190920_e(i); - } else { -+ ItemStack copyForUse = itemstack.func_77946_l(); - enumactionresult = itemstack.func_196084_a(itemusecontext); -+ if (itemstack.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, copyForUse, p_187099_6_); - } - - return enumactionresult; -@@ -321,6 +347,7 @@ - return ActionResultType.PASS; - } - } -+ return ActionResultType.PASS; - } - } - } \ No newline at end of file diff --git a/patches_old/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches_old/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch deleted file mode 100644 index 6fa2b2946..000000000 --- a/patches_old/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/client/renderer/GameRenderer.java -+++ b/net/minecraft/client/renderer/GameRenderer.java -@@ -487,8 +489,16 @@ - } - - if (!this.field_78531_r.field_71474_y.field_74325_U) { -- GlStateManager.func_179114_b(entity.func_195050_f(p_78467_1_), 1.0F, 0.0F, 0.0F); -- GlStateManager.func_179114_b(entity.func_195046_g(p_78467_1_) + 180.0F, 0.0F, 1.0F, 0.0F); -+ float yaw = entity.func_195046_g(p_78467_1_) + 180F; -+ float pitch = entity.func_195050_f(p_78467_1_); -+ float roll = 0.0F; -+ BlockState state = ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_78467_1_); -+ IFluidState fluidState = ActiveRenderInfo.func_206243_b(this.field_78531_r.field_71441_e, entity, p_78467_1_); -+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, state, fluidState, p_78467_1_, yaw, pitch, roll); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ GlStateManager.func_179114_b(event.getRoll(), 0.0F, 0.0F, 1.0F); -+ GlStateManager.func_179114_b(event.getPitch(), 1.0F, 0.0F, 0.0F); -+ GlStateManager.func_179114_b(event.getYaw(), 0.0F, 1.0F, 0.0F); - } - - GlStateManager.func_179109_b(0.0F, -f, 0.0F); diff --git a/patches_old/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch b/patches_old/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch deleted file mode 100644 index 7ab619e81..000000000 --- a/patches_old/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/net/minecraft/client/renderer/texture/AtlasTexture.java -+++ b/net/minecraft/client/renderer/texture/AtlasTexture.java -@@ -57,8 +58,14 @@ - int j = Integer.MAX_VALUE; - int k = 1 << this.field_147636_j; - -- for(ResourceLocation resourcelocation : this.field_195427_i) { -+ field_147635_d.info("Max texture size: {}", i); -+ try (net.minecraftforge.fml.common.progress.ProgressBar textureLoadingBar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture loading", this.field_195427_i.size())) { -+ loadedSprites.clear(); -+ for(ResourceLocation resourcelocation : Sets.newHashSet(this.field_195427_i)) { -+ textureLoadingBar.step(this.func_195420_b(resourcelocation).toString()); - if (!this.field_94249_f.func_195668_m().equals(resourcelocation)) { -+ j = loadTexture(stitcher, p_195421_1_, resourcelocation, j, k); -+ if (true) continue; // Forge: skip the rest of this if statement, we're using loadTexture instead - ResourceLocation resourcelocation1 = this.func_195420_b(resourcelocation); - - TextureAtlasSprite textureatlassprite; -@@ -84,9 +91,11 @@ - stitcher.func_110934_a(textureatlassprite); - } - } -+ } // Forge: end progress bar - - int l = Math.min(j, k); - int i1 = MathHelper.func_151239_c(l); -@@ -94,18 +103,25 @@ - - this.field_94249_f.func_147963_d(this.field_147636_j); - stitcher.func_110934_a(this.field_94249_f); -+ try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture creation", 2)) { - - try { -+ bar.step("Stitching"); - stitcher.func_94305_f(); - } catch (StitcherException stitcherexception) { - throw stitcherexception; - } - - field_147635_d.info("Created: {}x{} {}-atlas", stitcher.func_110935_a(), stitcher.func_110936_b(), this.field_94254_c); -+ bar.step("Allocating GL texture"); - TextureUtil.func_180600_a(this.func_110552_b(), this.field_147636_j, stitcher.func_110935_a(), stitcher.func_110936_b()); - -+ }; // Forge: end progress bar -+ try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture mipmap and upload", stitcher.func_94309_g().size())) { - for(TextureAtlasSprite textureatlassprite1 : stitcher.func_94309_g()) { -- if (textureatlassprite1 == this.field_94249_f || this.func_195422_a(p_195421_1_, textureatlassprite1)) { -+ bar.step(textureatlassprite1.func_195668_m().toString()); -+ // FORGE: Sprite loading is now done during stitching, short-circuit this check -+ if (true || textureatlassprite1 == this.field_94249_f || this.func_195422_a(p_195421_1_, textureatlassprite1)) { - this.field_94252_e.put(textureatlassprite1.func_195668_m(), textureatlassprite1); - - try { diff --git a/patches_old/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches_old/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch deleted file mode 100644 index f599b6235..000000000 --- a/patches_old/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/net/minecraft/client/renderer/texture/TextureManager.java -+++ b/net/minecraft/client/renderer/texture/TextureManager.java -@@ -113,11 +114,13 @@ - - public void func_195410_a(IResourceManager p_195410_1_) { - MissingTextureSprite.func_195676_d(); -+ try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Reloading Texture Manager", this.field_110585_a.entrySet().size(), true)) { - Iterator> iterator = this.field_110585_a.entrySet().iterator(); - - while(iterator.hasNext()) { - Entry entry = iterator.next(); - ResourceLocation resourcelocation = entry.getKey(); -+ bar.step(resourcelocation.toString()); - ITextureObject itextureobject = entry.getValue(); - if (itextureobject == MissingTextureSprite.func_195676_d() && !resourcelocation.equals(MissingTextureSprite.func_195675_b())) { - iterator.remove(); -@@ -125,6 +128,11 @@ - this.func_110579_a(entry.getKey(), itextureobject); - } - } -+ }; // Forge: end progress bar -+ } - -+ @Override -+ public net.minecraftforge.resource.IResourceType getResourceType() { -+ return net.minecraftforge.resource.VanillaResourceType.TEXTURES; - } - } diff --git a/patches_old/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches_old/minecraft/net/minecraft/client/shader/Framebuffer.java.patch deleted file mode 100644 index 42a585256..000000000 --- a/patches_old/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- a/net/minecraft/client/shader/Framebuffer.java -+++ b/net/minecraft/client/shader/Framebuffer.java -@@ -22,6 +22,7 @@ - public int field_147624_h; - public float[] field_147625_i; - public int field_147623_j; -+ private boolean stencilEnabled = false; - - public Framebuffer(int p_i45078_1_, int p_i45078_2_, boolean p_i45078_3_) { - this.field_147619_e = p_i45078_3_; -@@ -95,8 +96,14 @@ - OpenGlHelper.func_153188_a(OpenGlHelper.field_153198_e, OpenGlHelper.field_153200_g, 3553, this.field_147617_g, 0); - if (this.field_147619_e) { - OpenGlHelper.func_153176_h(OpenGlHelper.field_153199_f, this.field_147624_h); -+ if (!this.stencilEnabled) { - OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, 33190, this.field_147622_a, this.field_147620_b); - OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, OpenGlHelper.field_153201_h, OpenGlHelper.field_153199_f, this.field_147624_h); -+ } else { -+ OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.field_147622_a, this.field_147620_b); -+ OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.field_147624_h); -+ OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.field_147624_h); -+ } - } - - this.func_147611_b(); -@@ -229,4 +236,31 @@ - GlStateManager.func_179086_m(i); - this.func_147609_e(); - } -+ -+ /** -+ * Attempts to enabled 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. -+ * Modders should check the below 'isStencilEnabled' to check if another modder has already enabled them. -+ * -+ * Note: -+ * As of now the only thing that is checked is if FBOs are supported entirely, in the future -+ * we may expand to check for errors. -+ * -+ * @return True if the FBO was re-initialized with stencil bits. -+ */ -+ public boolean enableStencil() { -+ if (!OpenGlHelper.func_148822_b()) return false; -+ stencilEnabled = true; -+ this.func_147613_a(field_147621_c, field_147618_d); -+ return true; //TODO: Find a way to detect if this failed? -+ } -+ -+ /** -+ * 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; -+ } - } diff --git a/patches_old/minecraft/net/minecraft/entity/Entity.java.patch b/patches_old/minecraft/net/minecraft/entity/Entity.java.patch deleted file mode 100644 index 669dda096..000000000 --- a/patches_old/minecraft/net/minecraft/entity/Entity.java.patch +++ /dev/null @@ -1,63 +0,0 @@ -@@ -2054,6 +2083,14 @@ - - @Nullable - public Entity func_212321_a(DimensionType p_212321_1_) { -+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return null; -+ return changeDimension(p_212321_1_, this.func_184102_h().func_71218_a(p_212321_1_).func_85176_s()); -+ } -+ -+ @Nullable -+ @Override -+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null; - if (!this.field_70170_p.field_72995_K && !this.field_70128_L) { - this.field_70170_p.field_72984_F.func_76320_a("changeDimension"); - MinecraftServer minecraftserver = this.func_184102_h(); -@@ -2061,25 +2098,25 @@ - ServerWorld worldserver = minecraftserver.func_71218_a(dimensiontype); - ServerWorld worldserver1 = minecraftserver.func_71218_a(p_212321_1_); - this.field_71093_bK = p_212321_1_; -- if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END) { -+ if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { - worldserver1 = minecraftserver.func_71218_a(DimensionType.OVERWORLD); - this.field_71093_bK = DimensionType.OVERWORLD; - } - -- this.field_70170_p.func_72900_e(this); -- this.field_70128_L = false; -+ this.field_70170_p.removeEntity(this, true); //Forge: Keep data until we copy. -+ this.revive(); - this.field_70170_p.field_72984_F.func_76320_a("reposition"); - BlockPos blockpos; -- if (p_212321_1_ == DimensionType.THE_END) { -+ if (p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { - blockpos = worldserver1.func_180504_m(); - } else { -@@ -2088,8 +2125,7 @@ - d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872); - float f = this.field_70177_z; - this.func_70012_b(d0, this.field_70163_u, d1, 90.0F, 0.0F); -- Teleporter teleporter = worldserver1.func_85176_s(); -- teleporter.func_180620_b(this, f); -+ teleporter.placeEntity(worldserver1, this, f); - blockpos = new BlockPos(this); - } - -@@ -2098,7 +2134,7 @@ - Entity entity = this.func_200600_R().func_200721_a(worldserver1); - if (entity != null) { - entity.func_180432_n(this); -- if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END) { -+ if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { - BlockPos blockpos1 = worldserver1.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.func_175694_M()); - entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A); - } else { -@@ -2112,7 +2148,7 @@ - worldserver1.func_72866_a(entity, false); - } - -- this.field_70128_L = true; -+ this.remove(false); //Forge: now invalidate old entity - this.field_70170_p.field_72984_F.func_76319_b(); - worldserver.func_82742_i(); - worldserver1.func_82742_i(); diff --git a/patches_old/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch deleted file mode 100644 index 71fcce42c..000000000 --- a/patches_old/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/net/minecraft/entity/item/EnderPearlEntity.java -+++ b/net/minecraft/entity/item/EnderPearlEntity.java -@@ -110,12 +114,13 @@ - - } - -+ @Override - @Nullable -- public Entity func_212321_a(DimensionType p_212321_1_) { -+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { - if (this.field_70192_c.field_71093_bK != p_212321_1_) { - this.field_70192_c = null; - } - -- return super.func_212321_a(p_212321_1_); -+ return super.changeDimension(p_212321_1_, teleporter); - } - } diff --git a/patches_old/minecraft/net/minecraft/entity/item/ItemEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/ItemEntity.java.patch deleted file mode 100644 index 90ff432bc..000000000 --- a/patches_old/minecraft/net/minecraft/entity/item/ItemEntity.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/entity/item/ItemEntity.java -+++ b/net/minecraft/entity/item/ItemEntity.java -@@ -286,9 +313,10 @@ - return false; - } - -+ @Override - @Nullable -- public Entity func_212321_a(DimensionType p_212321_1_) { -- Entity entity = super.func_212321_a(p_212321_1_); -+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { -+ Entity entity = super.changeDimension(p_212321_1_, teleporter); - if (!this.field_70170_p.field_72995_K && entity instanceof ItemEntity) { - ((ItemEntity)entity).func_85054_d(); - } \ No newline at end of file diff --git a/patches_old/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch deleted file mode 100644 index 786774eaa..000000000 --- a/patches_old/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch +++ /dev/null @@ -1,29 +0,0 @@ -@@ -537,8 +540,10 @@ - return this.field_71133_b.func_71219_W(); - } - -+ @Override - @Nullable -- public Entity func_212321_a(DimensionType p_212321_1_) { -+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { - this.field_184851_cj = true; - if (this.field_71093_bK == DimensionType.OVERWORLD && p_212321_1_ == DimensionType.NETHER) { - this.field_193110_cw = new Vec3d(this.field_70165_t, this.field_70163_u, this.field_70161_v); -@@ -546,7 +551,7 @@ - this.field_193110_cw = null; - } - -- if (this.field_71093_bK == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END) { -+ if (this.field_71093_bK == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { - this.field_70170_p.func_72900_e(this); - if (!this.field_71136_j) { - this.field_71136_j = true; -@@ -560,7 +565,7 @@ - p_212321_1_ = DimensionType.THE_END; - } - -- this.field_71133_b.func_184103_al().func_187242_a(this, p_212321_1_); -+ this.field_71133_b.func_184103_al().changePlayerDimension(this, p_212321_1_, teleporter); - this.field_71135_a.func_147359_a(new SPlaySoundEventPacket(1032, BlockPos.field_177992_a, 0, false)); - this.field_71144_ck = -1; - this.field_71149_ch = -1.0F; diff --git a/patches_old/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches_old/minecraft/net/minecraft/item/ItemSeedFood.java.patch deleted file mode 100644 index d4fa5d3bf..000000000 --- a/patches_old/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/net/minecraft/item/ItemSeedFood.java -+++ b/net/minecraft/item/ItemSeedFood.java -@@ -10,7 +10,7 @@ - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.IWorld; - --public class ItemSeedFood extends ItemFood { -+public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable { - private final BlockState field_195972_b; - - public ItemSeedFood(int p_i48473_1_, float p_i48473_2_, Block p_i48473_3_, Item.Properties p_i48473_4_) { -@@ -21,7 +21,7 @@ - public ActionResultType func_195939_a(ItemUseContext p_195939_1_) { - IWorld iworld = p_195939_1_.func_195991_k(); - BlockPos blockpos = p_195939_1_.func_195995_a().func_177984_a(); -- if (p_195939_1_.func_196000_l() == Direction.UP && iworld.func_175623_d(blockpos) && this.field_195972_b.func_196955_c(iworld, blockpos)) { -+ if (p_195939_1_.func_196000_l() == Direction.UP && iworld.func_175623_d(blockpos) && this.field_195972_b.func_196955_c(iworld, blockpos) && iworld.func_180495_p(p_195939_1_.func_195995_a()).canSustainPlant(iworld, p_195939_1_.func_195995_a(), Direction.UP, this)) { - iworld.func_180501_a(blockpos, this.field_195972_b, 11); - PlayerEntity entityplayer = p_195939_1_.func_195999_j(); - ItemStack itemstack = p_195939_1_.func_195996_i(); -@@ -35,4 +35,14 @@ - return ActionResultType.PASS; - } - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockReader world, BlockPos pos) { -+ return net.minecraftforge.common.EnumPlantType.Crop; -+ } -+ -+ @Override -+ public BlockState getPlant(net.minecraft.world.IBlockReader world, BlockPos pos) { -+ return this.field_195972_b; -+ } - } diff --git a/patches_old/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches_old/minecraft/net/minecraft/item/ItemSeeds.java.patch deleted file mode 100644 index 5431c02e9..000000000 --- a/patches_old/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/net/minecraft/item/ItemSeeds.java -+++ b/net/minecraft/item/ItemSeeds.java -@@ -10,7 +10,7 @@ - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.IWorld; - --public class ItemSeeds extends Item { -+public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable { - private final BlockState field_195978_a; - - public ItemSeeds(Block p_i48472_1_, Item.Properties p_i48472_2_) { -@@ -21,7 +21,7 @@ - public ActionResultType func_195939_a(ItemUseContext p_195939_1_) { - IWorld iworld = p_195939_1_.func_195991_k(); - BlockPos blockpos = p_195939_1_.func_195995_a().func_177984_a(); -- if (p_195939_1_.func_196000_l() == Direction.UP && iworld.func_175623_d(blockpos) && this.field_195978_a.func_196955_c(iworld, blockpos)) { -+ if (p_195939_1_.func_196000_l() == Direction.UP && iworld.func_175623_d(blockpos) && this.field_195978_a.func_196955_c(iworld, blockpos) && iworld.func_180495_p(p_195939_1_.func_195995_a()).canSustainPlant(iworld, p_195939_1_.func_195995_a(), Direction.UP, this)) { - iworld.func_180501_a(blockpos, this.field_195978_a, 11); - ItemStack itemstack = p_195939_1_.func_195996_i(); - PlayerEntity entityplayer = p_195939_1_.func_195999_j(); -@@ -35,4 +35,14 @@ - return ActionResultType.FAIL; - } - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockReader world, BlockPos pos) { -+ return this.field_195978_a.func_177230_c() == net.minecraft.block.Blocks.field_150388_bm ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; -+ } -+ -+ @Override -+ public BlockState getPlant(net.minecraft.world.IBlockReader world, BlockPos pos) { -+ return this.field_195978_a; -+ } - } diff --git a/patches_old/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch b/patches_old/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch deleted file mode 100644 index 9ec8a60a3..000000000 --- a/patches_old/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/net/minecraft/resources/SimpleReloadableResourceManager.java -+++ b/net/minecraft/resources/SimpleReloadableResourceManager.java -@@ -86,35 +85,46 @@ - public void func_199006_a(IResourceManagerReloadListener p_199006_1_) { -+ try (net.minecraftforge.fml.common.progress.ProgressBar resReload = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Loading Resource", 1)) { -+ resReload.step(p_199006_1_.getClass()); - this.field_199015_d.add(p_199006_1_); - if (field_199012_a.isDebugEnabled()) { - field_199012_a.info(this.func_199007_b(p_199006_1_)); - } else { - p_199006_1_.func_195410_a(this); - } -+ }; // Forge: end progress bar - - } - - private void func_199010_c() { -+ try (net.minecraftforge.fml.common.progress.ProgressBar resReload = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Reloading", this.field_199015_d.size())) { - for(IResourceManagerReloadListener iresourcemanagerreloadlistener : this.field_199015_d) { -+ resReload.step(iresourcemanagerreloadlistener.getClass()); -+ if (!net.minecraftforge.resource.SelectiveReloadStateHandler.INSTANCE.test(iresourcemanagerreloadlistener)) continue; // Forge: Selective reloading for vanilla listeners - iresourcemanagerreloadlistener.func_195410_a(this); - } -+ }; // Forge: end progress bar - - } - diff --git a/patches_old/minecraft/net/minecraft/world/ServerWorld.java.patch b/patches_old/minecraft/net/minecraft/world/ServerWorld.java.patch deleted file mode 100644 index 1f81327d3..000000000 --- a/patches_old/minecraft/net/minecraft/world/ServerWorld.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/ServerWorld.java -+++ b/net/minecraft/world/ServerWorld.java -@@ -725,7 +744,7 @@ - - public void func_212420_a(Stream p_212420_1_) { - p_212420_1_.forEach((p_212421_1_) -> { -- if (this.func_184165_i(p_212421_1_)) { -+ if (this.func_184165_i(p_212421_1_) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_212421_1_, this))) { - this.field_72996_f.add(p_212421_1_); - this.func_72923_a(p_212421_1_); - } \ No newline at end of file diff --git a/patches_old/minecraft/net/minecraft/world/World.java.patch b/patches_old/minecraft/net/minecraft/world/World.java.patch deleted file mode 100644 index eba270866..000000000 --- a/patches_old/minecraft/net/minecraft/world/World.java.patch +++ /dev/null @@ -1,151 +0,0 @@ ---- a/net/minecraft/world/World.java -+++ b/net/minecraft/world/World.java -@@ -742,6 +789,8 @@ - } - - public boolean func_72838_d(Entity p_72838_1_) { -+ // do not drop any items while restoring blocksnapshots. Prevents dupes -+ if (!this.field_72995_K && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.ItemEntity && this.restoringBlockSnapshots))) return false; - int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D); - int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D); - boolean flag = p_72838_1_.field_98038_p; -@@ -777,9 +828,14 @@ - public void func_72900_e(Entity p_72900_1_) { -+ this.removeEntity(p_72900_1_, false); -+ } -+ -+ public void removeEntity(Entity p_72900_1_, boolean keepData) { - if (p_72900_1_.func_184207_aI()) { - p_72900_1_.func_184226_ay(); - } -@@ -788,7 +844,7 @@ - p_72900_1_.func_184210_p(); - } - -- p_72900_1_.func_70106_y(); -+ p_72900_1_.remove(keepData); - if (p_72900_1_ instanceof PlayerEntity) { - this.field_73010_i.remove(p_72900_1_); - this.func_72854_c(); -@@ -798,8 +854,12 @@ - } - - public void func_72973_f(Entity p_72973_1_) { -+ this.removeEntityDangerously(p_72973_1_, false); -+ } -+ -+ public void removeEntityDangerously(Entity p_72973_1_, boolean keepData) { - p_72973_1_.func_184174_b(false); -- p_72973_1_.func_70106_y(); -+ p_72973_1_.remove(keepData); - if (p_72973_1_ instanceof PlayerEntity) { - this.field_73010_i.remove(p_72973_1_); - this.func_72854_c(); -@@ -819,24 +879,31 @@ - this.field_73021_x.add(p_72954_1_); - } - -- @OnlyIn(Dist.CLIENT) - public void func_72848_b(IWorldEventListener p_72848_1_) { - this.field_73021_x.remove(p_72848_1_); - } - - public int func_72967_a(float p_72967_1_) { -+ float f = 1.0F - this.field_73011_w.getSunBrightnessFactor(p_72967_1_); -+ return (int)(f * 11); -+ } -+ public float getSunBrightnessFactor(float p_72967_1_) { - float f = this.func_72826_c(p_72967_1_); - float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F); - f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); - f1 = 1.0F - f1; - f1 = (float)((double)f1 * (1.0D - (double)(this.func_72867_j(p_72967_1_) * 5.0F) / 16.0D)); - f1 = (float)((double)f1 * (1.0D - (double)(this.func_72819_i(p_72967_1_) * 5.0F) / 16.0D)); -- f1 = 1.0F - f1; -- return (int)(f1 * 11.0F); -+ return f1; - } -@@ -967,6 +1039,10 @@ - entity.func_85029_a(crashreportcategory); - } - - if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringEntities.get()) { - LogManager.getLogger().fatal("{}", crashreport.func_71502_e()); - func_72900_e(entity); - } else - throw new ReportedException(crashreport); - } - -@@ -1009,11 +1085,17 @@ - } catch (Throwable throwable1) { - CrashReport crashreport1 = CrashReport.func_85055_a(throwable1, "Ticking entity"); - CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Entity being ticked"); - entity2.func_85029_a(crashreportcategory1); -+ if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringEntities.get()) { -+ LogManager.getLogger().fatal("{}", crashreport1.func_71502_e()); -+ func_72900_e(entity2); -+ } else - throw new ReportedException(crashreport1); - } - } -@@ -1891,7 +2020,7 @@ - } - - public void func_212420_a(Stream p_212420_1_) { -- p_212420_1_.forEach((p_212418_1_) -> { -+ p_212420_1_.filter(e -> !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(e, this))).forEach((p_212418_1_) -> { - this.field_72996_f.add(p_212418_1_); - this.func_72923_a(p_212418_1_); - }); -@@ -2096,6 +2225,8 @@ - d2 *= MoreObjects.firstNonNull(p_184150_11_.apply(entityplayer1), 1.0D); - } - -+ d2 = net.minecraftforge.common.ForgeHooks.getPlayerVisibilityDistance(entityplayer1, d2, p_184150_9_); -+ - if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0)) { - d0 = d1; - entityplayer = entityplayer1; -@@ -2185,12 +2316,17 @@ - } - - if (!this.field_72996_f.contains(p_72897_1_)) { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72897_1_, this))) - this.field_72996_f.add(p_72897_1_); - } -@@ -2303,16 +2438,15 @@ - } - - public int func_72800_K() { -- return 256; -+ return this.field_73011_w.getHeight(); - } -@@ -2464,4 +2598,40 @@ - public abstract RecipeManager func_199532_z(); - - public abstract NetworkTagManager func_205772_D(); -+ -+ protected void initCapabilities() { -+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities(); -+ this.gatherCapabilities(parent); -+ net.minecraftforge.common.util.WorldCapabilityData data = func_175693_T().func_212426_a(func_201675_m().func_186058_p(), net.minecraftforge.common.util.WorldCapabilityData::new, net.minecraftforge.common.util.WorldCapabilityData.ID); -+ if (data == null) { -+ capabilityData = new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities()); -+ func_175693_T().func_212424_a(func_201675_m().func_186058_p(), capabilityData.func_195925_e(), capabilityData); -+ } else { -+ capabilityData = data; -+ capabilityData.setCapabilities(field_73011_w, getCapabilities()); -+ } -+ } -+ -+ public int countEntities(net.minecraft.entity.EntityClassification type, int max, boolean forSpawnCount) { -+ int ret = 0; -+ for(Entity entity : this.field_72996_f) { -+ if (entity.isCreatureType(type, forSpawnCount)) { -+ if (ret++ > max) -+ return ret; -+ } -+ } -+ return ret; -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/gen/feature/OreFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/OreFeature.java.patch deleted file mode 100644 index 2d8f9dfa5..000000000 --- a/patches_old/minecraft/net/minecraft/world/gen/feature/OreFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/OreFeature.java -+++ b/net/minecraft/world/gen/feature/OreFeature.java -@@ -103,7 +103,7 @@ - if (!bitset.get(k2)) { - bitset.set(k2); - blockpos$mutableblockpos.func_181079_c(l1, i2, j2); -- if (p_207803_3_.field_202442_b.test(p_207803_1_.func_180495_p(blockpos$mutableblockpos))) { -+ if (p_207803_1_.func_180495_p(blockpos$mutableblockpos).isReplaceableOreGen(p_207803_1_.func_201672_e(), blockpos$mutableblockpos, p_207803_3_.field_202442_b)) { - p_207803_1_.func_180501_a(blockpos$mutableblockpos, p_207803_3_.field_202444_d, 2); - ++i; - } diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/EmptyLootEntry.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/EmptyLootEntry.java.patch deleted file mode 100644 index 93251543a..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/loot/EmptyLootEntry.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/world/storage/loot/EmptyLootEntry.java -+++ b/net/minecraft/world/storage/loot/EmptyLootEntry.java -@@ -9,8 +9,8 @@ - import net.minecraft.world.storage.loot.conditions.ILootCondition; - - public class EmptyLootEntry extends ILootGenerator { -- public EmptyLootEntry(int p_i46645_1_, int p_i46645_2_, ILootCondition[] p_i46645_3_) { -- super(p_i46645_1_, p_i46645_2_, p_i46645_3_); -+ public EmptyLootEntry(int p_i46645_1_, int p_i46645_2_, ILootCondition[] p_i46645_3_, String entryName) { -+ super(p_i46645_1_, p_i46645_2_, p_i46645_3_, entryName); - } - - public void func_186363_a(Collection p_186363_1_, Random p_186363_2_, LootContext p_186363_3_) { -@@ -20,6 +20,6 @@ - } - - public static EmptyLootEntry func_186372_a(JsonObject p_186372_0_, JsonDeserializationContext p_186372_1_, int p_186372_2_, int p_186372_3_, ILootCondition[] p_186372_4_) { -- return new EmptyLootEntry(p_186372_2_, p_186372_3_, p_186372_4_); -+ return new EmptyLootEntry(p_186372_2_, p_186372_3_, p_186372_4_, net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186372_0_, "empty")); - } - } diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/ILootGenerator.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/ILootGenerator.java.patch deleted file mode 100644 index 5a9f69108..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/loot/ILootGenerator.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/net/minecraft/world/storage/loot/ILootGenerator.java -+++ b/net/minecraft/world/storage/loot/ILootGenerator.java -@@ -15,20 +15,24 @@ - import net.minecraft.util.JSONUtils; - import net.minecraft.util.math.MathHelper; - import net.minecraft.world.storage.loot.conditions.ILootCondition; - import net.minecraft.world.storage.loot.LootEntry.Serializer; - - public abstract class ILootGenerator { - protected final int field_186364_c; - protected final int field_186365_d; - protected final ILootCondition[] field_186366_e; -+ protected final String entryName; - -- protected ILootGenerator(int p_i46642_1_, int p_i46642_2_, ILootCondition[] p_i46642_3_) { -+ protected ILootGenerator(int p_i46642_1_, int p_i46642_2_, ILootCondition[] p_i46642_3_, String entryName) { - this.field_186364_c = p_i46642_1_; - this.field_186365_d = p_i46642_2_; - this.field_186366_e = p_i46642_3_; -+ this.entryName = entryName; - } - -+ public String getEntryName() { return this.entryName; } -+ - public int func_186361_a(float p_186361_1_) { - return Math.max(MathHelper.func_76141_d((float)this.field_186364_c + (float)this.field_186365_d * p_186361_1_), 0); - } -@@ -50,6 +54,9 @@ - alootcondition = new ILootCondition[0]; - } - -+ ILootGenerator ret = net.minecraftforge.common.ForgeHooks.deserializeJsonLootEntry(s, jsonobject, i, j, alootcondition); -+ if (ret != null) return ret; -+ - if ("item".equals(s)) { - return ItemLootEntry.func_186367_a(jsonobject, p_deserialize_3_, i, j, alootcondition); - } else if ("loot_table".equals(s)) { -@@ -63,12 +70,17 @@ - - public JsonElement serialize(ILootGenerator p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) { - JsonObject jsonobject = new JsonObject(); -+ if (p_serialize_1_.entryName != null && !p_serialize_1_.entryName.startsWith("custom#")) -+ jsonobject.addProperty("entryName", p_serialize_1_.entryName); - jsonobject.addProperty("weight", p_serialize_1_.field_186364_c); - jsonobject.addProperty("quality", p_serialize_1_.field_186365_d); - if (p_serialize_1_.field_186366_e.length > 0) { - jsonobject.add("conditions", p_serialize_3_.serialize(p_serialize_1_.field_186366_e)); - } - -+ String type = net.minecraftforge.common.ForgeHooks.getLootEntryType(p_serialize_1_); -+ if (type != null) jsonobject.addProperty("type", type); -+ else - if (p_serialize_1_ instanceof ItemLootEntry) { - jsonobject.addProperty("type", "item"); - } else if (p_serialize_1_ instanceof TableLootEntry) { diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/ItemLootEntry.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/ItemLootEntry.java.patch deleted file mode 100644 index fc386c5b6..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/loot/ItemLootEntry.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/net/minecraft/world/storage/loot/ItemLootEntry.java -+++ b/net/minecraft/world/storage/loot/ItemLootEntry.java -@@ -18,8 +18,8 @@ - protected final Item field_186368_a; - protected final ILootFunction[] field_186369_b; - -- public ItemLootEntry(Item p_i46644_1_, int p_i46644_2_, int p_i46644_3_, ILootFunction[] p_i46644_4_, ILootCondition[] p_i46644_5_) { -- super(p_i46644_2_, p_i46644_3_, p_i46644_5_); -+ public ItemLootEntry(Item p_i46644_1_, int p_i46644_2_, int p_i46644_3_, ILootFunction[] p_i46644_4_, ILootCondition[] p_i46644_5_, String entryName) { -+ super(p_i46644_2_, p_i46644_3_, p_i46644_5_, entryName); - this.field_186368_a = p_i46644_1_; - this.field_186369_b = p_i46644_4_; - } -@@ -34,7 +34,7 @@ - } - - if (!itemstack.func_190926_b()) { -- if (itemstack.func_190916_E() < this.field_186368_a.func_77639_j()) { -+ if (itemstack.func_190916_E() < itemstack.func_77976_d()) { - p_186363_1_.add(itemstack); - } else { - int i = itemstack.func_190916_E(); -@@ -72,6 +72,6 @@ - alootfunction = new ILootFunction[0]; - } - -- return new ItemLootEntry(item, p_186367_2_, p_186367_3_, alootfunction, p_186367_4_); -+ return new ItemLootEntry(item, p_186367_2_, p_186367_3_, alootfunction, p_186367_4_, net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186367_0_, "item")); - } - } diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch deleted file mode 100644 index 5015332cf..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch +++ /dev/null @@ -1,100 +0,0 @@ ---- a/net/minecraft/world/storage/loot/LootPool.java -+++ b/net/minecraft/world/storage/loot/LootPool.java -@@ -20,14 +20,16 @@ - import org.apache.commons.lang3.ArrayUtils; - - public class LootPool { -- private final ILootGenerator[] field_186453_a; -- private final ILootCondition[] field_186454_b; -+ private final String name; -+ private final List field_186453_a; -+ private final List field_186454_b; - private RandomValueRange field_186455_c; - private RandomValueRange field_186456_d; - -- public LootPool(ILootGenerator[] p_i46643_1_, ILootCondition[] p_i46643_2_, RandomValueRange p_i46643_3_, RandomValueRange p_i46643_4_) { -- this.field_186453_a = p_i46643_1_; -- this.field_186454_b = p_i46643_2_; -+ public LootPool(ILootGenerator[] p_i46643_1_, ILootCondition[] p_i46643_2_, RandomValueRange p_i46643_3_, RandomValueRange p_i46643_4_, String name) { -+ this.name = name; -+ this.field_186453_a = Lists.newArrayList(p_i46643_1_); -+ this.field_186454_b = Lists.newArrayList(p_i46643_2_); - this.field_186455_c = p_i46643_3_; - this.field_186456_d = p_i46643_4_; - } -@@ -61,7 +63,7 @@ - } - - public void func_186449_b(Collection p_186449_1_, Random p_186449_2_, LootContext p_186449_3_) { -- if (LootConditionManager.func_186638_a(this.field_186454_b, p_186449_2_, p_186449_3_)) { -+ if (LootConditionManager.testAllConditions(this.field_186454_b, p_186449_2_, p_186449_3_)) { - int i = this.field_186455_c.func_186511_a(p_186449_2_) + MathHelper.func_76141_d(this.field_186456_d.func_186507_b(p_186449_2_) * p_186449_3_.func_186491_f()); - - for(int j = 0; j < i; ++j) { -@@ -71,6 +73,43 @@ - } - } - -+ -+ -+ //======================== FORGE START ============================================= -+ private boolean isFrozen = false; -+ public void freeze() { this.isFrozen = true; } -+ public boolean isFrozen(){ return this.isFrozen; } -+ private void checkFrozen() { -+ if (this.isFrozen()) -+ throw new RuntimeException("Attempted to modify LootPool after being frozen!"); -+ } -+ public String getName(){ return this.name; } -+ public RandomValueRange getRolls() { return this.field_186455_c; } -+ public RandomValueRange getBonusRolls() { return this.field_186456_d; } -+ public void setRolls (RandomValueRange v){ checkFrozen(); this.field_186455_c = v; } -+ public void setBonusRolls(RandomValueRange v){ checkFrozen(); this.field_186456_d = v; } -+ public ILootGenerator getEntry(String name) { -+ return field_186453_a.stream().filter(e -> name.equals(e.getEntryName())).findFirst().orElse(null); -+ } -+ public ILootGenerator removeEntry(String name) { -+ checkFrozen(); -+ for (ILootGenerator entry : this.field_186453_a) { -+ if (name.equals(entry.getEntryName())) { -+ this.field_186453_a.remove(entry); -+ return entry; -+ } -+ } -+ return null; -+ } -+ public void addEntry(ILootGenerator entry) { -+ checkFrozen(); -+ if (field_186453_a.stream().anyMatch(e -> e == entry || e.getEntryName().equals(entry.getEntryName()))) -+ throw new RuntimeException("Attempted to add a duplicate entry to pool: " + entry.getEntryName()); -+ this.field_186453_a.add(entry); -+ } -+ //TODO: Allow modifications of conditions? If so need a way to uniquely identify them. -+ //======================== FORGE END =============================================== -+ - public static class Serializer implements JsonDeserializer, JsonSerializer { - public LootPool deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException { - JsonObject jsonobject = JSONUtils.func_151210_l(p_deserialize_1_, "loot pool"); -@@ -78,18 +117,20 @@ - ILootCondition[] alootcondition = JSONUtils.func_188177_a(jsonobject, "conditions", new ILootCondition[0], p_deserialize_3_, ILootCondition[].class); - RandomValueRange randomvaluerange = JSONUtils.func_188174_a(jsonobject, "rolls", p_deserialize_3_, RandomValueRange.class); - RandomValueRange randomvaluerange1 = JSONUtils.func_188177_a(jsonobject, "bonus_rolls", new RandomValueRange(0.0F, 0.0F), p_deserialize_3_, RandomValueRange.class); -- return new LootPool(alootentry, alootcondition, randomvaluerange, randomvaluerange1); -+ return new LootPool(alootentry, alootcondition, randomvaluerange, randomvaluerange1, net.minecraftforge.common.ForgeHooks.readPoolName(jsonobject)); - } - - public JsonElement serialize(LootPool p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) { - JsonObject jsonobject = new JsonObject(); -+ if (p_serialize_1_.name != null && !p_serialize_1_.name.startsWith("custom#")) -+ jsonobject.add("name", p_serialize_3_.serialize(p_serialize_1_.name)); - jsonobject.add("entries", p_serialize_3_.serialize(p_serialize_1_.field_186453_a)); - jsonobject.add("rolls", p_serialize_3_.serialize(p_serialize_1_.field_186455_c)); - if (p_serialize_1_.field_186456_d.func_186509_a() != 0.0F && p_serialize_1_.field_186456_d.func_186512_b() != 0.0F) { - jsonobject.add("bonus_rolls", p_serialize_3_.serialize(p_serialize_1_.field_186456_d)); - } - -- if (!ArrayUtils.isEmpty((Object[])p_serialize_1_.field_186454_b)) { -+ if (!p_serialize_1_.field_186454_b.isEmpty()) { - jsonobject.add("conditions", p_serialize_3_.serialize(p_serialize_1_.field_186454_b)); - } - diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch deleted file mode 100644 index 911a164f7..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- a/net/minecraft/world/storage/loot/LootTable.java -+++ b/net/minecraft/world/storage/loot/LootTable.java -@@ -23,10 +23,10 @@ - public class LootTable { - private static final Logger field_186465_b = LogManager.getLogger(); - public static final LootTable field_186464_a = new LootTable(new LootPool[0]); -- private final LootPool[] field_186466_c; -+ private final List field_186466_c; - - public LootTable(LootPool[] p_i46641_1_) { -- this.field_186466_c = p_i46641_1_; -+ this.field_186466_c = Lists.newArrayList(p_i46641_1_); - } - - public List func_186462_a(Random p_186462_1_, LootContext p_186462_2_) { -@@ -112,6 +112,41 @@ - return list; - } - -+ //======================== FORGE START ============================================= -+ private boolean isFrozen = false; -+ public void freeze() { -+ this.isFrozen = true; -+ this.field_186466_c.forEach(LootPool::freeze); -+ } -+ public boolean isFrozen(){ return this.isFrozen; } -+ private void checkFrozen() { -+ if (this.isFrozen()) -+ throw new RuntimeException("Attempted to modify LootTable after being finalized!"); -+ } -+ -+ public LootPool getPool(String name) { -+ return field_186466_c.stream().filter(e -> name.equals(e.getName())).findFirst().orElse(null); -+ } -+ -+ public LootPool removePool(String name) { -+ checkFrozen(); -+ for (LootPool pool : this.field_186466_c) { -+ if (name.equals(pool.getName())) { -+ this.field_186466_c.remove(pool); -+ return pool; -+ } -+ } -+ return null; -+ } -+ -+ public void addPool(LootPool pool) { -+ checkFrozen(); -+ if (field_186466_c.stream().anyMatch(e -> e == pool || e.getName().equals(pool.getName()))) -+ throw new RuntimeException("Attempted to add a duplicate pool to loot table: " + pool.getName()); -+ this.field_186466_c.add(pool); -+ } -+ //======================== FORGE END =============================================== -+ - public static class Serializer implements JsonDeserializer, JsonSerializer { - public LootTable deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException { - JsonObject jsonobject = JSONUtils.func_151210_l(p_deserialize_1_, "loot table"); diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch deleted file mode 100644 index b06e4a344..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/storage/loot/LootTableManager.java -+++ b/net/minecraft/world/storage/loot/LootTableManager.java -@@ -39,7 +39,7 @@ - ResourceLocation resourcelocation1 = new ResourceLocation(resourcelocation.func_110624_b(), s.substring(field_195435_a, s.length() - field_195436_b)); - - try (IResource iresource = p_195410_1_.func_199002_a(resourcelocation)) { -- LootTable loottable = JSONUtils.func_188178_a(field_186526_b, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), LootTable.class); -+ LootTable loottable =net.minecraftforge.common.ForgeHooks.loadLootTable(field_186526_b, resourcelocation, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), iresource.func_199026_d().equals("Default"), this); - if (loottable != null) { - this.field_186527_c.put(resourcelocation1, loottable); - } diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/TableLootEntry.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/TableLootEntry.java.patch deleted file mode 100644 index d6fb3e2a6..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/loot/TableLootEntry.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/world/storage/loot/TableLootEntry.java -+++ b/net/minecraft/world/storage/loot/TableLootEntry.java -@@ -13,8 +13,8 @@ - public class TableLootEntry extends ILootGenerator { - protected final ResourceLocation field_186371_a; - -- public TableLootEntry(ResourceLocation p_i46639_1_, int p_i46639_2_, int p_i46639_3_, ILootCondition[] p_i46639_4_) { -- super(p_i46639_2_, p_i46639_3_, p_i46639_4_); -+ public TableLootEntry(ResourceLocation p_i46639_1_, int p_i46639_2_, int p_i46639_3_, ILootCondition[] p_i46639_4_, String entryName) { -+ super(p_i46639_2_, p_i46639_3_, p_i46639_4_, entryName); - this.field_186371_a = p_i46639_1_; - } - -@@ -29,6 +29,6 @@ - - public static TableLootEntry func_186370_a(JsonObject p_186370_0_, JsonDeserializationContext p_186370_1_, int p_186370_2_, int p_186370_3_, ILootCondition[] p_186370_4_) { - ResourceLocation resourcelocation = new ResourceLocation(JSONUtils.func_151200_h(p_186370_0_, "name")); -- return new TableLootEntry(resourcelocation, p_186370_2_, p_186370_3_, p_186370_4_); -+ return new TableLootEntry(resourcelocation, p_186370_2_, p_186370_3_, p_186370_4_, net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186370_0_, "loot_table")); - } - } diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java index ed4dde391..98b337e1c 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java @@ -196,7 +196,7 @@ public class RuntimeDistCleaner implements ILaunchPluginService private final List dynamicLambdaHandles = new ArrayList<>(); public LambdaGatherer() { - super(Opcodes.ASM5); + super(Opcodes.ASM7); } public void accept(MethodNode method) { diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotationVisitor.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotationVisitor.java index b4f72eb42..2ca40ee4f 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotationVisitor.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotationVisitor.java @@ -34,7 +34,7 @@ public class ModAnnotationVisitor extends AnnotationVisitor public ModAnnotationVisitor(LinkedList annotations, ModAnnotation annotation) { - super(Opcodes.ASM5); + super(Opcodes.ASM7); this.annotations = annotations; this.annotation = annotation; } diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java index 1c2705e39..20ef9eb0c 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java @@ -42,7 +42,7 @@ public class ModClassVisitor extends ClassVisitor private final LinkedList annotations = new LinkedList<>(); public ModClassVisitor() { - super(Opcodes.ASM5); + super(Opcodes.ASM7); } diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFieldVisitor.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFieldVisitor.java index bd705bf65..9e0082d85 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFieldVisitor.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFieldVisitor.java @@ -34,7 +34,7 @@ public class ModFieldVisitor extends FieldVisitor public ModFieldVisitor(String name, final LinkedList annotations) { - super(Opcodes.ASM5); + super(Opcodes.ASM7); this.fieldName = name; this.annotations = annotations; } diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModMethodVisitor.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModMethodVisitor.java index bfe319f8f..9a2a49dc5 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModMethodVisitor.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModMethodVisitor.java @@ -35,7 +35,7 @@ public class ModMethodVisitor extends MethodVisitor { public ModMethodVisitor(String name, String desc, final LinkedList annotations) { - super(Opcodes.ASM5); + super(Opcodes.ASM7); this.methodName = name; this.methodDescriptor = desc; this.annotations = annotations; diff --git a/src/main/java/net/minecraftforge/client/CloudRenderer.java b/src/main/java/net/minecraftforge/client/CloudRenderer.java index 400267686..758c02bab 100644 --- a/src/main/java/net/minecraftforge/client/CloudRenderer.java +++ b/src/main/java/net/minecraftforge/client/CloudRenderer.java @@ -24,9 +24,12 @@ 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; @@ -49,6 +52,7 @@ 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. @@ -68,7 +72,6 @@ public class CloudRenderer implements ISelectiveResourceReloadListener private final Minecraft mc = Minecraft.getInstance(); private final ResourceLocation texture = new ResourceLocation("textures/environment/clouds.png"); - private int displayList = -1; private VertexBuffer vbo; private CloudOption cloudMode = CloudOption.OFF; private int renderDistance = -1; @@ -138,18 +141,18 @@ public class CloudRenderer implements ISelectiveResourceReloadListener 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(); + buffer.func_225582_a_(sectX0, 0, sectZ0).func_225583_a_(u0, v0).func_227885_a_(bCol, bCol, bCol, ALPHA).endVertex(); + buffer.func_225582_a_(sectX1, 0, sectZ0).func_225583_a_(u1, v0).func_227885_a_(bCol, bCol, bCol, ALPHA).endVertex(); + buffer.func_225582_a_(sectX1, 0, sectZ1).func_225583_a_(u1, v1).func_227885_a_(bCol, bCol, bCol, ALPHA).endVertex(); + buffer.func_225582_a_(sectX0, 0, sectZ1).func_225583_a_(u0, v1).func_227885_a_(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(); + buffer.func_225582_a_(sectX0, HEIGHT, sectZ0).func_225583_a_(u0, v0).func_227885_a_(1, 1, 1, ALPHA).endVertex(); + buffer.func_225582_a_(sectX0, HEIGHT, sectZ1).func_225583_a_(u0, v1).func_227885_a_(1, 1, 1, ALPHA).endVertex(); + buffer.func_225582_a_(sectX1, HEIGHT, sectZ1).func_225583_a_(u1, v1).func_227885_a_(1, 1, 1, ALPHA).endVertex(); + buffer.func_225582_a_(sectX1, HEIGHT, sectZ0).func_225583_a_(u1, v0).func_227885_a_(1, 1, 1, ALPHA).endVertex(); float slice; float sliceCoord0; @@ -164,10 +167,10 @@ public class CloudRenderer implements ISelectiveResourceReloadListener 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(); + buffer.func_225582_a_(slice, 0, sectZ1).func_225583_a_(sliceCoord0, v1).func_227885_a_(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); + buffer.func_225582_a_(slice, HEIGHT, sectZ1).func_225583_a_(sliceCoord1, v1).func_227885_a_(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); + buffer.func_225582_a_(slice, HEIGHT, sectZ0).func_225583_a_(sliceCoord1, v0).func_227885_a_(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); + buffer.func_225582_a_(slice, 0, sectZ0).func_225583_a_(sliceCoord0, v0).func_227885_a_(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); slice -= INSET; } @@ -176,10 +179,10 @@ public class CloudRenderer implements ISelectiveResourceReloadListener 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(); + buffer.func_225582_a_(slice, 0, sectZ0).func_225583_a_(sliceCoord0, v0).func_227885_a_(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); + buffer.func_225582_a_(slice, HEIGHT, sectZ0).func_225583_a_(sliceCoord1, v0).func_227885_a_(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); + buffer.func_225582_a_(slice, HEIGHT, sectZ1).func_225583_a_(sliceCoord1, v1).func_227885_a_(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); + buffer.func_225582_a_(slice, 0, sectZ1).func_225583_a_(sliceCoord0, v1).func_227885_a_(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); slice += INSET; } } @@ -193,10 +196,10 @@ public class CloudRenderer implements ISelectiveResourceReloadListener 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(); + buffer.func_225582_a_(sectX0, 0, slice).func_225583_a_(u0, sliceCoord0).func_227885_a_(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); + buffer.func_225582_a_(sectX0, HEIGHT, slice).func_225583_a_(u0, sliceCoord1).func_227885_a_(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); + buffer.func_225582_a_(sectX1, HEIGHT, slice).func_225583_a_(u1, sliceCoord1).func_227885_a_(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); + buffer.func_225582_a_(sectX1, 0, slice).func_225583_a_(u1, sliceCoord0).func_227885_a_(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); slice -= INSET; } @@ -205,10 +208,10 @@ public class CloudRenderer implements ISelectiveResourceReloadListener 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(); + buffer.func_225582_a_(sectX1, 0, slice).func_225583_a_(u1, sliceCoord0).func_227885_a_(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); + buffer.func_225582_a_(sectX1, HEIGHT, slice).func_225583_a_(u1, sliceCoord1).func_227885_a_(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); + buffer.func_225582_a_(sectX0, HEIGHT, slice).func_225583_a_(u0, sliceCoord1).func_227885_a_(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); + buffer.func_225582_a_(sectX0, 0, slice).func_225583_a_(u0, sliceCoord0).func_227885_a_(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); slice += INSET; } } @@ -228,11 +231,6 @@ public class CloudRenderer implements ISelectiveResourceReloadListener vbo.deleteGlBuffers(); vbo = null; } - if (displayList >= 0) - { - GLAllocation.deleteDisplayLists(displayList); - displayList = -1; - } } private void build() @@ -240,24 +238,13 @@ public class CloudRenderer implements ISelectiveResourceReloadListener Tessellator tess = Tessellator.getInstance(); BufferBuilder buffer = tess.getBuffer(); - if (GLX.useVbo()) - vbo = new VertexBuffer(FORMAT); - else - GlStateManager.newList(displayList = GLAllocation.generateDisplayLists(1), GL11.GL_COMPILE); + vbo = new VertexBuffer(FORMAT); vertices(buffer); - if (GLX.useVbo()) - { - buffer.finishDrawing(); - buffer.reset(); - vbo.bufferData(buffer.getByteBuffer()); - } - else - { - tess.draw(); - GlStateManager.endList(); - } + buffer.finishDrawing(); + buffer.reset(); + vbo.bufferData(buffer.getByteBuffer()); } private int fullCoord(double coord, int scale) @@ -267,7 +254,7 @@ public class CloudRenderer implements ISelectiveResourceReloadListener private boolean isBuilt() { - return GLX.useVbo() ? vbo != null : displayList >= 0; + return vbo != null; } public void checkSettings() @@ -303,12 +290,12 @@ public class CloudRenderer implements ISelectiveResourceReloadListener double totalOffset = cloudTicks + partialTicks; - double x = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks + double x = entity.prevPosX + (entity.func_226277_ct_() - entity.prevPosX) * partialTicks + totalOffset * 0.03; double y = mc.world.dimension.getCloudHeight() - - (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks) + - (entity.lastTickPosY + (entity.func_226278_cu_() - entity.lastTickPosY) * partialTicks) + 0.33; - double z = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks; + double z = entity.prevPosZ + (entity.func_226281_cx_() - entity.prevPosZ) * partialTicks; int scale = getScale(); @@ -319,26 +306,24 @@ public class CloudRenderer implements ISelectiveResourceReloadListener int offU = fullCoord(x, scale); int offV = fullCoord(z, scale); - GlStateManager.pushMatrix(); + RenderSystem.pushMatrix(); // Translate by the remainder after the UV offset. - GlStateManager.translated((offU * scale) - x, y, (offV * scale) - z); + 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. - GlStateManager.matrixMode(GL11.GL_TEXTURE); - GlStateManager.translatef(offU * PX_SIZE, offV * PX_SIZE, 0); - GlStateManager.matrixMode(GL11.GL_MODELVIEW); + RenderSystem.matrixMode(GL11.GL_TEXTURE); + RenderSystem.translatef(offU * PX_SIZE, offV * PX_SIZE, 0); + RenderSystem.matrixMode(GL11.GL_MODELVIEW); - GlStateManager.disableCull(); + RenderSystem.disableCull(); - GlStateManager.enableBlend(); - GlStateManager.blendFuncSeparate( - GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, - GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderSystem.enableBlend(); + RenderSystem.defaultBlendFunc(); // Color multiplier. Vec3d color = mc.world.getCloudColour(partialTicks); @@ -356,94 +341,71 @@ public class CloudRenderer implements ISelectiveResourceReloadListener | (int) (b * 255)); COLOR_TEX.updateDynamicTexture(); - GlStateManager.activeTexture(GLX.GL_TEXTURE1); - GlStateManager.bindTexture(COLOR_TEX.getGlTextureId()); - GlStateManager.enableTexture(); + RenderSystem.activeTexture(GL13.GL_TEXTURE1); + RenderSystem.bindTexture(COLOR_TEX.getGlTextureId()); + RenderSystem.enableTexture(); // Bind the clouds texture last so the shader's sampler2D is correct. - GlStateManager.activeTexture(GLX.GL_TEXTURE0); + RenderSystem.activeTexture(GL13.GL_TEXTURE0); mc.textureManager.bindTexture(texture); ByteBuffer buffer = Tessellator.getInstance().getBuffer().getByteBuffer(); // Set up pointers for the display list/VBO. - if (GLX.useVbo()) - { - vbo.bindBuffer(); + vbo.bindBuffer(); - int stride = FORMAT.getSize(); - GlStateManager.vertexPointer(3, GL11.GL_FLOAT, stride, 0); - GlStateManager.enableClientState(GL11.GL_VERTEX_ARRAY); - GlStateManager.texCoordPointer(2, GL11.GL_FLOAT, stride, 12); - GlStateManager.enableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - GlStateManager.colorPointer(4, GL11.GL_UNSIGNED_BYTE, stride, 20); - GlStateManager.enableClientState(GL11.GL_COLOR_ARRAY); - } - else - { - buffer.limit(FORMAT.getSize()); - for (int i = 0; i < FORMAT.getElementCount(); i++) - FORMAT.getElements().get(i).getUsage().preDraw(FORMAT, i, FORMAT.getSize(), buffer); - buffer.position(0); - } + 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. - GlStateManager.colorMask(false, false, false, false); - if (GLX.useVbo()) - vbo.drawArrays(GL11.GL_QUADS); - else - GlStateManager.callList(displayList); + RenderSystem.colorMask(false, false, false, false); + vbo.drawArrays(GL11.GL_QUADS); // Full render. - GlStateManager.colorMask(true, true, true, true); + RenderSystem.colorMask(true, true, true, true); // Wireframe for debug. if (WIREFRAME) { - GlStateManager.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); - GlStateManager.lineWidth(2.0F); - GlStateManager.disableTexture(); - GlStateManager.depthMask(false); - GlStateManager.disableFog(); - if (GLX.useVbo()) - vbo.drawArrays(GL11.GL_QUADS); - else - GlStateManager.callList(displayList); - GlStateManager.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); - GlStateManager.depthMask(true); - GlStateManager.enableTexture(); - GlStateManager.enableFog(); + 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(); } - if (GLX.useVbo()) - { - vbo.drawArrays(GL11.GL_QUADS); - vbo.unbindBuffer(); // Unbind buffer and disable pointers. - } - else - { - GlStateManager.callList(displayList); - } + vbo.drawArrays(GL11.GL_QUADS); + VertexBuffer.unbindBuffer(); // Unbind buffer and disable pointers. buffer.limit(0); - for (int i = 0; i < FORMAT.getElementCount(); i++) + for (int i = 0; i < FORMAT.func_227894_c_().size(); i++) FORMAT.getElements().get(i).getUsage().postDraw(FORMAT, i, FORMAT.getSize(), buffer); buffer.position(0); // Disable our coloring. - GlStateManager.activeTexture(GLX.GL_TEXTURE1); - GlStateManager.disableTexture(); - GlStateManager.activeTexture(GLX.GL_TEXTURE0); + RenderSystem.activeTexture(GL13.GL_TEXTURE1); + RenderSystem.disableTexture(); + RenderSystem.activeTexture(GL13.GL_TEXTURE0); // Reset texture matrix. - GlStateManager.matrixMode(GL11.GL_TEXTURE); - GlStateManager.loadIdentity(); - GlStateManager.matrixMode(GL11.GL_MODELVIEW); + RenderSystem.matrixMode(GL11.GL_TEXTURE); + RenderSystem.loadIdentity(); + RenderSystem.matrixMode(GL11.GL_MODELVIEW); - GlStateManager.disableBlend(); - GlStateManager.enableCull(); + RenderSystem.disableBlend(); + RenderSystem.enableCull(); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); return true; } @@ -453,8 +415,8 @@ public class CloudRenderer implements ISelectiveResourceReloadListener if (mc.textureManager != null) { mc.textureManager.bindTexture(texture); - texW = GlStateManager.getTexLevelParameter(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); - texH = GlStateManager.getTexLevelParameter(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT); + 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); } } @@ -492,3 +454,4 @@ public class CloudRenderer implements ISelectiveResourceReloadListener } } +*/ \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 7fe4a920e..3daf649c6 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -19,9 +19,55 @@ package net.minecraftforge.client; -import com.mojang.blaze3d.platform.GLX; +import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.BOSSINFO; +import static net.minecraftforge.fml.VersionChecker.Status.BETA; +import static net.minecraftforge.fml.VersionChecker.Status.BETA_OUTDATED; +import static org.lwjgl.opengl.GL11.GL_COLOR_ARRAY; +import static org.lwjgl.opengl.GL11.GL_NORMAL_ARRAY; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_COORD_ARRAY; +import static org.lwjgl.opengl.GL11.GL_VERTEX_ARRAY; +import static org.lwjgl.opengl.GL11.glColorPointer; +import static org.lwjgl.opengl.GL11.glDisableClientState; +import static org.lwjgl.opengl.GL11.glEnableClientState; +import static org.lwjgl.opengl.GL11.glMultMatrixf; +import static org.lwjgl.opengl.GL11.glNormalPointer; +import static org.lwjgl.opengl.GL11.glTexCoordPointer; +import static org.lwjgl.opengl.GL11.glVertexPointer; +import static org.lwjgl.opengl.GL20.glDisableVertexAttribArray; +import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray; +import static org.lwjgl.opengl.GL20.glVertexAttribPointer; + +import java.io.File; +import java.lang.reflect.Field; +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Random; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.vecmath.Matrix3f; +import javax.vecmath.Matrix4f; +import javax.vecmath.Vector3f; +import javax.vecmath.Vector4f; + +import net.minecraftforge.client.model.pipeline.LightUtil; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.core.async.ThreadNameCachingStrategy; +import org.apache.logging.log4j.core.impl.ReusableLogEventFactory; +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL13; + +import com.google.common.collect.ImmutableList; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; -import net.minecraft.block.BlockState; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.IVertexBuilder; + import net.minecraft.client.GameSettings; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; @@ -33,11 +79,11 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.screen.MainMenuScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.FogRenderer; +import net.minecraft.client.renderer.FogRenderer.FogType; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.color.ItemColors; @@ -47,11 +93,12 @@ 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.model.ModelRotation; -import net.minecraft.client.renderer.model.SimpleBakedModel; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.texture.NativeImage; +import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; @@ -65,7 +112,6 @@ import net.minecraft.fluid.IFluidState; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.RecipeManager; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.MovementInput; @@ -76,7 +122,7 @@ 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.IEnviromentBlockReader; +import net.minecraft.world.ILightReader; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraftforge.client.event.ColorHandlerEvent; @@ -95,15 +141,12 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.ScreenshotEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; -import net.minecraftforge.client.model.ModelDynBucket; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.animation.Animation; +import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.pipeline.QuadGatheringTransformer; -import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.ITransformation; -import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraftforge.common.model.TransformationHelper; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.fml.ModLoader; import net.minecraftforge.fml.VersionChecker; @@ -113,29 +156,6 @@ import net.minecraftforge.resource.ReloadRequirements; import net.minecraftforge.resource.SelectiveReloadStateHandler; import net.minecraftforge.resource.VanillaResourceType; import net.minecraftforge.versions.forge.ForgeVersion; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.core.async.ThreadNameCachingStrategy; -import org.apache.logging.log4j.core.impl.ReusableLogEventFactory; -import org.lwjgl.BufferUtils; - -import javax.annotation.Nonnull; -import javax.vecmath.Matrix3f; -import javax.vecmath.Matrix4f; -import javax.vecmath.Vector3f; -import javax.vecmath.Vector4f; -import java.io.File; -import java.lang.reflect.Field; -import java.nio.ByteBuffer; -import java.nio.FloatBuffer; -import java.util.*; - -import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.BOSSINFO; -import static net.minecraftforge.fml.VersionChecker.Status.BETA; -import static net.minecraftforge.fml.VersionChecker.Status.BETA_OUTDATED; -import static org.lwjgl.opengl.GL11.*; -import static org.lwjgl.opengl.GL20.*; public class ForgeHooksClient { @@ -162,26 +182,25 @@ public class ForgeHooksClient return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent(context, info, target, subID, partialTicks)); } - public static void dispatchRenderLast(WorldRenderer context, float partialTicks) + public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks) { - MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, partialTicks)); + MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, mat, partialTicks)); } - public static boolean renderFirstPersonHand(WorldRenderer context, float partialTicks) + public static boolean renderFirstPersonHand(WorldRenderer context, MatrixStack mat, float partialTicks) { - return MinecraftForge.EVENT_BUS.post(new RenderHandEvent(context, partialTicks)); + return MinecraftForge.EVENT_BUS.post(new RenderHandEvent(context, mat, partialTicks)); } - public static boolean renderSpecificFirstPersonHand(Hand hand, float partialTicks, float interpPitch, float swingProgress, float equipProgress, ItemStack stack) + public static boolean renderSpecificFirstPersonHand(Hand hand, MatrixStack mat, float partialTicks, float interpPitch, float swingProgress, float equipProgress, ItemStack stack) { - return MinecraftForge.EVENT_BUS.post(new RenderSpecificHandEvent(hand, partialTicks, interpPitch, swingProgress, equipProgress, stack)); + return MinecraftForge.EVENT_BUS.post(new RenderSpecificHandEvent(hand, mat, partialTicks, interpPitch, swingProgress, equipProgress, stack)); } public static void onTextureStitchedPre(AtlasTexture map, Set resourceLocations) { ModLoader.get().postEvent(new TextureStitchEvent.Pre(map, resourceLocations)); // ModelLoader.White.INSTANCE.register(map); // TODO Custom TAS - ModelDynBucket.LoaderDynBucket.INSTANCE.register(map); } public static void onTextureStitchedPost(AtlasTexture map) @@ -199,9 +218,9 @@ public class ForgeHooksClient ModLoader.get().postEvent(new ColorHandlerEvent.Item(itemColors, blockColors)); } - static final ThreadLocal renderLayer = new ThreadLocal(); + static final ThreadLocal renderLayer = new ThreadLocal(); - public static void setRenderLayer(BlockRenderLayer layer) + public static void setRenderLayer(RenderType layer) { renderLayer.set(layer); } @@ -282,8 +301,8 @@ public class ForgeHooksClient for (int z = -distance; z <= distance; ++z) { BlockPos pos = center.add(x, 0, z); - Biome biome = world.getBiome(pos); - int colour = biome.getSkyColorByTemp(biome.getTemperature(pos)); + Biome biome = world.func_225526_b_(pos.getX(), pos.getY(), pos.getZ()); + int colour = 0xFFFFFF; // TODO: biome.getSkyColorByTemp(biome.getTemperature(pos)); r += (colour & 0xFF0000) >> 16; g += (colour & 0x00FF00) >> 8; b += colour & 0x0000FF; @@ -356,21 +375,21 @@ public class ForgeHooksClient MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Post(screen, mouseX, mouseY, partialTicks)); } - public static float getFogDensity(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, float partial, float density) + public static float getFogDensity(FogType type, ActiveRenderInfo info, float partial, float density) { - EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(fogRenderer, renderer, info, partial, density); + EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(type, info, partial, density); if (MinecraftForge.EVENT_BUS.post(event)) return event.getDensity(); return -1; } - public static void onFogRender(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, float partial, int mode, float distance) + public static void onFogRender(FogType type, ActiveRenderInfo info, float partial, float distance) { - MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(fogRenderer, renderer, info, partial, mode, distance)); + MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(type, info, partial, distance)); } - - public static EntityViewRenderEvent.CameraSetup onCameraSetup(GameRenderer renderer, ActiveRenderInfo info, float partial, float yaw, float pitch, float roll) + + public static EntityViewRenderEvent.CameraSetup onCameraSetup(GameRenderer renderer, ActiveRenderInfo info, float partial) { - EntityViewRenderEvent.CameraSetup event = new EntityViewRenderEvent.CameraSetup(renderer, info, partial, yaw, pitch, roll); + EntityViewRenderEvent.CameraSetup event = new EntityViewRenderEvent.CameraSetup(renderer, info, partial, info.getYaw(), info.getPitch(), 0); MinecraftForge.EVENT_BUS.post(event); return event; } @@ -386,7 +405,7 @@ public class ForgeHooksClient { Matrix4f m = new Matrix4f(), t = new Matrix4f(); m.setIdentity(); - m.setTranslation(TRSRTransformation.toVecmath(transform.translation)); + m.setTranslation(TransformationHelper.toVecmath(transform.translation)); t.setIdentity(); t.rotY(transform.rotation.getY()); m.mul(t); @@ -404,32 +423,40 @@ public class ForgeHooksClient return m; } - private static final Matrix4f flipX; + private static final net.minecraft.client.renderer.Matrix4f flipX; static { - flipX = new Matrix4f(); - flipX.setIdentity(); - flipX.m00 = -1; + + flipX = new net.minecraft.client.renderer.Matrix4f(new float[]{ + -1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + }); } - public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery) + public static IBakedModel handleCameraTransforms(MatrixStack matrixStack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery) { - Pair pair = model.handlePerspective(cameraTransformType); + MatrixStack stack = new MatrixStack(); + model = model.handlePerspective(cameraTransformType, stack); - if (pair.getRight() != null) + // If the stack is not empty, the code has added a matrix for us to use. + if (!stack.func_227867_d_()) { - Matrix4f matrix = new Matrix4f(pair.getRight()); + // TODO normal matrix? + net.minecraft.client.renderer.Matrix4f tMat = stack.func_227866_c_().func_227870_a_(); if (leftHandHackery) { - matrix.mul(flipX, matrix); - matrix.mul(matrix, flipX); + tMat.multiplyBackward(flipX); + tMat.func_226595_a_(flipX); } - multiplyCurrentGlMatrix(matrix); + matrixStack.func_227866_c_().func_227870_a_().func_226595_a_(tMat); } - return pair.getLeft(); + return model; } private static final FloatBuffer matrixBuf = BufferUtils.createFloatBuffer(16); + @Deprecated public static void multiplyCurrentGlMatrix(Matrix4f matrix) { matrixBuf.clear(); @@ -447,7 +474,7 @@ public class ForgeHooksClient public static void preDraw(Usage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer) { - VertexFormatElement attr = format.getElement(element); + VertexFormatElement attr = format.func_227894_c_().get(element); int count = attr.getElementCount(); int constant = attr.getType().getGlConstant(); buffer.position(format.getOffset(element)); @@ -470,10 +497,10 @@ public class ForgeHooksClient glEnableClientState(GL_COLOR_ARRAY); break; case UV: - GLX.glClientActiveTexture(GLX.GL_TEXTURE0 + attr.getIndex()); + GL13.glClientActiveTexture(GL13.GL_TEXTURE0 + attr.getIndex()); glTexCoordPointer(count, constant, stride, buffer); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - GLX.glClientActiveTexture(GLX.GL_TEXTURE0); + GL13.glClientActiveTexture(GL13.GL_TEXTURE0); break; case PADDING: break; @@ -488,7 +515,7 @@ public class ForgeHooksClient public static void postDraw(Usage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer) { - VertexFormatElement attr = format.getElement(element); + VertexFormatElement attr = format.func_227894_c_().get(element); switch(attrType) { case POSITION: @@ -499,13 +526,11 @@ public class ForgeHooksClient break; case COLOR: glDisableClientState(GL_COLOR_ARRAY); - // is this really needed? - GlStateManager.clearCurrentColor(); break; case UV: - GLX.glClientActiveTexture(GLX.GL_TEXTURE0 + attr.getIndex()); + GL13.glClientActiveTexture(GL13.GL_TEXTURE0 + attr.getIndex()); glDisableClientState(GL_TEXTURE_COORD_ARRAY); - GLX.glClientActiveTexture(GLX.GL_TEXTURE0); + GL13.glClientActiveTexture(GL13.GL_TEXTURE0); break; case PADDING: break; @@ -527,7 +552,7 @@ public class ForgeHooksClient public static Matrix4f getMatrix(ModelRotation modelRotation) { - Matrix4f ret = new Matrix4f(TRSRTransformation.toVecmath(modelRotation.func_217650_a()), new Vector3f(), 1), tmp = new Matrix4f(); + Matrix4f ret = TransformationHelper.toVecmath(modelRotation.func_225615_b_().func_227988_c_()), tmp = new Matrix4f(); tmp.setIdentity(); tmp.m03 = tmp.m13 = tmp.m23 = .5f; ret.mul(tmp, ret); @@ -537,15 +562,24 @@ public class ForgeHooksClient return ret; } - public static void putQuadColor(BufferBuilder renderer, BakedQuad quad, int color) + public static int getColorIndex(VertexFormat fmt) + { + ImmutableList elements = fmt.func_227894_c_(); + for(int i=0;i>> 8) & 0xFF; - float cr = (color >>> 16) & 0xFF; - float ca = (color >>> 24) & 0xFF; VertexFormat format = quad.getFormat(); int size = format.getIntegerSize(); - int offset = format.getColorOffset() / 4; // assumes that color is aligned + int offset = format.getOffset(getColorIndex(format)) / 4; // assumes that color is aligned boolean hasColor = format.hasColor(); for(int i = 0; i < 4; i++) { @@ -560,18 +594,17 @@ public class ForgeHooksClient int nca = Math.min(0xFF, (int)(ca * vca / 0xFF)); renderer.putColorRGBA(renderer.getColorIndex(4 - i), ncr, ncg, ncb, nca); } - } + }*/ - public static TextureAtlasSprite[] getFluidSprites(IEnviromentBlockReader world, BlockPos pos, IFluidState fluidStateIn) + public static TextureAtlasSprite[] getFluidSprites(ILightReader world, BlockPos pos, IFluidState fluidStateIn) { - AtlasTexture atlas = Minecraft.getInstance().getTextureMap(); return new TextureAtlasSprite[] { - atlas.getSprite(fluidStateIn.getFluid().getAttributes().getStill(world, pos)), - atlas.getSprite(fluidStateIn.getFluid().getAttributes().getFlowing(world, pos)), + fluidStateIn.getFluid().getAttributes().getStillMaterial(world, pos).func_229314_c_(), + fluidStateIn.getFluid().getAttributes().getFlowingMaterial(world, pos).func_229314_c_(), }; } - public static void gatherFluidTextures(Set textures) + public static void gatherFluidTextures(Set textures) { ForgeRegistries.FLUIDS.getValues().stream() .flatMap(f -> f.getAttributes().getTextures()) @@ -581,7 +614,7 @@ public class ForgeHooksClient private static class LightGatheringTransformer extends QuadGatheringTransformer { - private static final VertexFormat FORMAT = new VertexFormat().addElement(DefaultVertexFormats.TEX_2F).addElement(DefaultVertexFormats.TEX_2S); + private static final VertexFormat FORMAT = new VertexFormat(ImmutableList.of(DefaultVertexFormats.TEX_2F, DefaultVertexFormats.TEX_2S)); int blockLight, skyLight; @@ -626,7 +659,8 @@ public class ForgeHooksClient private static final LightGatheringTransformer lightGatherer = new LightGatheringTransformer(); - public static void renderLitItem(ItemRenderer ri, IBakedModel model, int color, ItemStack stack) + // TODO: Fix: Vanilla now batches rendering items, so our hack of forcing the GL lighting state does not work. + public static void renderLitItem(ItemRenderer ri, MatrixStack mat, IVertexBuilder consumer, IBakedModel model, ItemStack stack) { List allquads = new ArrayList<>(); Random random = new Random(); @@ -635,11 +669,11 @@ public class ForgeHooksClient for (Direction enumfacing : Direction.values()) { random.setSeed(seed); - allquads.addAll(model.getQuads(null, enumfacing, random)); + allquads.addAll(model.getQuads(null, enumfacing, random, EmptyModelData.INSTANCE)); } random.setSeed(seed); - allquads.addAll(model.getQuads(null, null, random)); + allquads.addAll(model.getQuads(null, null, random, EmptyModelData.INSTANCE)); if (allquads.isEmpty()) return; @@ -665,10 +699,9 @@ public class ForgeHooksClient int bl = 0; int sl = 0; - // Fail-fast on ITEM, as it cannot have light data - if (q.getFormat() != DefaultVertexFormats.ITEM && q.getFormat().hasUv(1)) + if (q.getFormat().hasUV(1)) { - q.pipe(lightGatherer); + LightUtil.putBakedQuad(lightGatherer, q); if (lightGatherer.hasLighting()) { bl = lightGatherer.blockLight; @@ -685,9 +718,7 @@ public class ForgeHooksClient if (lightingDirty || shadeDirty) { if (i > 0) // Make sure this isn't the first quad being processed - { - drawSegment(ri, color, stack, segment, segmentBlockLight, segmentSkyLight, segmentShading, segmentLightingDirty && (hasLighting || segment.size() < i), segmentShadingDirty); - } + drawSegment(ri, mat, consumer, stack, segment, segmentBlockLight, segmentSkyLight, segmentShading, segmentLightingDirty && (hasLighting || segment.size() < i), segmentShadingDirty); segmentBlockLight = bl; segmentSkyLight = sl; segmentShading = shade; @@ -699,50 +730,47 @@ public class ForgeHooksClient segment.add(q); } - drawSegment(ri, color, stack, segment, segmentBlockLight, segmentSkyLight, segmentShading, segmentLightingDirty && (hasLighting || segment.size() < allquads.size()), segmentShadingDirty); + drawSegment(ri, mat, consumer, stack, segment, segmentBlockLight, segmentSkyLight, segmentShading, segmentLightingDirty && (hasLighting || segment.size() < allquads.size()), segmentShadingDirty); // Clean up render state if necessary if (hasLighting) { - GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, GLX.lastBrightnessX, GLX.lastBrightnessY); - GlStateManager.enableLighting(); + RenderSystem.glMultiTexCoord2f(GL13.GL_TEXTURE1, GlStateManager.lastBrightnessX, GlStateManager.lastBrightnessY); + RenderSystem.enableLighting(); } } - private static void drawSegment(ItemRenderer ri, int baseColor, ItemStack stack, List segment, int bl, int sl, boolean shade, boolean updateLighting, boolean updateShading) + private static void drawSegment(ItemRenderer ir, MatrixStack mat, IVertexBuilder cons, ItemStack stack, List segment, int bl, int sl, boolean shade, boolean updateLighting, boolean updateShading) { - BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); - bufferbuilder.begin(GL_QUADS, DefaultVertexFormats.ITEM); - - float lastBl = GLX.lastBrightnessX; - float lastSl = GLX.lastBrightnessY; + float lastBl = GlStateManager.lastBrightnessX; + float lastSl = GlStateManager.lastBrightnessY; if (updateShading) { if (shade) { // (Re-)enable lighting for normal look with shading - GlStateManager.enableLighting(); + RenderSystem.enableLighting(); } else { // Disable lighting to simulate a lack of diffuse lighting - GlStateManager.disableLighting(); + RenderSystem.disableLighting(); } } if (updateLighting) { // Force lightmap coords to simulate synthetic lighting - GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, Math.max(bl, lastBl), Math.max(sl, lastSl)); + RenderSystem.glMultiTexCoord2f(GL13.GL_TEXTURE1, Math.max(bl, lastBl), Math.max(sl, lastSl)); } - ri.renderQuads(bufferbuilder, segment, baseColor, stack); - Tessellator.getInstance().draw(); + // TODO can we just use this light value ?? + ir.func_229112_a_(mat, cons, segment, stack, (bl << 16) | sl, OverlayTexture.field_229196_a_); // Preserve this as it represents the "world" lighting - GLX.lastBrightnessX = lastBl; - GLX.lastBrightnessY = lastSl; + GlStateManager.lastBrightnessX = lastBl; + GlStateManager.lastBrightnessY = lastSl; segment.clear(); } @@ -769,13 +797,13 @@ public class ForgeHooksClient for(int i = 0; i < 4; i++) { - faceData[i * 7 + 6] = normal; + faceData[i * 8 + 6] = normal; } } private static Vector3f getVertexPos(int[] data, int vertex) { - int idx = vertex * 7; + int idx = vertex * 8; float x = Float.intBitsToFloat(data[idx]); float y = Float.intBitsToFloat(data[idx + 1]); @@ -784,25 +812,6 @@ public class ForgeHooksClient return new Vector3f(x, y, z); } - @SuppressWarnings("deprecation") - public static Optional applyTransform(ItemTransformVec3f transform, Optional part) - { - if(part.isPresent()) return Optional.empty(); - return Optional.of(TRSRTransformation.blockCenterToCorner(TRSRTransformation.from(transform))); - } - - public static Optional applyTransform(ModelRotation rotation, Optional part) - { - if(part.isPresent()) return Optional.empty(); - return Optional.of(TRSRTransformation.from(rotation)); - } - - public static Optional applyTransform(Matrix4f matrix, Optional part) - { - if(part.isPresent()) return Optional.empty(); - return Optional.of(new TRSRTransformation(matrix)); - } - public static void loadEntityShader(Entity entity, GameRenderer entityRenderer) { if (entity != null) @@ -815,12 +824,6 @@ public class ForgeHooksClient } } - public static IBakedModel getDamageModel(IBakedModel ibakedmodel, TextureAtlasSprite texture, BlockState state, IEnviromentBlockReader world, BlockPos pos, long randomPosition) - { - state = state.getBlock().getExtendedState(state, world, pos); - return (new SimpleBakedModel.Builder(state, ibakedmodel, texture, new Random(), randomPosition)).build(); - } - private static int slotMainHand = 0; public static boolean shouldCauseReequipAnimation(@Nonnull ItemStack from, @Nonnull ItemStack to, int slot) @@ -840,10 +843,10 @@ public class ForgeHooksClient return from.getItem().shouldCauseReequipAnimation(from, to, changed); } - public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, Direction originalSide, ITransformation rotation) + public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, Direction originalSide, TransformationMatrix rotation, ResourceLocation p_228824_9_) { - TRSRTransformation global = new TRSRTransformation(rotation.getMatrixVec()); - Matrix4f uv = global.getUVLockTransform(originalSide).getMatrixVec(); + TransformationMatrix global = new TransformationMatrix(rotation.func_227988_c_()); + Matrix4f uv = TransformationHelper.toVecmath(TransformationHelper.getUVLockTransform(global, originalSide).func_227988_c_()); Vector4f vec = new Vector4f(0, 0, 0, 1); float u0 = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(0)); float v0 = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(0)); @@ -903,12 +906,15 @@ public class ForgeHooksClient } @SuppressWarnings("deprecation") - public static Pair handlePerspective(IBakedModel model, ItemCameraTransforms.TransformType type) + public static IBakedModel handlePerspective(IBakedModel model, ItemCameraTransforms.TransformType type, MatrixStack stack) { - TRSRTransformation tr = TRSRTransformation.from(model.getItemCameraTransforms().getTransform(type)); - Matrix4f mat = null; - if(!tr.equals(TRSRTransformation.identity())) mat = tr.getMatrixVec(); - return Pair.of(model, mat); + if (!model.getItemCameraTransforms().getTransform(type).equals(ItemTransformVec3f.DEFAULT)) + { + // Push to the matrix to make it not empty and indicate that we want to transform things + stack.func_227860_a_(); + model.getItemCameraTransforms().getTransform(type).func_228830_a_(false, stack); + } + return model; } public static void onInputUpdate(PlayerEntity player, MovementInput movementInput) @@ -960,7 +966,7 @@ public class ForgeHooksClient public static boolean onGuiMouseScrollPre(MouseHelper mouseHelper, Screen guiScreen, double scrollDelta) { - MainWindow mainWindow = guiScreen.getMinecraft().mainWindow; + MainWindow mainWindow = guiScreen.getMinecraft().func_228018_at_(); double mouseX = mouseHelper.getMouseX() * (double) mainWindow.getScaledWidth() / (double) mainWindow.getWidth(); double mouseY = mouseHelper.getMouseY() * (double) mainWindow.getScaledHeight() / (double) mainWindow.getHeight(); Event event = new GuiScreenEvent.MouseScrollEvent.Pre(guiScreen, mouseX, mouseY, scrollDelta); @@ -969,7 +975,7 @@ public class ForgeHooksClient public static boolean onGuiMouseScrollPost(MouseHelper mouseHelper, Screen guiScreen, double scrollDelta) { - MainWindow mainWindow = guiScreen.getMinecraft().mainWindow; + MainWindow mainWindow = guiScreen.getMinecraft().func_228018_at_(); double mouseX = mouseHelper.getMouseX() * (double) mainWindow.getScaledWidth() / (double) mainWindow.getWidth(); double mouseY = mouseHelper.getMouseY() * (double) mainWindow.getScaledHeight() / (double) mainWindow.getHeight(); Event event = new GuiScreenEvent.MouseScrollEvent.Post(guiScreen, mouseX, mouseY, scrollDelta); diff --git a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java index 58ad9460c..3de521420 100644 --- a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java +++ b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java @@ -46,20 +46,17 @@ import net.minecraft.client.renderer.chunk.ChunkRenderCache; import net.minecraft.client.renderer.texture.NativeImage; import net.minecraft.resources.IResource; import net.minecraft.resources.IResourceManager; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; -import net.minecraftforge.client.model.IModel; -import net.minecraftforge.client.model.data.IModelData; public class MinecraftForgeClient { + /* TODO: reimplement public static BlockRenderLayer getRenderLayer() { return ForgeHooksClient.renderLayer.get(); - } + }*/ /** * returns the Locale set by the player in Minecraft. diff --git a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java index fb87eab7c..b2c43ffb7 100644 --- a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java +++ b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java @@ -19,16 +19,11 @@ package net.minecraftforge.client.event; -import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.renderer.FogRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.fluid.IFluidState; +import net.minecraft.client.renderer.FogRenderer.FogType; +import net.minecraft.client.renderer.GameRenderer; import net.minecraftforge.eventbus.api.Cancelable; -import net.minecraftforge.eventbus.api.Event; - -import net.minecraftforge.eventbus.api.Event.HasResult; /** * Event that hooks into GameRenderer, allowing any feature to customize visual attributes @@ -64,15 +59,14 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. private static class FogEvent extends EntityViewRenderEvent { - private final FogRenderer fogRenderer; - - protected FogEvent(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks) + private final FogType type; + protected FogEvent(FogType type, ActiveRenderInfo info, double renderPartialTicks) { - super(renderer, info, renderPartialTicks); - this.fogRenderer = fogRenderer; + super(Minecraft.getInstance().gameRenderer, info, renderPartialTicks); + this.type = type; } - public FogRenderer getFogRenderer() { return fogRenderer; } + public FogType getType() { return type; } } /** @@ -84,9 +78,9 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. { private float density; - public FogDensity(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks, float density) + public FogDensity(FogType type, ActiveRenderInfo info, float partialTicks, float density) { - super(fogRenderer, renderer, info, renderPartialTicks); + super(type, info, partialTicks); this.setDensity(density); } @@ -107,19 +101,12 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. @HasResult public static class RenderFogEvent extends FogEvent { - private final int fogMode; private final float farPlaneDistance; - public RenderFogEvent(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks, int fogMode, float farPlaneDistance) + public RenderFogEvent(FogType type, ActiveRenderInfo info, float partialTicks, float distance) { - super(fogRenderer, renderer, info, renderPartialTicks); - this.fogMode = fogMode; - this.farPlaneDistance = farPlaneDistance; - } - - public int getFogMode() - { - return fogMode; + super(type, info, partialTicks); + this.farPlaneDistance = distance; } public float getFarPlaneDistance() @@ -132,15 +119,15 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. * Event that allows any feature to customize the color of fog the player sees. * NOTE: Any change made to one of the color variables will affect the result seen in-game. */ - public static class FogColors extends FogEvent + public static class FogColors extends EntityViewRenderEvent { private float red; private float green; private float blue; - public FogColors(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks, float red, float green, float blue) + public FogColors(ActiveRenderInfo info, float partialTicks, float red, float green, float blue) { - super(fogRenderer, renderer, info, renderPartialTicks); + super(Minecraft.getInstance().gameRenderer, info, partialTicks); this.setRed(red); this.setGreen(green); this.setBlue(blue); diff --git a/src/main/java/net/minecraftforge/client/event/PlayerSPPushOutOfBlocksEvent.java b/src/main/java/net/minecraftforge/client/event/PlayerSPPushOutOfBlocksEvent.java index cb7fc9c51..eb4ba3d03 100644 --- a/src/main/java/net/minecraftforge/client/event/PlayerSPPushOutOfBlocksEvent.java +++ b/src/main/java/net/minecraftforge/client/event/PlayerSPPushOutOfBlocksEvent.java @@ -20,28 +20,30 @@ package net.minecraftforge.client.event; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.Cancelable; -import javax.annotation.Nonnull; - /** * This event is called before the pushOutOfBlocks calls in EntityPlayerSP. * * Cancelling the event will prevent pushOutOfBlocks from being called. */ -@net.minecraftforge.eventbus.api.Cancelable +@Cancelable public class PlayerSPPushOutOfBlocksEvent extends PlayerEvent { - private AxisAlignedBB entityBoundingBox; + private double minY; - public PlayerSPPushOutOfBlocksEvent(PlayerEntity player, AxisAlignedBB entityBoundingBox) + public PlayerSPPushOutOfBlocksEvent(PlayerEntity player) { super(player); - this.entityBoundingBox = entityBoundingBox; + this.minY = player.func_226278_cu_() + 0.5D; } - public AxisAlignedBB getEntityBoundingBox() { return entityBoundingBox; } - public void setEntityBoundingBox(@Nonnull AxisAlignedBB entityBoundingBox) { this.entityBoundingBox = entityBoundingBox; } + public void setMinY(double value) { + this.minY = value; + } + + public double getMinY() { + return this.minY; + } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java index 68862cf47..79d83e00b 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java @@ -19,7 +19,8 @@ package net.minecraftforge.client.event; -import net.minecraft.block.Block; +import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; @@ -29,8 +30,8 @@ import net.minecraftforge.eventbus.api.Event; /** * Called when a block's texture is going to be overlaid on the player's HUD. Cancel this event to prevent the overlay. */ -@net.minecraftforge.eventbus.api.Cancelable -public class RenderBlockOverlayEvent extends net.minecraftforge.eventbus.api.Event +@Cancelable +public class RenderBlockOverlayEvent extends Event { public static enum OverlayType { @@ -38,15 +39,15 @@ public class RenderBlockOverlayEvent extends net.minecraftforge.eventbus.api.Eve } private final PlayerEntity player; - private final float renderPartialTicks; + private final MatrixStack mat; private final OverlayType overlayType; private final BlockState blockForOverlay; private final BlockPos blockPos; - public RenderBlockOverlayEvent(PlayerEntity player, float renderPartialTicks, OverlayType type, BlockState block, BlockPos blockPos) + public RenderBlockOverlayEvent(PlayerEntity player, MatrixStack mat, OverlayType type, BlockState block, BlockPos blockPos) { this.player = player; - this.renderPartialTicks = renderPartialTicks; + this.mat = mat; this.overlayType = type; this.blockForOverlay = block; this.blockPos = blockPos; @@ -57,7 +58,7 @@ public class RenderBlockOverlayEvent extends net.minecraftforge.eventbus.api.Eve * The player which the overlay will apply to */ public PlayerEntity getPlayer() { return player; } - public float getRenderPartialTicks() { return renderPartialTicks; } + public MatrixStack getMatrixStack() { return mat; } /** * The type of overlay to occur */ diff --git a/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java b/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java index 6d780f1d6..039d01a2e 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java @@ -19,8 +19,8 @@ package net.minecraftforge.client.event; -import net.minecraftforge.eventbus.api.Cancelable; -import net.minecraftforge.eventbus.api.Event; +import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.client.renderer.WorldRenderer; /** @@ -34,10 +34,12 @@ import net.minecraft.client.renderer.WorldRenderer; public class RenderHandEvent extends net.minecraftforge.eventbus.api.Event { private final WorldRenderer context; + private final MatrixStack mat; private final float partialTicks; - public RenderHandEvent(WorldRenderer context, float partialTicks) + public RenderHandEvent(WorldRenderer context, MatrixStack mat, float partialTicks) { this.context = context; + this.mat = mat; this.partialTicks = partialTicks; } @@ -46,6 +48,11 @@ public class RenderHandEvent extends net.minecraftforge.eventbus.api.Event return context; } + public MatrixStack getMatrixStack() + { + return mat; + } + public float getPartialTicks() { return partialTicks; diff --git a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java index 6f52a0dee..8727f26c2 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java @@ -19,6 +19,7 @@ package net.minecraftforge.client.event; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; import net.minecraft.client.renderer.entity.LivingRenderer; @@ -30,49 +31,44 @@ public abstract class RenderLivingEvent renderer; private final float partialRenderTick; - private final double x; - private final double y; - private final double z; + private final MatrixStack matrixStack; - public RenderLivingEvent(LivingEntity entity, LivingRenderer renderer, float partialRenderTick, double x, double y, double z) + public RenderLivingEvent(LivingEntity entity, LivingRenderer renderer, float partialRenderTick, MatrixStack matrixStack) { this.entity = entity; this.renderer = renderer; this.partialRenderTick = partialRenderTick; - this.x = x; - this.y = y; - this.z = z; + this.matrixStack = matrixStack; } public LivingEntity getEntity() { return entity; } public LivingRenderer getRenderer() { return renderer; } public float getPartialRenderTick() { return partialRenderTick; } - public double getX() { return x; } - public double getY() { return y; } - public double getZ() { return z; } + public MatrixStack getMatrixStack() { return matrixStack; } @Cancelable public static class Pre> extends RenderLivingEvent { - public Pre(LivingEntity entity, LivingRenderer renderer, float partialRenderTick, double x, double y, double z){ super(entity, renderer, partialRenderTick, x, y, z); } + public Pre(LivingEntity entity, LivingRenderer renderer, float partialRenderTick, MatrixStack matrixStack){ super(entity, renderer, partialRenderTick, matrixStack); } } public static class Post> extends RenderLivingEvent { - public Post(LivingEntity entity, LivingRenderer renderer, float partialRenderTick, double x, double y, double z){ super(entity, renderer, partialRenderTick, x, y, z); } + public Post(LivingEntity entity, LivingRenderer renderer, float partialRenderTick, MatrixStack matrixStack){ super(entity, renderer, partialRenderTick, matrixStack); } } + // TODO: 1.15 moved all name rendering to EntityRenderer, such that there's not a Living-specific feature anymore public abstract static class Specials> extends RenderLivingEvent { - public Specials(LivingEntity entity, LivingRenderer renderer, double x, double y, double z){ super(entity, renderer, 0, x, y, z); } + public Specials(LivingEntity entity, LivingRenderer renderer, MatrixStack matrixStack){ super(entity, renderer, 0, matrixStack); } @Cancelable public static class Pre> extends Specials { - public Pre(LivingEntity entity, LivingRenderer renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Pre(LivingEntity entity, LivingRenderer renderer, MatrixStack matrixStack){ super(entity, renderer, matrixStack); } } public static class Post> extends Specials { - public Post(LivingEntity entity, LivingRenderer renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Post(LivingEntity entity, LivingRenderer renderer, MatrixStack matrixStack){ super(entity, renderer, matrixStack); } } } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java b/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java index 2dba78223..10204c66f 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java @@ -19,6 +19,7 @@ package net.minecraftforge.client.event; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraft.client.renderer.entity.PlayerRenderer; import net.minecraft.entity.player.PlayerEntity; @@ -31,35 +32,29 @@ public abstract class RenderPlayerEvent extends PlayerEvent { private final PlayerRenderer renderer; private final float partialRenderTick; - private final double x; - private final double y; - private final double z; + private final MatrixStack stack; - public RenderPlayerEvent(PlayerEntity player, PlayerRenderer renderer, float partialRenderTick, double x, double y, double z) + public RenderPlayerEvent(PlayerEntity player, PlayerRenderer renderer, float partialRenderTick, MatrixStack stack) { super(player); this.renderer = renderer; this.partialRenderTick = partialRenderTick; - this.x = x; - this.y = y; - this.z = z; + this.stack = stack; } public PlayerRenderer getRenderer() { return renderer; } public float getPartialRenderTick() { return partialRenderTick; } - public double getX() { return x; } - public double getY() { return y; } - public double getZ() { return z; } + public MatrixStack getMatrixStack() { return stack; } @net.minecraftforge.eventbus.api.Cancelable public static class Pre extends RenderPlayerEvent { - public Pre(PlayerEntity player, PlayerRenderer renderer, float tick, double x, double y, double z){ super(player, renderer, tick, x, y, z); } + public Pre(PlayerEntity player, PlayerRenderer renderer, float tick, MatrixStack stack){ super(player, renderer, tick, stack); } } public static class Post extends RenderPlayerEvent { - public Post(PlayerEntity player, PlayerRenderer renderer, float tick, double x, double y, double z){ super(player, renderer, tick, x, y, z); } + public Post(PlayerEntity player, PlayerRenderer renderer, float tick, MatrixStack stack){ super(player, renderer, tick, stack); } } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderSpecificHandEvent.java b/src/main/java/net/minecraftforge/client/event/RenderSpecificHandEvent.java index 9dad290e8..f283d610b 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderSpecificHandEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderSpecificHandEvent.java @@ -19,13 +19,15 @@ package net.minecraftforge.client.event; +import javax.annotation.Nonnull; + +import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.item.ItemStack; import net.minecraft.util.Hand; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; -import javax.annotation.Nonnull; - /** * This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS} * whenever a hand is rendered in first person. @@ -36,6 +38,7 @@ import javax.annotation.Nonnull; public class RenderSpecificHandEvent extends Event { private final Hand hand; + private final MatrixStack mat; private final float partialTicks; private final float interpolatedPitch; private final float swingProgress; @@ -43,9 +46,10 @@ public class RenderSpecificHandEvent extends Event @Nonnull private final ItemStack stack; - public RenderSpecificHandEvent(Hand hand, float partialTicks, float interpolatedPitch, float swingProgress, float equipProgress, @Nonnull ItemStack stack) + public RenderSpecificHandEvent(Hand hand, MatrixStack mat, float partialTicks, float interpolatedPitch, float swingProgress, float equipProgress, @Nonnull ItemStack stack) { this.hand = hand; + this.mat = mat; this.partialTicks = partialTicks; this.interpolatedPitch = interpolatedPitch; this.swingProgress = swingProgress; @@ -58,6 +62,11 @@ public class RenderSpecificHandEvent extends Event return hand; } + public MatrixStack getMatrixStack() + { + return mat; + } + public float getPartialTicks() { return partialTicks; diff --git a/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java b/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java index 7fc242527..12810f014 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java @@ -19,16 +19,19 @@ package net.minecraftforge.client.event; -import net.minecraftforge.eventbus.api.Event; +import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.client.renderer.WorldRenderer; public class RenderWorldLastEvent extends net.minecraftforge.eventbus.api.Event { private final WorldRenderer context; + private final MatrixStack mat; private final float partialTicks; - public RenderWorldLastEvent(WorldRenderer context, float partialTicks) + public RenderWorldLastEvent(WorldRenderer context, MatrixStack mat, float partialTicks) { this.context = context; + this.mat = mat; this.partialTicks = partialTicks; } @@ -37,6 +40,11 @@ public class RenderWorldLastEvent extends net.minecraftforge.eventbus.api.Event return context; } + public MatrixStack getMatrixStack() + { + return mat; + } + public float getPartialTicks() { return partialTicks; diff --git a/src/main/java/net/minecraftforge/client/event/ScreenshotEvent.java b/src/main/java/net/minecraftforge/client/event/ScreenshotEvent.java index 522b71bb0..204c8f4ea 100644 --- a/src/main/java/net/minecraftforge/client/event/ScreenshotEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ScreenshotEvent.java @@ -26,6 +26,7 @@ import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; import java.io.File; +import java.io.IOException; /** * This event is fired before and after a screenshot is taken @@ -51,6 +52,9 @@ public class ScreenshotEvent extends Event { this.image = image; this.screenshotFile = screenshotFile; + try { + this.screenshotFile = screenshotFile.getCanonicalFile(); // FORGE: Fix errors on Windows with paths that include \.\ + } catch (IOException e) {} } public NativeImage getImage() diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java b/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java index 4300baa2d..5e045d723 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java @@ -24,6 +24,9 @@ import java.util.Random; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; + +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.model.BakedQuad; @@ -32,8 +35,9 @@ 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.IEnviromentBlockReader; +import net.minecraft.world.ILightReader; import net.minecraftforge.client.model.data.IModelData; +import org.apache.commons.lang3.tuple.Pair; public interface IForgeBakedModel { @@ -50,16 +54,21 @@ public interface IForgeBakedModel default boolean isAmbientOcclusion(BlockState state) { return getBakedModel().isAmbientOcclusion(); } + /** + * Override to tell the new model loader that it shouldn't wrap this model + */ + default boolean doesHandlePerspectives() { return false; } + /* * Returns the pair of the model for the given perspective, and the matrix that * should be applied to the GL state before rendering it (matrix may be null). */ - default org.apache.commons.lang3.tuple.Pair handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) + default IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat) { - return net.minecraftforge.client.ForgeHooksClient.handlePerspective(getBakedModel(), cameraTransformType); + return net.minecraftforge.client.ForgeHooksClient.handlePerspective(getBakedModel(), cameraTransformType, mat); } - default @Nonnull IModelData getModelData(@Nonnull IEnviromentBlockReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) + default @Nonnull IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) { return tileData; } diff --git a/src/main/java/net/minecraftforge/common/model/IModelState.java b/src/main/java/net/minecraftforge/client/extensions/IForgeModelTransform.java similarity index 82% rename from src/main/java/net/minecraftforge/common/model/IModelState.java rename to src/main/java/net/minecraftforge/client/extensions/IForgeModelTransform.java index a20ceeb67..7f0a69416 100644 --- a/src/main/java/net/minecraftforge/common/model/IModelState.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeModelTransform.java @@ -17,15 +17,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.common.model; +package net.minecraftforge.client.extensions; -import java.util.Optional; +import net.minecraft.client.renderer.TransformationMatrix; /** * An {@code IModelState} is a function from model part to a transformation that should be applied * when that part is baked, thus representing the current "state" of the model and its parts. */ -public interface IModelState +public interface IForgeModelTransform { /** * @param part Part of the model we are wanting to transform. An empty optional means @@ -33,5 +33,8 @@ public interface IModelState * @return A transformation to apply to the part, if any. The coordinate system of the transform * is determined by the part type. */ - Optional apply(Optional part); + default TransformationMatrix getPartTransformation(Object part) + { + return TransformationMatrix.func_227983_a_(); + } } diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeTransformationMatrix.java b/src/main/java/net/minecraftforge/client/extensions/IForgeTransformationMatrix.java new file mode 100644 index 000000000..05da5f1a5 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeTransformationMatrix.java @@ -0,0 +1,97 @@ +/* + * 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.extensions; + +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.client.renderer.Vector4f; +import net.minecraft.util.Direction; +import net.minecraftforge.common.model.TransformationHelper; + +/* + * Replacement interface for ModelRotation to allow custom transformations of vanilla models. + * You should probably use TRSRTransformation directly. + */ +public interface IForgeTransformationMatrix +{ + default TransformationMatrix getTransformaion() + { + return (TransformationMatrix)this; + } + + default boolean isIdentity() + { + return getTransformaion().equals(TransformationMatrix.func_227983_a_()); + } + + default void push(MatrixStack stack) + { + stack.func_227860_a_(); + stack.func_227863_a_(getTransformaion().func_227989_d_()); + Vector3f trans = getTransformaion().getTranslation(); + stack.func_227861_a_(trans.getX(), trans.getY(), trans.getZ()); + stack.func_227863_a_(getTransformaion().getRightRot()); + Vector3f scale = getTransformaion().getScale(); + stack.func_227861_a_(scale.getX(), scale.getY(), scale.getZ()); + } + + default TransformationMatrix compose(TransformationMatrix other) + { + if (getTransformaion().isIdentity()) return other; + if (other.isIdentity()) return getTransformaion(); + Matrix4f m = getTransformaion().func_227988_c_(); + m.func_226595_a_(other.func_227988_c_()); + return new TransformationMatrix(m); + } + + default TransformationMatrix inverse() + { + if (isIdentity()) return getTransformaion(); + javax.vecmath.Matrix4f m = TransformationHelper.toVecmath(getTransformaion().func_227988_c_()); + m.invert(); + return new TransformationMatrix(TransformationHelper.toMojang(m)); + } + + default void transformPosition(Vector4f position) + { + TransformationHelper.transform(getTransformaion().func_227988_c_(), position); + } + + default void transformNormal(Vector3f normal) + { + javax.vecmath.Vector3f copy = TransformationHelper.toVecmath(normal); + transformNormal(copy); + normal.set(copy.x, copy.y, copy.z); + } + + default void transformNormal(javax.vecmath.Vector3f normal) + { + getTransformaion().getNormalMatrix().transform(normal); + normal.normalize(); + } + + default Direction rotateTransform(Direction facing) + { + return Direction.func_229385_a_(getTransformaion().func_227988_c_(), facing); + } + +} diff --git a/src/main/java/net/minecraftforge/common/model/ITransformation.java b/src/main/java/net/minecraftforge/client/extensions/IForgeUnbakedModel.java similarity index 63% rename from src/main/java/net/minecraftforge/common/model/ITransformation.java rename to src/main/java/net/minecraftforge/client/extensions/IForgeUnbakedModel.java index 9e44fc2c1..ed317fda5 100644 --- a/src/main/java/net/minecraftforge/common/model/ITransformation.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeUnbakedModel.java @@ -17,21 +17,20 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.common.model; +package net.minecraftforge.client.extensions; -import javax.vecmath.Matrix4f; +import net.minecraftforge.common.model.animation.IClip; -import net.minecraft.util.Direction; +import java.util.Optional; -/* - * Replacement interface for ModelRotation to allow custom transformations of vanilla models. - * You should probably use TRSRTransformation directly. - */ -public interface ITransformation +public interface IForgeUnbakedModel { - Matrix4f getMatrixVec(); - - Direction rotateTransform(Direction facing); - - int rotate(Direction facing, int vertexIndex); + /** + * Retrieves information about an animation clip in the model. + * @param name The clip name + * @return + */ + default Optional getClip(String name) { + return Optional.empty(); + } } diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeVertexBuilder.java b/src/main/java/net/minecraftforge/client/extensions/IForgeVertexBuilder.java new file mode 100644 index 000000000..9b568ac7f --- /dev/null +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeVertexBuilder.java @@ -0,0 +1,92 @@ +/* + * 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.extensions; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.IVertexBuilder; +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 org.lwjgl.system.MemoryStack; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface IForgeVertexBuilder +{ + // Copy of func_227889_a_ with alpha support + default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColkor) { + addVertexData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColkor, false); + } + + // Copy of func_227890_a_ 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 p_227890_9_) { + int[] aint = bakedQuad.getVertexData(); + Vec3i faceNormal = bakedQuad.getFace().getDirectionVec(); + Vector3f normal = new Vector3f((float)faceNormal.getX(), (float)faceNormal.getY(), (float)faceNormal.getZ()); + Matrix4f matrix4f = matrixEntry.func_227870_a_(); + normal.func_229188_a_(matrixEntry.func_227872_b_()); + int intSize = DefaultVertexFormats.BLOCK.getIntegerSize(); + int vertexCount = aint.length / intSize; + + try (MemoryStack memorystack = MemoryStack.stackPush()) { + ByteBuffer bytebuffer = memorystack.malloc(DefaultVertexFormats.BLOCK.getSize()); + IntBuffer intbuffer = bytebuffer.asIntBuffer(); + + for(int v = 0; v < vertexCount; ++v) { + intbuffer.clear(); + intbuffer.put(aint, v * 8, 8); + float f = bytebuffer.getFloat(0); + float f1 = bytebuffer.getFloat(4); + float f2 = bytebuffer.getFloat(8); + float cr; + float cg; + float cb; + float ca; + if (p_227890_9_) { + float r = (float)(bytebuffer.get(12) & 255) / 255.0F; + float g = (float)(bytebuffer.get(13) & 255) / 255.0F; + float b = (float)(bytebuffer.get(14) & 255) / 255.0F; + float a = (float)(bytebuffer.get(15) & 255) / 255.0F; + cr = r * baseBrightness[v] * red; + cg = g * baseBrightness[v] * green; + cb = b * baseBrightness[v] * blue; + ca = a * alpha; + } else { + cr = baseBrightness[v] * red; + cg = baseBrightness[v] * green; + cb = baseBrightness[v] * blue; + ca = alpha; + } + + int lightmapCoord = lightmapCoords[v]; + float f9 = bytebuffer.getFloat(16); + float f10 = bytebuffer.getFloat(20); + Vector4f pos = new Vector4f(f, f1, f2, 1.0F); + pos.func_229372_a_(matrix4f); + ((IVertexBuilder)this).func_225588_a_(pos.getX(), pos.getY(), pos.getZ(), cr, cg, cb, ca, f9, f10, overlayCoords, lightmapCoord, normal.getX(), normal.getY(), normal.getZ()); + } + } + + } +} diff --git a/src/main/java/net/minecraftforge/client/ForgeIngameGui.java b/src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java similarity index 86% rename from src/main/java/net/minecraftforge/client/ForgeIngameGui.java rename to src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java index f38d07bdd..926b3bf35 100644 --- a/src/main/java/net/minecraftforge/client/ForgeIngameGui.java +++ b/src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.client; +package net.minecraftforge.client.gui; import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*; @@ -55,10 +55,10 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.common.MinecraftForge; -import com.mojang.blaze3d.platform.GlStateManager; - import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.systems.RenderSystem; + public class ForgeIngameGui extends IngameGui { //private static final ResourceLocation VIGNETTE = new ResourceLocation("textures/misc/vignette.png"); @@ -107,9 +107,9 @@ public class ForgeIngameGui extends IngameGui @Override public void renderGameOverlay(float partialTicks) { - this.scaledWidth = this.mc.mainWindow.getScaledWidth(); - this.scaledHeight = this.mc.mainWindow.getScaledHeight(); - eventParent = new RenderGameOverlayEvent(partialTicks, this.mc.mainWindow); + this.scaledWidth = this.mc.func_228018_at_().getScaledWidth(); + this.scaledHeight = this.mc.func_228018_at_().getScaledHeight(); + eventParent = new RenderGameOverlayEvent(partialTicks, this.mc.func_228018_at_()); renderHealthMount = mc.player.getRidingEntity() instanceof LivingEntity; renderFood = mc.player.getRidingEntity() == null; renderJumpBar = mc.player.isRidingHorse(); @@ -121,15 +121,15 @@ public class ForgeIngameGui extends IngameGui fontrenderer = mc.fontRenderer; //mc.entityRenderer.setupOverlayRendering(); - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); if (renderVignette && Minecraft.isFancyGraphicsEnabled()) { renderVignette(mc.getRenderViewEntity()); } else { - GlStateManager.enableDepthTest(); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderSystem.enableDepthTest(); + RenderSystem.defaultBlendFunc(); } if (renderHelmet) renderHelmet(partialTicks); @@ -149,14 +149,14 @@ public class ForgeIngameGui extends IngameGui } if (!this.mc.gameSettings.hideGUI) { - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - blitOffset = -90; + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + setBlitOffset(-90); rand.setSeed((long)(ticks * 312871)); if (renderCrosshairs) renderAttackIndicator(); if (renderBossHealth) renderBossHealth(); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + 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); @@ -207,17 +207,16 @@ public class ForgeIngameGui extends IngameGui this.renderScoreboard(scoreobjective1); } - GlStateManager.enableBlend(); - GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - GlStateManager.disableAlphaTest(); + RenderSystem.enableBlend(); + RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + RenderSystem.disableAlphaTest(); renderChat(this.scaledWidth, this.scaledHeight); renderPlayerList(this.scaledWidth, this.scaledHeight); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableLighting(); - GlStateManager.enableAlphaTest(); + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.enableAlphaTest(); post(ALL); } @@ -227,8 +226,8 @@ public class ForgeIngameGui extends IngameGui { if (pre(CROSSHAIRS)) return; bind(AbstractGui.GUI_ICONS_LOCATION); - GlStateManager.enableBlend(); - GlStateManager.enableAlphaTest(); + RenderSystem.enableBlend(); + RenderSystem.enableAlphaTest(); super.renderAttackIndicator(); post(CROSSHAIRS); } @@ -252,11 +251,11 @@ public class ForgeIngameGui extends IngameGui { if (pre(BOSSHEALTH)) return; bind(AbstractGui.GUI_ICONS_LOCATION); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderSystem.defaultBlendFunc(); mc.getProfiler().startSection("bossHealth"); - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); this.overlayBoss.render(); - GlStateManager.disableBlend(); + RenderSystem.disableBlend(); mc.getProfiler().endSection(); post(BOSSHEALTH); } @@ -267,8 +266,8 @@ public class ForgeIngameGui extends IngameGui if (pre(VIGNETTE)) { // Need to put this here, since Vanilla assumes this state after the vignette was rendered. - GlStateManager.enableDepthTest(); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderSystem.enableDepthTest(); + RenderSystem.defaultBlendFunc(); return; } super.renderVignette(entity); @@ -302,7 +301,7 @@ public class ForgeIngameGui extends IngameGui if (pre(ARMOR)) return; mc.getProfiler().startSection("armor"); - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); int left = width / 2 - 91; int top = height - left_height; @@ -325,7 +324,7 @@ public class ForgeIngameGui extends IngameGui } left_height += 10; - GlStateManager.disableBlend(); + RenderSystem.disableBlend(); mc.getProfiler().endSection(); post(ARMOR); } @@ -373,7 +372,7 @@ public class ForgeIngameGui extends IngameGui if (pre(AIR)) return; mc.getProfiler().startSection("air"); PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity(); - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); int left = width / 2 + 91; int top = height - right_height; @@ -390,7 +389,7 @@ public class ForgeIngameGui extends IngameGui right_height += 10; } - GlStateManager.disableBlend(); + RenderSystem.disableBlend(); mc.getProfiler().endSection(); post(AIR); } @@ -400,7 +399,7 @@ public class ForgeIngameGui extends IngameGui bind(GUI_ICONS_LOCATION); if (pre(HEALTH)) return; mc.getProfiler().startSection("health"); - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity(); int health = MathHelper.ceil(player.getHealth()); @@ -496,7 +495,7 @@ public class ForgeIngameGui extends IngameGui } } - GlStateManager.disableBlend(); + RenderSystem.disableBlend(); mc.getProfiler().endSection(); post(HEALTH); } @@ -507,7 +506,7 @@ public class ForgeIngameGui extends IngameGui mc.getProfiler().startSection("food"); PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity(); - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); int left = width / 2 + 91; int top = height - right_height; right_height += 10; @@ -543,7 +542,7 @@ public class ForgeIngameGui extends IngameGui else if (idx == level) blit(x, y, icon + 45, 27, 9, 9); } - GlStateManager.disableBlend(); + RenderSystem.disableBlend(); mc.getProfiler().endSection(); post(FOOD); } @@ -553,8 +552,8 @@ public class ForgeIngameGui extends IngameGui if (mc.player.getSleepTimer() > 0) { mc.getProfiler().startSection("sleep"); - GlStateManager.disableDepthTest(); - GlStateManager.disableAlphaTest(); + RenderSystem.disableDepthTest(); + RenderSystem.disableAlphaTest(); int sleepTime = mc.player.getSleepTimer(); float opacity = (float)sleepTime / 100.0F; @@ -565,8 +564,8 @@ public class ForgeIngameGui extends IngameGui int color = (int)(220.0F * opacity) << 24 | 1052704; fill(0, 0, width, height, color); - GlStateManager.enableAlphaTest(); - GlStateManager.enableDepthTest(); + RenderSystem.enableAlphaTest(); + RenderSystem.enableDepthTest(); mc.getProfiler().endSection(); } } @@ -575,15 +574,15 @@ public class ForgeIngameGui extends IngameGui { bind(GUI_ICONS_LOCATION); if (pre(EXPERIENCE)) return; - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableBlend(); + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.disableBlend(); if (mc.playerController.gameIsSurvivalOrAdventure()) { super.renderExpBar(x); } - GlStateManager.enableBlend(); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.enableBlend(); + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); post(EXPERIENCE); } @@ -594,11 +593,11 @@ public class ForgeIngameGui extends IngameGui bind(GUI_ICONS_LOCATION); if (pre(JUMPBAR)) return; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableBlend(); + RenderSystem.disableBlend(); super.renderHorseJumpBar(x); - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); mc.getProfiler().endSection(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -608,7 +607,7 @@ public class ForgeIngameGui extends IngameGui protected void renderHUDText(int width, int height) { mc.getProfiler().startSection("forgeHudText"); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderSystem.defaultBlendFunc(); ArrayList listL = new ArrayList(); ArrayList listR = new ArrayList(); @@ -681,14 +680,14 @@ public class ForgeIngameGui extends IngameGui if (opacity > 0) { - GlStateManager.pushMatrix(); - GlStateManager.translatef((float)(width / 2), (float)(height - 68), 0.0F); - GlStateManager.enableBlend(); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderSystem.pushMatrix(); + RenderSystem.translatef((float)(width / 2), (float)(height - 68), 0.0F); + RenderSystem.enableBlend(); + RenderSystem.defaultBlendFunc(); int color = (animateOverlayMessageColor ? MathHelper.hsvToRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE); fontrenderer.drawStringWithShadow(overlayMessage, -fontrenderer.getStringWidth(overlayMessage) / 2, -4, color | (opacity << 24)); - GlStateManager.disableBlend(); - GlStateManager.popMatrix(); + RenderSystem.disableBlend(); + RenderSystem.popMatrix(); } mc.getProfiler().endSection(); @@ -714,21 +713,21 @@ public class ForgeIngameGui extends IngameGui if (opacity > 8) { - GlStateManager.pushMatrix(); - GlStateManager.translatef((float)(width / 2), (float)(height / 2), 0.0F); - GlStateManager.enableBlend(); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.pushMatrix(); - GlStateManager.scalef(4.0F, 4.0F, 4.0F); + RenderSystem.pushMatrix(); + RenderSystem.translatef((float)(width / 2), (float)(height / 2), 0.0F); + RenderSystem.enableBlend(); + RenderSystem.defaultBlendFunc(); + 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); - GlStateManager.popMatrix(); - GlStateManager.pushMatrix(); - GlStateManager.scalef(2.0F, 2.0F, 2.0F); + 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); - GlStateManager.popMatrix(); - GlStateManager.disableBlend(); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); + RenderSystem.disableBlend(); + RenderSystem.popMatrix(); } this.mc.getProfiler().endSection(); @@ -742,10 +741,10 @@ public class ForgeIngameGui extends IngameGui RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48); if (MinecraftForge.EVENT_BUS.post(event)) return; - GlStateManager.pushMatrix(); - GlStateManager.translatef((float) event.getPosX(), (float) event.getPosY(), 0.0F); + RenderSystem.pushMatrix(); + RenderSystem.translatef((float) event.getPosX(), (float) event.getPosY(), 0.0F); persistantChatGUI.render(ticks); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); post(CHAT); @@ -784,7 +783,7 @@ public class ForgeIngameGui extends IngameGui int left_align = width / 2 + 91; mc.getProfiler().endStartSection("mountHealth"); - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); LivingEntity mount = (LivingEntity)tmp; int health = (int)Math.ceil((double)mount.getHealth()); float healthMax = mount.getMaxHealth(); @@ -817,7 +816,7 @@ public class ForgeIngameGui extends IngameGui right_height += 10; } - GlStateManager.disableBlend(); + RenderSystem.disableBlend(); post(HEALTHMOUNT); } @@ -849,8 +848,8 @@ public class ForgeIngameGui extends IngameGui this.rayTraceBlock = entity.func_213324_a(rayTraceDistance, 0.0F, false); this.rayTraceFluid = entity.func_213324_a(rayTraceDistance, 0.0F, true); } - @Override protected void renderDebugInfoLeft(){} - @Override protected void renderDebugInfoRight(){} + @Override protected void func_230024_c_(){} + @Override protected void func_230025_d_(){} private List getLeft() { List ret = this.call(); diff --git a/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java b/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java index e34822e5e..cb6321439 100644 --- a/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java @@ -19,7 +19,7 @@ package net.minecraftforge.client.gui; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.widget.button.Button; @@ -28,7 +28,6 @@ import net.minecraft.client.gui.screen.Screen; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.ForgeMod; import net.minecraftforge.fml.loading.FMLConfig; import net.minecraftforge.versions.forge.ForgeVersion; import net.minecraftforge.fml.VersionChecker; @@ -73,8 +72,8 @@ public class NotificationModUpdateScreen extends Screen } Minecraft.getInstance().getTextureManager().bindTexture(VERSION_CHECK_ICONS); - GlStateManager.color4f(1, 1, 1, 1); - GlStateManager.pushMatrix(); + RenderSystem.color4f(1, 1, 1, 1); + RenderSystem.pushMatrix(); int x = modButton.x; int y = modButton.y; @@ -82,7 +81,7 @@ public class NotificationModUpdateScreen extends Screen 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); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); } public static NotificationModUpdateScreen init(MainMenuScreen guiMainMenu, Button modButton) diff --git a/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java b/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java index a3a799e7d..e31007051 100644 --- a/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java +++ b/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java @@ -25,6 +25,7 @@ import java.util.List; import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.AbstractGui; @@ -72,8 +73,8 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable /** * Draw anything special on the screen. GL_SCISSOR is enabled for anything that * is rendered outside of the view box. Do not mess with SCISSOR unless you support this. - * @param mouseY - * @param mouseX + * @param mouseY + * @param mouseX */ protected abstract void drawPanel(int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY); @@ -134,7 +135,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable return true; this.scrolling = button == 0 && mouseX >= barLeft && mouseX < barLeft + barWidth; - if (this.scrolling) + if (this.scrolling) { return true; } @@ -189,9 +190,9 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable Tessellator tess = Tessellator.getInstance(); BufferBuilder worldr = tess.getBuffer(); - double scale = client.mainWindow.getGuiScaleFactor(); + double scale = client.func_228018_at_().getGuiScaleFactor(); GL11.glEnable(GL11.GL_SCISSOR_TEST); - GL11.glScissor((int)(left * scale), (int)(client.mainWindow.getFramebufferHeight() - (bottom * scale)), + GL11.glScissor((int)(left * scale), (int)(client.func_228018_at_().getFramebufferHeight() - (bottom * scale)), (int)(width * scale), (int)(height * scale)); if (this.client.world != null) @@ -200,23 +201,23 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable } else // Draw dark dirt background { - GlStateManager.disableLighting(); - GlStateManager.disableFog(); + RenderSystem.disableLighting(); + RenderSystem.disableFog(); this.client.getTextureManager().bindTexture(AbstractGui.BACKGROUND_LOCATION); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); final float texScale = 32.0F; worldr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(this.left, this.bottom, 0.0D).tex(this.left / texScale, (this.bottom + (int)this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.pos(this.right, this.bottom, 0.0D).tex(this.right / texScale, (this.bottom + (int)this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.pos(this.right, this.top, 0.0D).tex(this.right / texScale, (this.top + (int)this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.pos(this.left, this.top, 0.0D).tex(this.left / texScale, (this.top + (int)this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.func_225582_a_(this.left, this.bottom, 0.0D).func_225583_a_(this.left / texScale, (this.bottom + (int)this.scrollDistance) / texScale).func_225586_a_(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.func_225582_a_(this.right, this.bottom, 0.0D).func_225583_a_(this.right / texScale, (this.bottom + (int)this.scrollDistance) / texScale).func_225586_a_(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.func_225582_a_(this.right, this.top, 0.0D).func_225583_a_(this.right / texScale, (this.top + (int)this.scrollDistance) / texScale).func_225586_a_(0x20, 0x20, 0x20, 0xFF).endVertex(); + worldr.func_225582_a_(this.left, this.top, 0.0D).func_225583_a_(this.left / texScale, (this.top + (int)this.scrollDistance) / texScale).func_225586_a_(0x20, 0x20, 0x20, 0xFF).endVertex(); tess.draw(); } int baseY = this.top + border - (int)this.scrollDistance; this.drawPanel(right, baseY, tess, mouseX, mouseY); - GlStateManager.disableDepthTest(); + RenderSystem.disableDepthTest(); int extraHeight = (this.getContentHeight() + border) - height; if (extraHeight > 0) @@ -229,31 +230,31 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable barTop = this.top; } - GlStateManager.disableTexture(); + RenderSystem.disableTexture(); worldr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(barLeft, this.bottom, 0.0D).tex(0.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(barLeft + barWidth, this.bottom, 0.0D).tex(1.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(barLeft + barWidth, this.top, 0.0D).tex(1.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); - worldr.pos(barLeft, this.top, 0.0D).tex(0.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft, this.bottom, 0.0D).func_225583_a_(0.0F, 1.0F).func_225586_a_(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft + barWidth, this.bottom, 0.0D).func_225583_a_(1.0F, 1.0F).func_225586_a_(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft + barWidth, this.top, 0.0D).func_225583_a_(1.0F, 0.0F).func_225586_a_(0x00, 0x00, 0x00, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft, this.top, 0.0D).func_225583_a_(0.0F, 0.0F).func_225586_a_(0x00, 0x00, 0x00, 0xFF).endVertex(); tess.draw(); worldr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(barLeft, barTop + barHeight, 0.0D).tex(0.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(barLeft + barWidth, barTop + barHeight, 0.0D).tex(1.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(barLeft + barWidth, barTop, 0.0D).tex(1.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); - worldr.pos(barLeft, barTop, 0.0D).tex(0.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft, barTop + barHeight, 0.0D).func_225583_a_(0.0F, 1.0F).func_225586_a_(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft + barWidth, barTop + barHeight, 0.0D).func_225583_a_(1.0F, 1.0F).func_225586_a_(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft + barWidth, barTop, 0.0D).func_225583_a_(1.0F, 0.0F).func_225586_a_(0x80, 0x80, 0x80, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft, barTop, 0.0D).func_225583_a_(0.0F, 0.0F).func_225586_a_(0x80, 0x80, 0x80, 0xFF).endVertex(); tess.draw(); worldr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); - worldr.pos(barLeft, barTop + barHeight - 1, 0.0D).tex(0.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); - worldr.pos(barLeft + barWidth - 1, barTop + barHeight - 1, 0.0D).tex(1.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); - worldr.pos(barLeft + barWidth - 1, barTop, 0.0D).tex(1.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); - worldr.pos(barLeft, barTop, 0.0D).tex(0.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft, barTop + barHeight - 1, 0.0D).func_225583_a_(0.0F, 1.0F).func_225586_a_(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft + barWidth - 1, barTop + barHeight - 1, 0.0D).func_225583_a_(1.0F, 1.0F).func_225586_a_(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft + barWidth - 1, barTop, 0.0D).func_225583_a_(1.0F, 0.0F).func_225586_a_(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); + worldr.func_225582_a_(barLeft, barTop, 0.0D).func_225583_a_(0.0F, 0.0F).func_225586_a_(0xC0, 0xC0, 0xC0, 0xFF).endVertex(); tess.draw(); } - GlStateManager.enableTexture(); - GlStateManager.shadeModel(GL11.GL_FLAT); - GlStateManager.enableAlphaTest(); - GlStateManager.disableBlend(); + RenderSystem.enableTexture(); + RenderSystem.shadeModel(GL11.GL_FLAT); + RenderSystem.enableAlphaTest(); + RenderSystem.disableBlend(); GL11.glDisable(GL11.GL_SCISSOR_TEST); } @@ -263,7 +264,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable } @Override - public List children() + public List children() { return Collections.emptyList(); } diff --git a/src/main/java/net/minecraftforge/client/model/Attributes.java b/src/main/java/net/minecraftforge/client/model/Attributes.java index 43c1b091d..9d13b15ce 100644 --- a/src/main/java/net/minecraftforge/client/model/Attributes.java +++ b/src/main/java/net/minecraftforge/client/model/Attributes.java @@ -19,6 +19,8 @@ package net.minecraftforge.client.model; +import com.google.common.collect.ImmutableList; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.client.renderer.vertex.VertexFormatElement.Type; @@ -29,16 +31,7 @@ public class Attributes /* * Default format of the data in IBakedModel */ - public static final VertexFormat DEFAULT_BAKED_FORMAT; - - static - { - DEFAULT_BAKED_FORMAT = new VertexFormat(); - DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, Type.FLOAT, Usage.POSITION, 3)); - DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, Type.UBYTE, Usage.COLOR, 4)); - DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, Type.FLOAT, Usage.UV, 2)); - DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, Type.BYTE, Usage.PADDING, 4)); - } + public static final VertexFormat DEFAULT_BAKED_FORMAT = DefaultVertexFormats.BLOCK; /* * Can first format be used where second is expected @@ -50,13 +43,15 @@ public class Attributes int padding = 0; int j = 0; - for(VertexFormatElement firstAttr : first.getElements()) + ImmutableList elementsFirst = first.func_227894_c_(); + ImmutableList elementsSecond = second.func_227894_c_(); + for(VertexFormatElement firstAttr : elementsFirst) { - while(j < second.getElementCount() && second.getElement(j).getUsage() == Usage.PADDING) + while(j < elementsSecond.size() && elementsSecond.get(j).getUsage() == Usage.PADDING) { - padding += second.getElement(j++).getSize(); + padding += elementsSecond.get(j++).getSize(); } - if(j >= second.getElementCount() && padding == 0) + if(j >= elementsSecond.size() && padding == 0) { // if no padding is left, but there are still elements in first (we're processing one) - it doesn't fit return false; @@ -64,7 +59,7 @@ public class Attributes if(padding == 0) { // no padding - attributes have to match - VertexFormatElement secondAttr = second.getElement(j++); + VertexFormatElement secondAttr = elementsSecond.get(j++); if( firstAttr.getIndex() != secondAttr.getIndex() || firstAttr.getElementCount() != secondAttr.getElementCount() || @@ -82,7 +77,7 @@ public class Attributes } } - if(padding != 0 || j != second.getElementCount()) return false; + if(padding != 0 || j != elementsSecond.size()) return false; return true; } } diff --git a/src/main/java/net/minecraftforge/client/model/BakedItemModel.java b/src/main/java/net/minecraftforge/client/model/BakedItemModel.java index 4304a3ff0..8ad625d1f 100644 --- a/src/main/java/net/minecraftforge/client/model/BakedItemModel.java +++ b/src/main/java/net/minecraftforge/client/model/BakedItemModel.java @@ -27,32 +27,26 @@ import java.util.Random; 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.BakedQuad; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.Direction; -import net.minecraftforge.common.model.TRSRTransformation; import org.apache.commons.lang3.tuple.Pair; public class BakedItemModel implements IBakedModel { protected final ImmutableList quads; protected final TextureAtlasSprite particle; - protected final ImmutableMap transforms; + protected final ImmutableMap transforms; protected final ItemOverrideList overrides; protected final IBakedModel guiModel; - /** @deprecated use {@link #BakedItemModel(ImmutableList, TextureAtlasSprite, ImmutableMap, ItemOverrideList, boolean)} */ - @Deprecated // TODO: remove - public BakedItemModel(ImmutableList quads, TextureAtlasSprite particle, ImmutableMap transforms, ItemOverrideList overrides) - { - this(quads, particle, transforms, overrides, true); - } - - public BakedItemModel(ImmutableList quads, TextureAtlasSprite particle, ImmutableMap transforms, ItemOverrideList overrides, boolean untransformed) + public BakedItemModel(ImmutableList quads, TextureAtlasSprite particle, ImmutableMap transforms, ItemOverrideList overrides, boolean untransformed) { this.quads = quads; this.particle = particle; @@ -61,9 +55,9 @@ public class BakedItemModel implements IBakedModel this.guiModel = untransformed && hasGuiIdentity(transforms) ? new BakedGuiItemModel<>(this) : null; } - private static boolean hasGuiIdentity(ImmutableMap transforms) + private static boolean hasGuiIdentity(ImmutableMap transforms) { - TRSRTransformation guiTransform = transforms.get(TransformType.GUI); + TransformationMatrix guiTransform = transforms.get(TransformType.GUI); return guiTransform == null || guiTransform.isIdentity(); } @@ -84,13 +78,13 @@ public class BakedItemModel implements IBakedModel } @Override - public Pair handlePerspective(TransformType type) + public IBakedModel handlePerspective(TransformType type, MatrixStack mat) { if (type == TransformType.GUI && this.guiModel != null) { - return this.guiModel.handlePerspective(type); + return this.guiModel.handlePerspective(type, mat); } - return PerspectiveMapWrapper.handlePerspective(this, transforms, type); + return PerspectiveMapWrapper.handlePerspective(this, transforms, type, mat); } public static class BakedGuiItemModel extends BakedModelWrapper @@ -122,13 +116,19 @@ public class BakedItemModel implements IBakedModel } @Override - public Pair handlePerspective(TransformType type) + public boolean doesHandlePerspectives() + { + return true; + } + + @Override + public IBakedModel handlePerspective(TransformType type, MatrixStack mat) { if (type == TransformType.GUI) { - return PerspectiveMapWrapper.handlePerspective(this, originalModel.transforms, type); + return PerspectiveMapWrapper.handlePerspective(this, originalModel.transforms, type, mat); } - return this.originalModel.handlePerspective(type); + return this.originalModel.handlePerspective(type, mat); } } } diff --git a/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java b/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java index 61784bf00..063a23007 100644 --- a/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java +++ b/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java @@ -25,6 +25,7 @@ import javax.vecmath.Matrix4f; import java.util.List; import java.util.Random; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.IBakedModel; @@ -33,7 +34,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.IEnviromentBlockReader; +import net.minecraft.world.ILightReader; import net.minecraft.world.IWorldReader; import net.minecraftforge.client.model.data.IModelData; import org.apache.commons.lang3.tuple.Pair; @@ -96,9 +97,15 @@ public abstract class BakedModelWrapper implements IBaked } @Override - public Pair handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) + public boolean doesHandlePerspectives() { - return originalModel.handlePerspective(cameraTransformType); + return originalModel.doesHandlePerspectives(); + } + + @Override + public IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat) + { + return originalModel.handlePerspective(cameraTransformType, mat); } @Override @@ -116,7 +123,7 @@ public abstract class BakedModelWrapper implements IBaked @Nonnull @Override - public IModelData getModelData(@Nonnull IEnviromentBlockReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) + public IModelData getModelData(@Nonnull ILightReader 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 new file mode 100644 index 000000000..14bf2842c --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/BlockModelConfiguration.java @@ -0,0 +1,174 @@ +/* + * 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.mojang.datafixers.util.Pair; +import net.minecraft.client.renderer.model.*; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.geometry.IModelGeometry; +import net.minecraftforge.client.model.geometry.IModelGeometryPart; + +import javax.annotation.Nullable; +import java.util.*; +import java.util.function.Function; + +public class BlockModelConfiguration implements IModelConfiguration +{ + public final BlockModel owner; + public final VisibilityData visibilityData = new VisibilityData(); + @Nullable + private IModelGeometry customGeometry; + @Nullable + private IModelTransform customModelState; + + public BlockModelConfiguration(BlockModel owner) + { + this.owner = owner; + } + + @Override + public String getModelName() + { + return owner.name; + } + + public boolean hasCustomGeometry() + { + return getCustomGeometry() != null; + } + + @Nullable + public IModelGeometry getCustomGeometry() + { + return owner.parent != null && customGeometry == null ? owner.parent.customData.getCustomGeometry() : customGeometry; + } + + public void setCustomGeometry(IModelGeometry geometry) + { + this.customGeometry = geometry; + } + + @Nullable + public IModelTransform getCustomModelState() + { + return owner.parent != null && customModelState == null ? owner.parent.customData.getCustomModelState() : customModelState; + } + + public void setCustomModelState(IModelTransform modelState) + { + this.customModelState = modelState; + } + + @Override + public boolean getPartVisibility(IModelGeometryPart part, boolean fallback) + { + return owner.parent != null && !visibilityData.hasCustomVisibility(part) ? + owner.parent.customData.getPartVisibility(part, fallback): + visibilityData.isVisible(part, fallback); + } + + @Override + public boolean isTexturePresent(String name) + { + return owner.isTexturePresent(name); + } + + @Override + public Material resolveTexture(String name) + { + return owner.func_228816_c_(name); + } + + @Override + public boolean isShadedInGui() { + return owner.isGui3d(); + } + + @Override + public boolean useSmoothLighting() + { + return owner.isAmbientOcclusion(); + } + + @Override + public ItemCameraTransforms getCameraTransforms() + { + return owner.getAllTransforms(); + } + + @Override + public IModelTransform getCombinedTransform() + { + IModelTransform state = getCustomModelState(); + + return state != null + ? new SimpleModelTransform(PerspectiveMapWrapper.getTransformsWithFallback(state, getCameraTransforms()), state.func_225615_b_()) + : new SimpleModelTransform(PerspectiveMapWrapper.getTransforms(getCameraTransforms())); + } + + public void copyFrom(BlockModelConfiguration other) + { + this.customGeometry = other.customGeometry; + this.customModelState = other.customModelState; + this.visibilityData.copyFrom(other.visibilityData); + } + + 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 sprite, ItemOverrideList overrides, ResourceLocation modelLocation) + { + IModelGeometry geometry = getCustomGeometry(); + if (geometry == null) + throw new IllegalStateException("Can not use custom baking without custom geometry"); + return geometry.bake(this, bakery, bakedTextureGetter, sprite, overrides, modelLocation); + } + + public static class VisibilityData + { + private final Map data = new HashMap<>(); + + public boolean hasCustomVisibility(IModelGeometryPart part) + { + return data.containsKey(part.name()); + } + + public boolean isVisible(IModelGeometryPart part, boolean fallback) + { + return data.getOrDefault(part.name(), fallback); + } + + public void setVisibilityState(String partName, boolean type) + { + data.put(partName, type); + } + + public void copyFrom(VisibilityData visibilityData) + { + data.clear(); + data.putAll(visibilityData.data); + } + } +} diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java deleted file mode 100644 index 69d4fbe77..000000000 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ /dev/null @@ -1,244 +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.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.Map.Entry; -import java.util.function.BiConsumer; - -import net.minecraft.client.renderer.model.*; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import javax.annotation.Nullable; - -public class BlockStateLoader -{ - private static final Gson GSON = (new GsonBuilder()) - .registerTypeAdapter(ForgeBlockStateV1.class, ForgeBlockStateV1.Deserializer.INSTANCE) - .registerTypeAdapter(ForgeBlockStateV1.Variant.class, ForgeBlockStateV1.Variant.Deserializer.INSTANCE) - .registerTypeAdapter(TRSRTransformation.class, ForgeBlockStateV1.TRSRDeserializer.INSTANCE) - .create(); - - private static final Logger LOGGER = LogManager.getLogger(); - - private static long internalGeneratedModelId = 1; - - /** - * Loads a BlockStates json file. - * Will attempt to parse it as a Forge Enhanced version if possible. - * Will fall back to standard loading if marker is not present. - * - * Note: This method is NOT thread safe - * - * @param reader json read - * @param location blockstate location - * @param vanillaGSON ModelBlockDefinition's GSON reader. - * - * @return Model definition including variants for all known combinations. - */ - public static BlockModelDefinition load(Reader reader, ResourceLocation location, final Gson vanillaGSON, ModelBakery bakery, BiConsumer modelConsumer) - { - try - { - byte[] data = IOUtils.toByteArray(reader, StandardCharsets.UTF_8); - reader = new InputStreamReader(new ByteArrayInputStream(data), StandardCharsets.UTF_8); - - Marker marker = GSON.fromJson(new String(data, StandardCharsets.UTF_8), Marker.class); // Read "forge_marker" to determine what to load. - - switch (marker.forge_marker) - { - case 1: // Version 1 - ForgeBlockStateV1 v1 = GSON.fromJson(reader, ForgeBlockStateV1.class); - Map variants = Maps.newLinkedHashMap(); - - for (Entry> entry : v1.variants.asMap().entrySet()) - { // Convert Version1 variants into vanilla variants for the ModelBlockDefinition. - List mcVars = Lists.newArrayList(); - for (ForgeBlockStateV1.Variant var : entry.getValue()) - { - boolean uvLock = var.getUvLock().orElse(false); - int weight = var.getWeight().orElse(1); - - ResourceLocation modelLocation = var.getModel(); - if (!var.isVanillaCompatible() && bakery != null) - { - modelLocation = new ResourceLocation( - "internal", - String.format("%d/%s/%s/%s", internalGeneratedModelId++, location.getNamespace(), location.getPath(), - entry.getKey().replace("=","_").replace(",","_")) - ); - - IUnbakedModel model = ForgeVariantHelper.prepareInjectedModel((ModelLoader)bakery, modelLocation, var.getModel(), var.getSmooth(), var.getGui3d(), var.getTextures(), var.getOnlyPartsVariant(), var.getCustomData()); - - modelConsumer.accept(modelLocation, model); - } - - mcVars.add(new ForgeVariant(modelLocation, var.getState().orElse(ModelRotation.X0_Y0), uvLock, weight)); - } - variants.put(entry.getKey(), new VariantList(mcVars)); - } - - return new BlockModelDefinition(variants, null); - - default: //Unknown version.. try loading it as normal. - return vanillaGSON.fromJson(reader, BlockModelDefinition.class); - } - } - catch (IOException e) - { - throw new RuntimeException(e); - } - } - - public static class Marker - { - public int forge_marker = -1; - } - - //This is here specifically so that we do not have a hard reference to ForgeBlockStateV1.Variant in this code - public static class SubModel - { - private final IModelState state; - private final boolean uvLock; - private final boolean smooth; - private final boolean gui3d; - private final ImmutableMap textures; - @Nullable - private final ResourceLocation model; - private final ImmutableMap customData; - - public SubModel(IModelState state, boolean uvLock, boolean smooth, boolean gui3d, ImmutableMap textures, @Nullable ResourceLocation model, ImmutableMap customData) - { - this.state = state; - this.uvLock = uvLock; - this.smooth = smooth; - this.gui3d = gui3d; - this.textures = textures; - this.model = model; - this.customData = customData; - } - - public IModelState getState() { return state; } - public boolean isUVLock() { return uvLock; } - public ImmutableMap getTextures() { return textures; } - @Nullable - public ResourceLocation getModelLocation() { return model; } - public ImmutableMap getCustomData() { return customData; } - } - - private static class ForgeVariant extends Variant - { - private final IModelState state; - - ForgeVariant(ResourceLocation model, IModelState state, boolean uvLock, int weight) - { - super(model, state instanceof ModelRotation ? (ModelRotation)state : ModelRotation.X0_Y0, uvLock, weight); - this.state = state; - } - - @Override - public IModelState getState() - { - return state; - } - - @Override - public String toString() { - return "Forge" + super.toString(); - } - } - - private static class ForgeVariantHelper - { - public static IUnbakedModel prepareInjectedModel(ModelLoader bakery, ResourceLocation blockstateLocation, @Nullable ResourceLocation modelLocation, Optional smooth, Optional gui3d, ImmutableMap textures, ImmutableMap parts, ImmutableMap customData) - { - int size = parts.size(); - - IUnbakedModel base = null; - if (modelLocation != null) - { - try - { - base = ModelLoaderRegistry.getModel(modelLocation); - - if (base != null) - { - base = base.process(customData); - base = base.retexture(textures); - base = smooth.map(base::smoothLighting).orElse(base); - base = gui3d.map(base::gui3d).orElse(base); - - if (size <= 0) - return base; - } - } - catch (Exception e) - { - LOGGER.error("Error processing base model for forge blockstates pseudo-model: '" + blockstateLocation, e); - } - } - - ImmutableMap.Builder> models = ImmutableMap.builder(); - for (Entry entry : parts.entrySet()) - { - SubModel part = entry.getValue(); - - final ResourceLocation location = part.getModelLocation(); - final IUnbakedModel model; - if (location == null) - { - LOGGER.error("model not found for variant {} for blockstate {}", entry.getKey(), blockstateLocation); - model = ModelLoaderRegistry.getMissingModel(blockstateLocation, new Throwable()); - } - else - { - model = ModelLoaderRegistry.getModelOrLogError(location, "Unable to load block sub-model '" + entry.getKey() + "': '" + location + "'"); - } - - IUnbakedModel base1 = model; - base1 = base1.process(part.getCustomData()); - base1 = base1.retexture(part.getTextures()); - base1 = Optional.of(part.smooth).map(base1::smoothLighting).orElse(base1); - base1 = Optional.of(part.gui3d).map(base1::gui3d).orElse(base1); - models.put(entry.getKey(), Pair.of(base1, part.getState())); - } - - return new MultiModel(modelLocation, base, models.build()); - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/BasicState.java b/src/main/java/net/minecraftforge/client/model/DummyAtlasSprite.java similarity index 53% rename from src/main/java/net/minecraftforge/client/model/BasicState.java rename to src/main/java/net/minecraftforge/client/model/DummyAtlasSprite.java index 104aa453d..ca22eca79 100644 --- a/src/main/java/net/minecraftforge/client/model/BasicState.java +++ b/src/main/java/net/minecraftforge/client/model/DummyAtlasSprite.java @@ -19,32 +19,25 @@ package net.minecraftforge.client.model; -import net.minecraft.client.renderer.texture.ISprite; -import net.minecraftforge.common.model.IModelState; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.ResourceLocation; + +import java.util.function.Function; /** - * Adapter from {@link IModelState} to the vanilla transform description class {@link ISprite}. + * For use when loading a custom model for use in entity/tileentity renderers, or other situations in which the main atlas is not wanted. */ -public class BasicState implements ISprite +/* +public class DummyAtlasSprite extends TextureAtlasSprite { - private final IModelState defaultState; - private final boolean uvLock; + public static final TextureAtlasSprite INSTANCE = new DummyAtlasSprite(); + public static final Function GETTER = t -> INSTANCE; - public BasicState(IModelState defaultState, boolean uvLock) + private DummyAtlasSprite() { - this.defaultState = defaultState; - this.uvLock = uvLock; - } - - @Override - public IModelState getState() - { - return defaultState; - } - - @Override - public boolean isUvLock() - { - return uvLock; + super(new ResourceLocation("forge", "dummy"), 1, 1); + // Set the min/max coords to 0..1 range, to use the full texture. + func_217789_a(0, 0, 1, 1); } } +*/ \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/model/FancyMissingModel.java b/src/main/java/net/minecraftforge/client/model/FancyMissingModel.java index 974fccea5..893fed2e6 100644 --- a/src/main/java/net/minecraftforge/client/model/FancyMissingModel.java +++ b/src/main/java/net/minecraftforge/client/model/FancyMissingModel.java @@ -26,24 +26,24 @@ 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.ISprite; +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.minecraftforge.common.ForgeConfig; -import net.minecraftforge.common.ForgeMod; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; -import org.apache.commons.lang3.tuple.Pair; +import net.minecraftforge.common.model.TransformationHelper; import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; -import javax.vecmath.Quat4f; -import javax.vecmath.Vector3f; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -53,18 +53,21 @@ import java.util.Set; final class FancyMissingModel implements IUnbakedModel { private static final ResourceLocation font = new ResourceLocation("minecraft", "textures/font/ascii.png"); - private static final ResourceLocation font2 = new ResourceLocation("minecraft", "font/ascii"); - private static final TRSRTransformation smallTransformation = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(null, null, new Vector3f(.25f, .25f, .25f), null)); + private static final Material font2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft", "font/ascii")); + private static final TransformationMatrix smallTransformation = TransformationHelper.blockCenterToCorner(new TransformationMatrix(null, null, new Vector3f(.25f, .25f, .25f), null)); private static final LoadingCache fontCache = CacheBuilder.newBuilder().maximumSize(3).build(new CacheLoader() { @Override public SimpleModelFontRenderer load(VertexFormat format) throws Exception { - Matrix4f m = new Matrix4f(); - m.m20 = 1f / 128f; - m.m01 = m.m12 = -m.m20; - m.m33 = 1; - m.setTranslation(new Vector3f(1, 1 + 1f / 0x100, 0)); + 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, @@ -92,7 +95,7 @@ final class FancyMissingModel implements IUnbakedModel } @Override - public Collection getTextures(Function modelGetter, Set missingTextureErrors) + public Collection func_225614_a_(Function p_225614_1_, Set> p_225614_2_) { return ImmutableList.of(font2); } @@ -105,12 +108,12 @@ final class FancyMissingModel implements IUnbakedModel @Nullable @Override - public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) + public IBakedModel func_225613_a_(ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) { - IBakedModel bigMissing = missingModel.bake(bakery, spriteGetter, sprite, format); - ModelStateComposition smallState = new ModelStateComposition(sprite.getState(), smallTransformation); - IBakedModel smallMissing = missingModel.bake(bakery, spriteGetter, smallState, format); - return new BakedModel(bigMissing, smallMissing, fontCache.getUnchecked(format), message, spriteGetter.apply(font2)); + IBakedModel bigMissing = missingModel.func_225613_a_(bakery, spriteGetter, sprite, modelLocation); + ModelTransformComposition smallState = new ModelTransformComposition(sprite, new SimpleModelTransform(smallTransformation)); + IBakedModel smallMissing = missingModel.func_225613_a_(bakery, spriteGetter, smallState, modelLocation); + return new BakedModel(bigMissing, smallMissing, fontCache.getUnchecked(DefaultVertexFormats.BLOCK), message, spriteGetter.apply(font2)); } static final class BakedModel implements IBakedModel @@ -188,9 +191,15 @@ final class FancyMissingModel implements IUnbakedModel public ItemOverrideList getOverrides() { return ItemOverrideList.EMPTY; } @Override - public Pair handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) + public boolean doesHandlePerspectives() { - TRSRTransformation transform = TRSRTransformation.identity(); + return true; + } + + @Override + public IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat) + { + TransformationMatrix transform = TransformationMatrix.func_227983_a_(); boolean big = true; switch (cameraTransformType) { @@ -200,11 +209,11 @@ final class FancyMissingModel implements IUnbakedModel case THIRD_PERSON_RIGHT_HAND: break; case FIRST_PERSON_LEFT_HAND: - transform = new TRSRTransformation(new Vector3f(-0.62f, 0.5f, -.5f), new Quat4f(1, -1, -1, 1), null, null); + 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 TRSRTransformation(new Vector3f(-0.5f, 0.5f, -.5f), new Quat4f(1, 1, 1, 1), null, null); + transform = new TransformationMatrix(new Vector3f(-0.5f, 0.5f, -.5f), new Quaternion(1, 1, 1, 1), null, null); big = false; break; case HEAD: @@ -212,26 +221,27 @@ final class FancyMissingModel implements IUnbakedModel case GUI: if (ForgeConfig.CLIENT.zoomInMissingModelTextInGui.get()) { - transform = new TRSRTransformation(null, new Quat4f(1, 1, 1, 1), new Vector3f(4, 4, 4), null); + transform = new TransformationMatrix(null, new Quaternion(1, 1, 1, 1), new Vector3f(4, 4, 4), null); big = false; } else { - transform = new TRSRTransformation(null, new Quat4f(1, 1, 1, 1), null, null); + transform = new TransformationMatrix(null, new Quaternion(1, 1, 1, 1), null, null); big = true; } break; case FIXED: - transform = new TRSRTransformation(null, new Quat4f(-1, -1, 1, 1), null, null); + transform = new TransformationMatrix(null, new Quaternion(-1, -1, 1, 1), null, null); break; default: break; } + mat.func_227866_c_().func_227870_a_().func_226595_a_(transform.func_227988_c_()); if (big != this.big) { - return Pair.of(otherModel, transform.getMatrixVec()); + return otherModel; } - return Pair.of(this, transform.getMatrixVec()); + return this; } } } diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java deleted file mode 100644 index 8f39668cb..000000000 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ /dev/null @@ -1,978 +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.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.annotation.Nullable; -import javax.vecmath.AxisAngle4d; -import javax.vecmath.Matrix4f; -import javax.vecmath.Quat4f; -import javax.vecmath.Vector3f; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.model.ModelRotation; -import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.BlockStateLoader.Marker; -import net.minecraftforge.client.model.BlockStateLoader.SubModel; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; - -import java.util.Objects; -import java.util.Optional; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.LinkedHashMultimap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Multimap; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; - -public class ForgeBlockStateV1 extends Marker -{ - private static final Logger LOGGER = LogManager.getLogger(); - ForgeBlockStateV1.Variant defaults; - Multimap variants = LinkedHashMultimap.create(); - - public static class Deserializer implements JsonDeserializer - { - static ForgeBlockStateV1.Deserializer INSTANCE = new Deserializer(); - @Override - public ForgeBlockStateV1 deserialize(JsonElement element, Type typeOfT, JsonDeserializationContext context) throws JsonParseException - { - JsonObject json = element.getAsJsonObject(); - ForgeBlockStateV1 ret = new ForgeBlockStateV1(); - ret.forge_marker = JSONUtils.getInt(json, "forge_marker"); - - if (json.has("defaults")) // Load defaults Variant. - { - ret.defaults = context.deserialize(json.get("defaults"), ForgeBlockStateV1.Variant.class); - - if (ret.defaults.simpleSubmodels.size() > 0) - throw new RuntimeException("\"defaults\" variant cannot contain a simple \"submodel\" definition."); - } - - Map> condensed = Maps.newLinkedHashMap(); // map(property name -> map(property value -> variant)) - Multimap specified = LinkedHashMultimap.create(); // Multimap containing all the states specified with "property=value". - - for (Entry e : JSONUtils.getJsonObject(json, "variants").entrySet()) - { - if (e.getValue().isJsonArray()) - { - // array of fully-defined variants - for (JsonElement a : e.getValue().getAsJsonArray()) - { - Variant.Deserializer.INSTANCE.simpleSubmodelKey = e.getKey(); - specified.put(e.getKey(), context.deserialize(a, Variant.class)); - } - } - else - { - JsonObject obj = e.getValue().getAsJsonObject(); - if(obj.entrySet().iterator().next().getValue().isJsonObject()) - { - // first value is a json object, so we know it's not a fully-defined variant - Map subs = Maps.newLinkedHashMap(); - condensed.put(e.getKey(), subs); - for (Entry se : e.getValue().getAsJsonObject().entrySet()) - { - Variant.Deserializer.INSTANCE.simpleSubmodelKey = e.getKey() + "=" + se.getKey(); - subs.put(se.getKey(), context.deserialize(se.getValue(), Variant.class)); - } - } - else - { - // fully-defined variant - Variant.Deserializer.INSTANCE.simpleSubmodelKey = e.getKey(); - specified.put(e.getKey(), context.deserialize(e.getValue(), Variant.class)); - } - } - } - - Multimap permutations = getPermutations(condensed); // Get permutations of Forge-style states. - - for (Entry> e : specified.asMap().entrySet()) - { // Make fully-specified variants override Forge variant permutations, inheriting the permutations' values. - Collection baseVars = permutations.get(e.getKey()); - List addVars = Lists.newArrayList(); - - for (ForgeBlockStateV1.Variant specVar : e.getValue()) - { - if (!baseVars.isEmpty()) - { - for (ForgeBlockStateV1.Variant baseVar : baseVars) - addVars.add(new Variant(specVar).sync(baseVar)); - } - else - addVars.add(specVar); - } - - baseVars.clear(); - baseVars.addAll(addVars); - } - - for (Entry e : permutations.entries()) // Create the output map(state -> Variant). - { - ForgeBlockStateV1.Variant v = e.getValue(); - - if (ret.defaults != null) - { - v.sync(ret.defaults); // Sync defaults into all permutation variants - - for (Entry partKey : v.simpleSubmodels.entrySet()) - { // Sync variant values (including defaults) into simple submodel declarations. - if (partKey.getValue() == null) - continue; - - if (!v.submodels.containsKey(partKey.getKey())) - throw new RuntimeException("This should never happen! Simple submodel is not contained in the submodel map!"); - List partList = v.submodels.get(partKey.getKey()); - if (partList.size() > 1) - throw new RuntimeException("This should never happen! Simple submodel has multiple variants!"); - - ForgeBlockStateV1.Variant part = partList.get(0); - // Must keep old rotation for the part, because the base variant's rotation is applied to the parts already. - Optional state = part.state; - part.sync(v); - part.simpleSubmodels.clear(); - part.state = state; - } - } - - v.submodels.values().removeIf(Objects::isNull); - - if (v.textures != null) - { - for (Entry tex : v.textures.entrySet()) - { - if (tex.getValue() != null && tex.getValue().charAt(0) == '#') - { - String value = v.textures.get(tex.getValue().substring(1)); - if (value == null) - { - LOGGER.fatal("Could not resolve texture name \"{}\" for permutation \"{}\"", tex.getValue(), e.getKey()); - for (Entry t: v.textures.entrySet()) - LOGGER.fatal("{}={}", t.getKey(), t.getValue()); - throw new JsonParseException("Could not resolve texture name \"" + tex.getValue() + "\" for permutation \"" + e.getKey() + "\""); - } - v.textures.put(tex.getKey(), value); - } - } - - for (List part : v.submodels.values()) // Sync base variant's textures (including defaults) into all submodels. - { - for (ForgeBlockStateV1.Variant partVar : part) - { - for (Entry texEntry : v.textures.entrySet()) - { - if (!partVar.textures.containsKey(texEntry.getKey())) - partVar.textures.put(texEntry.getKey(), texEntry.getValue()); - } - } - } - } - - if (!v.submodels.isEmpty()) - ret.variants.putAll(e.getKey(), getSubmodelPermutations(v, v.submodels)); // Do permutations of submodel variants. - else - ret.variants.put(e.getKey(), v); - } - - return ret; - } - - private Multimap getPermutations(List sorted, Map> base, int depth, String prefix, Multimap ret, @Nullable ForgeBlockStateV1.Variant parent) - { - if (depth == sorted.size()) - { - if(parent != null) - ret.put(prefix, parent); - return ret; - } - - String name = sorted.get(depth); - for (Entry e : base.get(name).entrySet()) - { - ForgeBlockStateV1.Variant newHead = parent == null ? new Variant(e.getValue()) : new Variant(parent).sync(e.getValue()); - - getPermutations(sorted, base, depth + 1, prefix + (depth == 0 ? "" : ",") + name + "=" + e.getKey(), ret, newHead); - } - - return ret; - } - - private Multimap getPermutations(Map> base) - { - List sorted = Lists.newArrayList(base.keySet()); - Collections.sort(sorted); // Sort to get consistent results. - return getPermutations(sorted, base, 0, "", LinkedHashMultimap.create(), null); - } - - private List getSubmodelPermutations(ForgeBlockStateV1.Variant baseVar, List sorted, Map> map, int depth, Map parts, List ret) - { - if (depth >= sorted.size()) - { - ForgeBlockStateV1.Variant add = new Variant(baseVar); // Create a duplicate variant object so modifying it doesn't modify baseVar. - for (Entry part : parts.entrySet()) // Put all the parts with single variants for this permutation. - add.submodels.put(part.getKey(), Collections.singletonList(part.getValue())); - ret.add(add); - return ret; - } - - String name = sorted.get(depth); - List vars = map.get(sorted.get(depth)); - - if (vars != null) - { - for (ForgeBlockStateV1.Variant v : vars) - { - if (v != null) - { // We put this part variant in the permutation's map to add further in recursion, and then remove it afterward just in case. - parts.put(name, v); - getSubmodelPermutations(baseVar, sorted, map, depth + 1, parts, ret); - parts.remove(name); - } - } - } - else - { - getSubmodelPermutations(baseVar, sorted, map, depth + 1, parts, ret); - } - - return ret; - } - - private List getSubmodelPermutations(ForgeBlockStateV1.Variant baseVar, Map> variants) - { - List sorted = Lists.newArrayList(variants.keySet()); - Collections.sort(sorted); // Sort to get consistent results. - return getSubmodelPermutations(baseVar, sorted, variants, 0, new LinkedHashMap<>(), new ArrayList<>()); - } - } - - public static class Variant - { - public static final Object SET_VALUE = new Object(); - - @Nullable - private ResourceLocation model = null; - private boolean modelSet = false; - private Optional state = Optional.empty(); - private Optional uvLock = Optional.empty(); - private Optional smooth = Optional.empty(); - private Optional gui3d = Optional.empty(); - private Optional weight = Optional.empty(); - private Map textures = Maps.newHashMap(); - private Map> submodels = Maps.newHashMap(); - private Map simpleSubmodels = Maps.newHashMap(); // Makeshift Set to allow us to "remove" (replace value with null) singleParts when needed. - private Map customData = Maps.newHashMap(); - - private Variant(){} - /** - * Clone a variant. - * @param other Variant to clone. - */ - private Variant(ForgeBlockStateV1.Variant other) - { - this.model = other.model; - this.modelSet = other.modelSet; - this.state = other.state; - this.uvLock = other.uvLock; - this.smooth = other.smooth; - this.gui3d = other.gui3d; - this.weight = other.weight; - this.textures.putAll(other.textures); - this.mergeModelPartVariants(this.submodels, other.submodels); - this.simpleSubmodels.putAll(other.simpleSubmodels); - this.customData.putAll(other.customData); - } - - /** - * Sets values in this variant to the input's values only if they haven't been set already. Essentially inherits values from o. - */ - ForgeBlockStateV1.Variant sync(ForgeBlockStateV1.Variant parent) - { - if (!this.modelSet) - { - this.model = parent.model; - this.modelSet = parent.modelSet; - } - if (!this.state.isPresent()) this.state = parent.state; - if (!this.uvLock.isPresent()) this.uvLock = parent.uvLock; - if (!this.smooth.isPresent()) this.smooth = parent.smooth; - if (!this.gui3d.isPresent()) this.gui3d = parent.gui3d; - if (!this.weight.isPresent()) this.weight = parent.weight; - - for (Entry e : parent.textures.entrySet()) - { - if (!this.textures.containsKey(e.getKey())) - this.textures.put(e.getKey(), e.getValue()); - } - - mergeModelPartVariants(this.submodels, parent.submodels); - - for (Entry e : parent.simpleSubmodels.entrySet()) - { - if (!this.simpleSubmodels.containsKey(e.getKey())) - this.simpleSubmodels.put(e.getKey(), e.getValue()); - } - - for (Entry e : parent.customData.entrySet()) - { - if (!this.customData.containsKey(e.getKey())) - this.customData.put(e.getKey(), e.getValue()); - } - - return this; - } - - /** - * Inherits model parts from a parent, creating deep clones of all Variants. - */ - Map> mergeModelPartVariants(Map> output, Map> input) - { - for (Entry> e : input.entrySet()) - { - String key = e.getKey(); - if (!output.containsKey(key)) - { - List variants = e.getValue(); - - if (variants != null) - { - List newVariants = Lists.newArrayListWithCapacity(variants.size()); - - for (ForgeBlockStateV1.Variant v : variants) - newVariants.add(new Variant(v)); - - output.put(key, newVariants); - } - else - output.put(key, variants); - } - } - return output; - } - - boolean isVanillaCompatible() - { - return model != null && submodels.isEmpty() && textures.isEmpty() && customData.isEmpty() && !smooth.isPresent() && !gui3d.isPresent() && state.orElse(ModelRotation.X0_Y0) instanceof ModelRotation; - } - - protected SubModel asGenericSubModel() - { - return new SubModel(state.orElse(TRSRTransformation.identity()), uvLock.orElse(false), smooth.orElse(true), gui3d.orElse(true), getTextures(), model, getCustomData()); - } - - /** - * Gets a list containing the single variant of each part. - * Will throw an error if this Variant has multiple variants for a submodel. - */ - public ImmutableMap getOnlyPartsVariant() - { - if (submodels.size() > 0) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - - for (Entry> entry : submodels.entrySet()) - { - List part = entry.getValue(); - - if (part != null) - { - if (part.size() == 1) - builder.put(entry.getKey(), part.get(0).asGenericSubModel()); - else - throw new RuntimeException("Something attempted to get the list of submodels " - + "for a variant with model \"" + model + "\", when this variant " - + "contains multiple variants for submodel " + entry.getKey()); - } - } - return builder.build(); - } - else { - return ImmutableMap.of(); - } - } - - public Optional getSmooth() - { - return smooth; - } - - public Optional getGui3d() - { - return gui3d; - } - - public static class Deserializer implements JsonDeserializer - { - static Variant.Deserializer INSTANCE = new Deserializer(); - - /** Used once (then set null) for the key to put a simple submodel declaration under in the submodel map. */ - public String simpleSubmodelKey = null; - - protected ResourceLocation getBlockLocation(String location) - { - return new ResourceLocation(location); //Vanilla 1.14 removed automatic block prefixes. See https://github.com/MinecraftForge/MinecraftForge/issues/5892 - } - - /** Throws an error if there are submodels in this submodel. */ - private void throwIfNestedSubmodels(ForgeBlockStateV1.Variant submodel) - { - if (submodel.submodels.size() > 0) - throw new UnsupportedOperationException("Forge BlockStateLoader V1 does not support nested submodels."); - } - - @Override - public ForgeBlockStateV1.Variant deserialize(JsonElement element, Type typeOfT, JsonDeserializationContext context) throws JsonParseException - { - ForgeBlockStateV1.Variant ret = new Variant(); - JsonObject json = element.getAsJsonObject(); - - if (json.has("model")) - { // Load base model location. - if (json.get("model").isJsonNull()) - ret.model = null; // Allow overriding base model to remove it from a state. - else - ret.model = getBlockLocation(JSONUtils.getString(json, "model")); - ret.modelSet = true; - } - - if (json.has("textures")) - { // Load textures map. - for (Entry e : json.get("textures").getAsJsonObject().entrySet()) - { - if (e.getValue().isJsonNull()) - ret.textures.put(e.getKey(), ""); // We have to use "" because ImmutableMaps don't allow nulls -.- - else - ret.textures.put(e.getKey(), e.getValue().getAsString()); - } - } - - if (json.has("x") || json.has("y")) - { // Load rotation values. - int x = JSONUtils.getInt(json, "x", 0); - int y = JSONUtils.getInt(json, "y", 0); - ret.state = Optional.ofNullable(ModelRotation.getModelRotation(x, y)); - if (!ret.state.isPresent()) - throw new JsonParseException("Invalid BlockModelRotation x: " + x + " y: " + y); - } - - if (json.has("transform")) - { - if (json.get("transform").isJsonPrimitive() && json.get("transform").getAsJsonPrimitive().isString()) - { - String transform = json.get("transform").getAsString(); - ret.state = Transforms.get(transform); - if (!ret.state.isPresent()) - { - throw new JsonParseException("transform: unknown default string: " + transform); - } - } - else if (!json.get("transform").isJsonObject()) - { - try - { - TRSRTransformation base = context.deserialize(json.get("transform"), TRSRTransformation.class); - ret.state = Optional.of(TRSRTransformation.blockCenterToCorner(base)); - } - catch (JsonParseException e) - { - throw new JsonParseException("transform: expected a string, object or valid base transformation, got: " + json.get("transform")); - } - } - else - { - JsonObject transform = json.get("transform").getAsJsonObject(); - EnumMap transforms = Maps.newEnumMap(TransformType.class); - if(transform.has("thirdperson")) - { - TRSRTransformation t = context.deserialize(transform.get("thirdperson"), TRSRTransformation.class); - transform.remove("thirdperson"); - transforms.put(TransformType.THIRD_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if(transform.has("thirdperson_righthand")) - { - TRSRTransformation t = context.deserialize(transform.get("thirdperson_righthand"), TRSRTransformation.class); - transform.remove("thirdperson_righthand"); - transforms.put(TransformType.THIRD_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if(transform.has("thirdperson_lefthand")) - { - TRSRTransformation t = context.deserialize(transform.get("thirdperson_lefthand"), TRSRTransformation.class); - transform.remove("thirdperson_lefthand"); - transforms.put(TransformType.THIRD_PERSON_LEFT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if(transform.has("firstperson")) - { - TRSRTransformation t = context.deserialize(transform.get("firstperson"), TRSRTransformation.class); - transform.remove("firstperson"); - transforms.put(TransformType.FIRST_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if(transform.has("firstperson_righthand")) - { - TRSRTransformation t = context.deserialize(transform.get("firstperson_righthand"), TRSRTransformation.class); - transform.remove("firstperson_righthand"); - transforms.put(TransformType.FIRST_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if(transform.has("firstperson_lefthand")) - { - TRSRTransformation t = context.deserialize(transform.get("firstperson_lefthand"), TRSRTransformation.class); - transform.remove("firstperson_lefthand"); - transforms.put(TransformType.FIRST_PERSON_LEFT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if(transform.has("head")) - { - TRSRTransformation t = context.deserialize(transform.get("head"), TRSRTransformation.class); - transform.remove("head"); - transforms.put(TransformType.HEAD, TRSRTransformation.blockCenterToCorner(t)); - } - if(transform.has("gui")) - { - TRSRTransformation t = context.deserialize(transform.get("gui"), TRSRTransformation.class); - transform.remove("gui"); - transforms.put(TransformType.GUI, TRSRTransformation.blockCenterToCorner(t)); - } - if(transform.has("ground")) - { - TRSRTransformation t = context.deserialize(transform.get("ground"), TRSRTransformation.class); - transform.remove("ground"); - transforms.put(TransformType.GROUND, TRSRTransformation.blockCenterToCorner(t)); - } - if(transform.has("fixed")) - { - TRSRTransformation t = context.deserialize(transform.get("fixed"), TRSRTransformation.class); - transform.remove("fixed"); - transforms.put(TransformType.FIXED, TRSRTransformation.blockCenterToCorner(t)); - } - int k = transform.entrySet().size(); - if(transform.has("matrix")) k--; - if(transform.has("translation")) k--; - if(transform.has("rotation")) k--; - if(transform.has("scale")) k--; - if(transform.has("post-rotation")) k--; - if(k > 0) - { - throw new JsonParseException("transform: allowed keys: 'thirdperson', 'firstperson', 'gui', 'head', 'matrix', 'translation', 'rotation', 'scale', 'post-rotation'"); - } - TRSRTransformation base = TRSRTransformation.identity(); - if(!transform.entrySet().isEmpty()) - { - base = context.deserialize(transform, TRSRTransformation.class); - base = TRSRTransformation.blockCenterToCorner(base); - } - IModelState state; - if(transforms.isEmpty()) - { - state = base; - } - else - { - state = new SimpleModelState(Maps.immutableEnumMap(transforms), Optional.of(base)); - } - ret.state = Optional.of(state); - } - } - - if (json.has("uvlock")) - { // Load uvlock. - ret.uvLock = Optional.of(JSONUtils.getBoolean(json, "uvlock")); - } - - if (json.has("smooth_lighting")) - { - ret.smooth = Optional.of(JSONUtils.getBoolean(json, "smooth_lighting")); - } - - if (json.has("gui3d")) - { - ret.gui3d = Optional.of(JSONUtils.getBoolean(json, "gui3d")); - } - - if (json.has("weight")) - { // Load weight. - ret.weight = Optional.of(JSONUtils.getInt(json, "weight")); - } - - if (json.has("submodel")) - { // Load submodels. - JsonElement submodels = json.get("submodel"); - - if (submodels.isJsonPrimitive()) - { // Load a simple submodel declaration. - if (simpleSubmodelKey == null) - throw new RuntimeException("Attempted to use a simple submodel declaration outside a valid state variant declaration."); - String key = simpleSubmodelKey; - simpleSubmodelKey = null; - - ret.model = getBlockLocation(submodels.getAsString()); - ret.modelSet = true; - ForgeBlockStateV1.Variant dummyVar = new Variant(); // Create a dummy Variant to use as the owner of the simple submodel. - dummyVar.submodels.put(key, Collections.singletonList(ret)); - dummyVar.simpleSubmodels = Collections.singletonMap(key, Variant.SET_VALUE); - return dummyVar; - } - else - { // Load full submodel declarations. - // Clear the simple submodel key so that when deserializing submodels, the deserializer doesn't use the key. - simpleSubmodelKey = null; - - for (Entry submodel : submodels.getAsJsonObject().entrySet()) - { - JsonElement varEl = submodel.getValue(); - List submodelVariants; - - if (varEl.isJsonArray()) - { // Multiple variants of the submodel. - submodelVariants = Lists.newArrayList(); - for (JsonElement e : varEl.getAsJsonArray()) - submodelVariants.add(context.deserialize(e, Variant.class)); - } - else if (varEl.isJsonNull()) - { - submodelVariants = null; - } - else - { - submodelVariants = Collections.singletonList(context.deserialize(varEl, Variant.class)); - } - - if (submodelVariants != null) // Throw an error if there are submodels inside a submodel. - for (ForgeBlockStateV1.Variant part : submodelVariants) - throwIfNestedSubmodels(part); - - ret.submodels.put(submodel.getKey(), submodelVariants); - // Put null to remove this submodel from the list of simple submodels when something inherits this submodel. - ret.simpleSubmodels.put(submodel.getKey(), null); - } - } - } - - if (json.has("custom")) - { - for (Entry e : json.get("custom").getAsJsonObject().entrySet()) - { - if (e.getValue().isJsonNull()) - ret.customData.put(e.getKey(), null); - else - ret.customData.put(e.getKey(), e.getValue().toString()); - } - } - - simpleSubmodelKey = null; - - return ret; - } - } - - @Nullable - public ResourceLocation getModel() { return model; } - public boolean isModelSet() { return modelSet; } - public Optional getState() { return state; } - public Optional getUvLock() { return uvLock; } - public Optional getWeight() { return weight; } - public ImmutableMap getTextures() { return ImmutableMap.copyOf(textures); } - public ImmutableMap> getSubmodels() { return ImmutableMap.copyOf(submodels); } - public ImmutableMap getCustomData() { return ImmutableMap.copyOf(customData); } - } - - public static class TRSRDeserializer implements JsonDeserializer - { - public static final TRSRDeserializer INSTANCE = new TRSRDeserializer(); - - @Override - public TRSRTransformation deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException - { - if (json.isJsonPrimitive() && json.getAsJsonPrimitive().isString()) - { - String transform = json.getAsString(); - if(transform.equals("identity")) - { - return TRSRTransformation.identity(); - } - else - { - throw new JsonParseException("TRSR: unknown default string: " + transform); - } - } - if (json.isJsonArray()) - { - // direct matrix array - return new TRSRTransformation(parseMatrix(json)); - } - if (!json.isJsonObject()) throw new JsonParseException("TRSR: expected array or object, got: " + json); - JsonObject obj = json.getAsJsonObject(); - TRSRTransformation ret; - if (obj.has("matrix")) - { - // matrix as a sole key - ret = new TRSRTransformation(parseMatrix(obj.get("matrix"))); - obj.remove("matrix"); - if (obj.entrySet().size() != 0) - { - throw new JsonParseException("TRSR: can't combine matrix and other keys"); - } - return ret; - } - Vector3f translation = null; - Quat4f leftRot = null; - Vector3f scale = null; - Quat4f rightRot = null; - if (obj.has("translation")) - { - translation = new Vector3f(parseFloatArray(obj.get("translation"), 3, "Translation")); - obj.remove("translation"); - } - if (obj.has("rotation")) - { - leftRot = parseRotation(obj.get("rotation")); - obj.remove("rotation"); - } - if (obj.has("scale")) - { - if(!obj.get("scale").isJsonArray()) - { - try - { - float s = obj.get("scale").getAsNumber().floatValue(); - scale = new Vector3f(s, s, s); - } - catch (ClassCastException ex) - { - throw new JsonParseException("TRSR scale: expected number or array, got: " + obj.get("scale")); - } - } - else - { - scale = new Vector3f(parseFloatArray(obj.get("scale"), 3, "Scale")); - } - obj.remove("scale"); - } - if (obj.has("post-rotation")) - { - rightRot = parseRotation(obj.get("post-rotation")); - obj.remove("post-rotation"); - } - if (!obj.entrySet().isEmpty()) throw new JsonParseException("TRSR: can either have single 'matrix' key, or a combination of 'translation', 'rotation', 'scale', 'post-rotation'"); - return new TRSRTransformation(translation, leftRot, scale, rightRot); - } - - public static Matrix4f parseMatrix(JsonElement e) - { - if (!e.isJsonArray()) throw new JsonParseException("Matrix: expected an array, got: " + e); - JsonArray m = e.getAsJsonArray(); - if (m.size() != 3) throw new JsonParseException("Matrix: expected an array of length 3, got: " + m.size()); - Matrix4f ret = new Matrix4f(); - for (int i = 0; i < 3; i++) - { - if (!m.get(i).isJsonArray()) throw new JsonParseException("Matrix row: expected an array, got: " + m.get(i)); - JsonArray r = m.get(i).getAsJsonArray(); - if (r.size() != 4) throw new JsonParseException("Matrix row: expected an array of length 4, got: " + r.size()); - for (int j = 0; j < 4; j++) - { - try - { - ret.setElement(i, j, r.get(j).getAsNumber().floatValue()); - } - catch (ClassCastException ex) - { - throw new JsonParseException("Matrix element: expected number, got: " + r.get(j)); - } - } - } - return ret; - } - - public static float[] parseFloatArray(JsonElement e, int length, String prefix) - { - if (!e.isJsonArray()) throw new JsonParseException(prefix + ": expected an array, got: " + e); - JsonArray t = e.getAsJsonArray(); - if (t.size() != length) throw new JsonParseException(prefix + ": expected an array of length " + length + ", got: " + t.size()); - float[] ret = new float[length]; - for (int i = 0; i < length; i++) - { - try - { - ret[i] = t.get(i).getAsNumber().floatValue(); - } - catch (ClassCastException ex) - { - throw new JsonParseException(prefix + " element: expected number, got: " + t.get(i)); - } - } - return ret; - } - - public static Quat4f parseAxisRotation(JsonElement e) - { - if (!e.isJsonObject()) throw new JsonParseException("Axis rotation: object expected, got: " + e); - JsonObject obj = e.getAsJsonObject(); - if (obj.entrySet().size() != 1) throw new JsonParseException("Axis rotation: expected single axis object, got: " + e); - Map.Entry entry = obj.entrySet().iterator().next(); - Quat4f ret = new Quat4f(); - try - { - if (entry.getKey().equals("x")) - { - ret.set(new AxisAngle4d(1, 0, 0, Math.toRadians(entry.getValue().getAsNumber().floatValue()))); - } - else if (entry.getKey().equals("y")) - { - ret.set(new AxisAngle4d(0, 1, 0, Math.toRadians(entry.getValue().getAsNumber().floatValue()))); - } - else if (entry.getKey().equals("z")) - { - ret.set(new AxisAngle4d(0, 0, 1, Math.toRadians(entry.getValue().getAsNumber().floatValue()))); - } - else throw new JsonParseException("Axis rotation: expected single axis key, got: " + entry.getKey()); - } - catch(ClassCastException ex) - { - throw new JsonParseException("Axis rotation value: expected number, got: " + entry.getValue()); - } - return ret; - } - - public static Quat4f parseRotation(JsonElement e) - { - if (e.isJsonArray()) - { - if (e.getAsJsonArray().get(0).isJsonObject()) - { - Quat4f ret = new Quat4f(0, 0, 0, 1); - for (JsonElement a : e.getAsJsonArray()) - { - ret.mul(parseAxisRotation(a)); - } - return ret; - } - else if (e.isJsonArray()) - { - JsonArray array = e.getAsJsonArray(); - if (array.size() == 3) //Vanilla rotation - return TRSRTransformation.quatFromXYZDegrees(new Vector3f(parseFloatArray(e, 3, "Rotation"))); - else // quaternion - return new Quat4f(parseFloatArray(e, 4, "Rotation")); - } - else throw new JsonParseException("Rotation: expected array or object, got: " + e); - } - else if (e.isJsonObject()) - { - return parseAxisRotation(e); - } - else throw new JsonParseException("Rotation: expected array or object, got: " + e); - } - } - - public static class Transforms - { - public static TRSRTransformation convert(float tx, float ty, float tz, float ax, float ay, float az, float s) - { - return convert(tx, ty, tz, ax, ay, az, s, s, s); - } - - public static TRSRTransformation convert(float tx, float ty, float tz, float ax, float ay, float az, float sx, float sy, float sz) - { - return TRSRTransformation.blockCenterToCorner(new TRSRTransformation( - new Vector3f(tx / 16, ty / 16, tz / 16), - TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)), - new Vector3f(sx, sy, sz), - null - )); - } - - private static final TRSRTransformation flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null); - - public static TRSRTransformation leftify(TRSRTransformation transform) - { - return TRSRTransformation.blockCenterToCorner(flipX.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(flipX)); - } - - public static Optional get(String name) - { - return Optional.ofNullable(transforms.get(name)); - } - - // Note: these strings might change to a full-blown resource locations in the future, and move from here to some json somewhere - // TODO: vanilla now includes from parent, deprecate? - private static final ImmutableMap transforms; - - static - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - - builder.put("identity", TRSRTransformation.identity()); - - // block/block - EnumMap block = new EnumMap<>(TransformType.class); - TRSRTransformation thirdPersonBlock = convert(0, 2.5f, 0, 75, 45, 0, 0.375f); - block.put(TransformType.GUI, convert(0, 0, 0, 30, 225, 0, 0.625f)); - block.put(TransformType.GROUND, convert(0, 3, 0, 0, 0, 0, 0.25f)); - block.put(TransformType.FIXED, convert(0, 0, 0, 0, 0, 0, 0.5f)); - block.put(TransformType.THIRD_PERSON_RIGHT_HAND, thirdPersonBlock); - block.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdPersonBlock)); - block.put(TransformType.FIRST_PERSON_RIGHT_HAND, convert(0, 0, 0, 0, 45, 0, 0.4f)); - block.put(TransformType.FIRST_PERSON_LEFT_HAND, convert(0, 0, 0, 0, 225, 0, 0.4f)); - builder.put("forge:default-block", new SimpleModelState(ImmutableMap.copyOf(block))); - - // item/generated - EnumMap item = new EnumMap<>(TransformType.class); - TRSRTransformation thirdPersonItem = convert(0, 3, 1, 0, 0, 0, 0.55f); - TRSRTransformation firstPersonItem = convert(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f); - item.put(TransformType.GROUND, convert(0, 2, 0, 0, 0, 0, 0.5f)); - item.put(TransformType.HEAD, convert(0, 13, 7, 0, 180, 0, 1)); - item.put(TransformType.THIRD_PERSON_RIGHT_HAND, thirdPersonItem); - item.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdPersonItem)); - item.put(TransformType.FIRST_PERSON_RIGHT_HAND, firstPersonItem); - item.put(TransformType.FIRST_PERSON_LEFT_HAND, leftify(firstPersonItem)); - item.put(TransformType.FIXED, convert(0, 0, 0, 0, 180, 0, 1)); - builder.put("forge:default-item", new SimpleModelState(ImmutableMap.copyOf(item))); - - // item/handheld - EnumMap tool = new EnumMap<>(TransformType.class); - tool.putAll(item); - tool.put(TransformType.THIRD_PERSON_RIGHT_HAND, convert(0, 4, 0.5f, 0, -90, 55, 0.85f)); - tool.put(TransformType.THIRD_PERSON_LEFT_HAND, convert(0, 4, 0.5f, 0, 90, -55, 0.85f)); - tool.put(TransformType.FIRST_PERSON_RIGHT_HAND, convert(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f)); - tool.put(TransformType.FIRST_PERSON_LEFT_HAND, convert(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)); - builder.put("forge:default-tool", new SimpleModelState(ImmutableMap.copyOf(tool))); - - transforms = builder.build(); - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/IModel.java b/src/main/java/net/minecraftforge/client/model/IModel.java deleted file mode 100644 index 3d83012fc..000000000 --- a/src/main/java/net/minecraftforge/client/model/IModel.java +++ /dev/null @@ -1,102 +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.Optional; -import java.util.function.Function; - -import javax.annotation.Nullable; - -import com.google.common.collect.ImmutableMap; - -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.ModelBakery; -import net.minecraft.client.renderer.texture.ISprite; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; -import net.minecraftforge.common.model.animation.IClip; - -/** - * General interface for any model that can be baked, superset of vanilla {@link net.minecraft.client.renderer.model.IUnbakedModel}. - * Models can be baked to different vertex formats and with different state. - */ -@SuppressWarnings("unchecked") -public interface IModel> -{ - /** - * @param spriteGetter Where textures will be looked up when baking - * @param sprite Transforms to apply while baking. Usually will be an instance of {@link IModelState}. - */ - @Nullable - IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format); - - /** - * Default state this model will be baked with. - * @see IModelState - */ - default IModelState getDefaultState() { - return TRSRTransformation.identity(); - } - - default Optional getClip(String name) { - return Optional.empty(); - } - - /** - * Allows the model to process custom data from the variant definition. - * If unknown data is encountered it should be skipped. - * @return a new model, with data applied. - */ - default T process(ImmutableMap customData) { - return (T) this; - } - - default T smoothLighting(boolean value) { - return (T) this; - } - - default T gui3d(boolean value) { - return (T) this; - } - - /** - * Applies new textures to the model. - * The returned model should be independent of the accessed one, - * as a model should be able to be retextured multiple times producing - * a separate model each time. - * - * The input map MAY map to an empty string "" which should be used - * to indicate the texture was removed. Handling of that is up to - * the model itself. Such as using default, missing texture, or - * removing vertices. - * - * The input should be considered a DIFF of the old textures, not a - * replacement as it may not contain everything. - * - * @param textures New - * @return Model with textures applied. - */ - default T retexture(ImmutableMap textures) { - return (T) this; - } -} diff --git a/src/main/java/net/minecraftforge/client/model/IModelBuilder.java b/src/main/java/net/minecraftforge/client/model/IModelBuilder.java new file mode 100644 index 000000000..79607a41d --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/IModelBuilder.java @@ -0,0 +1,70 @@ +/* + * 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 net.minecraft.client.renderer.model.BakedQuad; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.ItemOverrideList; +import net.minecraft.client.renderer.model.SimpleBakedModel; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.Direction; + +public interface IModelBuilder> +{ + static IModelBuilder of(IModelConfiguration owner, ItemOverrideList overrides, TextureAtlasSprite particle) + { + return new Simple(new SimpleBakedModel.Builder(owner, overrides).setTexture(particle)); + } + + T addFaceQuad(Direction facing, BakedQuad quad); + T addGeneralQuad(BakedQuad quad); + + IBakedModel build(); + + class Simple implements IModelBuilder { + final SimpleBakedModel.Builder builder; + + Simple(SimpleBakedModel.Builder builder) + { + this.builder = builder; + } + + @Override + public Simple addFaceQuad(Direction facing, BakedQuad quad) + { + builder.addFaceQuad(facing, quad); + return this; + } + + @Override + public Simple addGeneralQuad(BakedQuad quad) + { + builder.addGeneralQuad(quad); + return this; + } + + @Override + public IBakedModel build() + { + return builder.build(); + } + } +} + diff --git a/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java b/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java new file mode 100644 index 000000000..886f3da76 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java @@ -0,0 +1,91 @@ +/* + * 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 net.minecraft.client.renderer.model.IModelTransform; +import net.minecraft.client.renderer.model.ItemCameraTransforms; +import net.minecraft.client.renderer.model.Material; +import net.minecraftforge.client.model.geometry.IModelGeometryPart; + +/* + * Interface that provides generic access to the data within BlockModel, + * while allowing non-blockmodel usage of models + */ +public interface IModelConfiguration { + /** + * @return The name of the model being baked, for logging and cache purposes. + */ + String getModelName(); + + /** + * Checks if a texture is present in the model. + * @param name The name of a texture channel. + */ + boolean isTexturePresent(String name); + + /** + * Resolves the final texture name, taking into account texture aliases and replacements. + * @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); + + /** + * @return True if the item uses 3D lighting. + */ + boolean isShadedInGui(); + + /** + * @return True if the item requires per-vertex lighting. + */ + boolean useSmoothLighting(); + + /** + * Gets the vanilla camera transforms data. + * Do not use for non-vanilla code. For general usage, prefer getCombinedState. + */ + @Deprecated + ItemCameraTransforms getCameraTransforms(); + + /** + * @return The combined transformation state including vanilla and forge transforms data. + */ + IModelTransform getCombinedTransform(); + + /** + * Queries the visibility information for the model parts. + * @param part A part for which to query visibility. + * @param fallback A boolean specifying the default visibility if an override isn't found in the model data. + * @return The final computed visibility. + */ + default boolean getPartVisibility(IModelGeometryPart part, boolean fallback) { + return fallback; + } + + /** + * Queries the visibility information for the model parts. Same as above, but defaulting to visible. + * @param part A part for which to query visibility. + * @return The final computed visibility. + */ + default boolean getPartVisibility(IModelGeometryPart part) { + return getPartVisibility(part, true); + } + +} diff --git a/src/main/java/net/minecraftforge/client/model/IModelLoader.java b/src/main/java/net/minecraftforge/client/model/IModelLoader.java new file mode 100644 index 000000000..86a5aaccf --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/IModelLoader.java @@ -0,0 +1,53 @@ +/* + * 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.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import net.minecraft.resources.IResourceManager; +import net.minecraftforge.client.model.geometry.IModelGeometry; +import net.minecraftforge.resource.IResourceType; +import net.minecraftforge.resource.ISelectiveResourceReloadListener; +import net.minecraftforge.resource.VanillaResourceType; + +import java.util.function.Predicate; + +public interface IModelLoader> extends ISelectiveResourceReloadListener +{ + @Override + default IResourceType getResourceType() + { + return VanillaResourceType.MODELS; + } + + @Override + void onResourceManagerReload(IResourceManager resourceManager); + + @Override + default void onResourceManagerReload(IResourceManager resourceManager, Predicate resourcePredicate) + { + if (resourcePredicate.test(getResourceType())) + { + onResourceManagerReload(resourceManager); + } + } + + T read(JsonDeserializationContext deserializationContext, JsonObject modelContents); +} diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 4d584e76a..f0b4a17ee 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -19,31 +19,25 @@ package net.minecraftforge.client.model; -import javax.annotation.Nullable; -import javax.vecmath.Vector4f; - +import com.mojang.datafixers.util.Pair; +import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.model.*; -import net.minecraft.client.renderer.texture.ISprite; -import net.minecraftforge.versions.forge.ForgeVersion; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraftforge.client.model.geometry.IModelGeometry; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.resources.IResourceManager; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.pipeline.IVertexConsumer; import net.minecraftforge.client.model.pipeline.TRSRTransformer; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; import java.util.Arrays; import java.util.BitSet; import java.util.Collection; -import java.util.Collections; import java.util.EnumMap; -import java.util.Optional; import java.util.Set; import java.util.function.Function; @@ -58,90 +52,56 @@ import com.google.common.collect.ImmutableMap; * - Various fixes in the baking logic. * - Not limited to 4 layers maximum. */ -public final class ItemLayerModel implements IUnbakedModel +// TODO: Implement as new model loader +public final class ItemLayerModel implements IModelGeometry { public static final ItemLayerModel INSTANCE = new ItemLayerModel(ImmutableList.of()); private static final Direction[] HORIZONTALS = {Direction.UP, Direction.DOWN}; private static final Direction[] VERTICALS = {Direction.WEST, Direction.EAST}; - private final ImmutableList textures; - private final ItemOverrideList overrides; + private ImmutableList textures; - public ItemLayerModel(ImmutableList textures) - { - this(textures, ItemOverrideList.EMPTY); - } - - public ItemLayerModel(ImmutableList textures, ItemOverrideList overrides) + public ItemLayerModel(ImmutableList textures) { this.textures = textures; - this.overrides = overrides; } - public ItemLayerModel(ModelBakery bakery, BlockModel model, VertexFormat format) + public ItemLayerModel() { - this(getTextures(model), model.getOverrides(bakery, model, ModelLoader.defaultTextureGetter(), format)); + this.textures = null; } - private static ImmutableList getTextures(BlockModel 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(new ResourceLocation(model.resolveTextureName("layer" + i))); + builder.add(model.resolveTexture("layer" + i)); } return builder.build(); } @Override - public Collection getTextures(Function modelGetter, Set missingTextureErrors) - { - return textures; - } - - @Override - public Collection getDependencies() - { - return Collections.emptyList(); - } - - @Override - public ItemLayerModel retexture(ImmutableMap textures) - { - ImmutableList.Builder builder = ImmutableList.builder(); - for(int i = 0; i < textures.size() + this.textures.size(); i++) - { - if(textures.containsKey("layer" + i)) - { - builder.add(new ResourceLocation(textures.get("layer" + i))); - } - else if(i < this.textures.size()) - { - builder.add(this.textures.get(i)); - } - } - return new ItemLayerModel(builder.build(), overrides); - } - - @Nullable - @Override - public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) + public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation) { + //TODO: Verify ImmutableList.Builder builder = ImmutableList.builder(); - Optional transform = sprite.getState().apply(Optional.empty()); - boolean identity = !transform.isPresent() || transform.get().isIdentity(); + TransformationMatrix transform = sprite.func_225615_b_(); + boolean identity = transform.isIdentity(); for(int i = 0; i < textures.size(); i++) { TextureAtlasSprite tas = spriteGetter.apply(textures.get(i)); - builder.addAll(getQuadsForSprite(i, tas, format, transform)); + builder.addAll(getQuadsForSprite(i, tas, DefaultVertexFormats.BLOCK, transform)); } - TextureAtlasSprite particle = spriteGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0)); - ImmutableMap map = PerspectiveMapWrapper.getTransforms(sprite.getState()); + TextureAtlasSprite particle = spriteGetter.apply( + owner.isTexturePresent("particle") ? owner.resolveTexture("particle") : textures.get(0) + ); + ImmutableMap map = PerspectiveMapWrapper.getTransforms(sprite); return new BakedItemModel(builder.build(), particle, map, overrides, identity); } - public static ImmutableList getQuadsForSprite(int tint, TextureAtlasSprite sprite, VertexFormat format, Optional transform) + public static ImmutableList getQuadsForSprite(int tint, TextureAtlasSprite sprite, VertexFormat format, TransformationMatrix transform) { ImmutableList.Builder builder = ImmutableList.builder(); @@ -316,6 +276,13 @@ public final class ItemLayerModel implements IUnbakedModel return builder.build(); } + @Override + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + { + textures = getTextures(owner); + return textures; + } + private static class FaceData { private final EnumMap data = new EnumMap<>(Direction.class); @@ -348,7 +315,7 @@ public final class ItemLayerModel implements IUnbakedModel } } - private static BakedQuad buildSideQuad(VertexFormat format, Optional transform, Direction side, int tint, TextureAtlasSprite sprite, int u, int v, int size) + private static BakedQuad buildSideQuad(VertexFormat format, TransformationMatrix transform, Direction side, int tint, TextureAtlasSprite sprite, int u, int v, int size) { final float eps = 1e-2f; @@ -402,7 +369,7 @@ public final class ItemLayerModel implements IUnbakedModel } private static BakedQuad buildQuad( - VertexFormat format, Optional transform, Direction side, TextureAtlasSprite sprite, int tint, + VertexFormat format, TransformationMatrix transform, Direction side, TextureAtlasSprite sprite, int tint, float x0, float y0, float z0, float u0, float v0, float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, @@ -414,8 +381,8 @@ public final class ItemLayerModel implements IUnbakedModel builder.setQuadOrientation(side); builder.setTexture(sprite); - boolean hasTransform = transform.isPresent() && !transform.get().isIdentity(); - IVertexConsumer consumer = hasTransform ? new TRSRTransformer(builder, transform.get()) : builder; + boolean hasTransform = !transform.isIdentity(); + IVertexConsumer consumer = hasTransform ? new TRSRTransformer(builder, transform) : builder; putVertex(consumer, format, side, x0, y0, z0, u0, v0); putVertex(consumer, format, side, x1, y1, z1, u1, v1); @@ -427,9 +394,9 @@ public final class ItemLayerModel implements IUnbakedModel private static void putVertex(IVertexConsumer consumer, VertexFormat format, Direction side, float x, float y, float z, float u, float v) { - for(int e = 0; e < format.getElementCount(); e++) + for(int e = 0; e < format.func_227894_c_().size(); e++) { - switch(format.getElement(e).getUsage()) + switch(format.func_227894_c_().get(e).getUsage()) { case POSITION: consumer.put(e, x, y, z, 1f); @@ -444,7 +411,7 @@ public final class ItemLayerModel implements IUnbakedModel consumer.put(e, offX, offY, offZ, 0f); break; case UV: - if(format.getElement(e).getIndex() == 0) + if(format.func_227894_c_().get(e).getIndex() == 0) { consumer.put(e, u, v, 0f, 1f); break; @@ -456,27 +423,4 @@ public final class ItemLayerModel implements IUnbakedModel } } } - - public static enum Loader implements ICustomModelLoader - { - INSTANCE; - - @Override - public void onResourceManagerReload(IResourceManager resourceManager) {} - - @Override - public boolean accepts(ResourceLocation modelLocation) - { - return modelLocation.getNamespace().equals(ForgeVersion.MOD_ID) && ( - modelLocation.getPath().equals("item-layer") || - modelLocation.getPath().equals("models/block/item-layer") || - modelLocation.getPath().equals("models/item/item-layer")); - } - - @Override - public IUnbakedModel loadModel(ResourceLocation modelLocation) - { - return ItemLayerModel.INSTANCE; - } - } } diff --git a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java index cc95a4bdf..f1bd85be0 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java +++ b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java @@ -21,14 +21,13 @@ package net.minecraftforge.client.model; import com.google.common.collect.Lists; -import net.minecraft.client.renderer.texture.NativeImage; +import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.util.Direction; import net.minecraftforge.client.model.pipeline.IVertexConsumer; import net.minecraftforge.client.model.pipeline.TRSRTransformer; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; -import net.minecraftforge.common.model.TRSRTransformation; import java.util.List; @@ -52,7 +51,7 @@ public final class ItemTextureQuadConverter * @param sprite The texture whose UVs shall be used * @return The generated quads. */ - public static List convertTexture(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint) + public static List convertTexture(VertexFormat format, TransformationMatrix transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint) { List horizontal = convertTextureHorizontal(format, transform, template, sprite, z, facing, color, tint); List vertical = convertTextureVertical(format, transform, template, sprite, z, facing, color, tint); @@ -64,7 +63,7 @@ public final class ItemTextureQuadConverter * Scans a texture and converts it into a list of horizontal strips stacked on top of each other. * The height of the strips is as big as possible. */ - public static List convertTextureHorizontal(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint) + public static List convertTextureHorizontal(VertexFormat format, TransformationMatrix transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint) { int w = template.getWidth(); int h = template.getHeight(); @@ -135,7 +134,7 @@ public final class ItemTextureQuadConverter * Scans a texture and converts it into a list of vertical strips stacked next to each other from left to right. * The width of the strips is as big as possible. */ - public static List convertTextureVertical(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint) + public static List convertTextureVertical(VertexFormat format, TransformationMatrix transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint) { int w = template.getWidth(); int h = template.getHeight(); @@ -211,7 +210,7 @@ public final class ItemTextureQuadConverter * Generates a Front/Back quad for an itemmodel. Therefore only supports facing NORTH and SOUTH. * Coordinates are [0,16] to match the usual coordinates used in TextureAtlasSprites */ - public static UnpackedBakedQuad genQuad(VertexFormat format, TRSRTransformation transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, Direction facing, int color, int tint) + public static UnpackedBakedQuad genQuad(VertexFormat format, TransformationMatrix transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, Direction facing, int color, int tint) { float u1 = sprite.getInterpolatedU(x1); float v1 = sprite.getInterpolatedV(y1); @@ -230,7 +229,7 @@ public final class ItemTextureQuadConverter return putQuad(format, transform, facing, sprite, color, tint, x1, y1, x2, y2, z, u1, v1, u2, v2); } - private static UnpackedBakedQuad putQuad(VertexFormat format, TRSRTransformation transform, Direction side, TextureAtlasSprite sprite, int color, int tint, + private static UnpackedBakedQuad putQuad(VertexFormat format, TransformationMatrix transform, Direction side, TextureAtlasSprite sprite, int color, int tint, float x1, float y1, float x2, float y2, float z, float u1, float v1, float u2, float v2) { @@ -264,9 +263,9 @@ public final class ItemTextureQuadConverter private static void putVertex(IVertexConsumer consumer, VertexFormat format, Direction side, float x, float y, float z, float u, float v, int color) { - for (int e = 0; e < format.getElementCount(); e++) + for (int e = 0; e < format.func_227894_c_().size(); e++) { - switch (format.getElement(e).getUsage()) + switch (format.func_227894_c_().get(e).getUsage()) { case POSITION: consumer.put(e, x, y, z, 1f); @@ -285,7 +284,7 @@ public final class ItemTextureQuadConverter consumer.put(e, offX, offY, offZ, 0f); break; case UV: - if (format.getElement(e).getIndex() == 0) + if (format.func_227894_c_().get(e).getIndex() == 0) { consumer.put(e, u, v, 0f, 1f); break; diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 981fb7755..1d9c7b74f 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -20,49 +20,47 @@ package net.minecraftforge.client.model; import java.io.IOException; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; +import java.util.*; +import javax.annotation.Nonnull; import javax.annotation.Nullable; -import javax.vecmath.Quat4f; +import com.google.common.collect.*; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import com.mojang.datafixers.util.Pair; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Quaternion; +import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.ISprite; -import net.minecraft.client.renderer.texture.PngSizeInfo; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.renderer.texture.*; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.data.AnimationMetadataSection; import net.minecraft.entity.LivingEntity; import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemStack; import net.minecraft.resources.IResource; import net.minecraft.resources.IResourceManager; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.client.model.geometry.IModelGeometry; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.resource.IResourceType; +import net.minecraftforge.resource.VanillaResourceType; import net.minecraftforge.versions.forge.ForgeVersion; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraftforge.common.model.TransformationHelper; import net.minecraftforge.fluids.FluidUtil; import java.util.function.Function; -import java.util.Optional; -import java.util.Random; -import java.util.Set; +import java.util.function.Predicate; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public final class ModelDynBucket implements IUnbakedModel +public final class ModelDynBucket implements IModelGeometry { private static final Logger LOGGER = LogManager.getLogger(); public static final ModelResourceLocation LOCATION = new ModelResourceLocation(new ResourceLocation(ForgeVersion.MOD_ID, "dynbucket"), "inventory"); @@ -73,111 +71,28 @@ public final class ModelDynBucket implements IUnbakedModel private static final float NORTH_Z_FLUID = 7.498f / 16f; private static final float SOUTH_Z_FLUID = 8.502f / 16f; - public static final IUnbakedModel MODEL = new ModelDynBucket(); + @Deprecated + public static final ModelDynBucket MODEL = new ModelDynBucket(); - @Nullable - private final ResourceLocation baseLocation; - @Nullable - private final ResourceLocation liquidLocation; - @Nullable - private final ResourceLocation coverLocation; - @Nullable + @Nonnull private final Fluid fluid; private final boolean flipGas; private final boolean tint; + private final boolean coverIsMask; + @Deprecated public ModelDynBucket() { - this(null, null, null, null, false, true); + this(Fluids.EMPTY, false, true, false); } - public ModelDynBucket(@Nullable ResourceLocation baseLocation, @Nullable ResourceLocation liquidLocation, @Nullable ResourceLocation coverLocation, @Nullable Fluid fluid, boolean flipGas, boolean tint) + public ModelDynBucket(Fluid fluid, boolean flipGas, boolean tint, boolean coverIsMask) { - this.baseLocation = baseLocation; - this.liquidLocation = liquidLocation; - this.coverLocation = coverLocation; this.fluid = fluid; this.flipGas = flipGas; this.tint = tint; - } - - @Override - public Collection getTextures(Function modelGetter, Set missingTextureErrors) - { - ImmutableSet.Builder builder = ImmutableSet.builder(); - - if (baseLocation != null) - builder.add(baseLocation); - if (liquidLocation != null) - builder.add(liquidLocation); - if (coverLocation != null) - builder.add(coverLocation); - if (fluid != null) - builder.add(fluid.getAttributes().getStillTexture()); - - return builder.build(); - } - - @Override - public Collection getDependencies() - { - return Collections.emptyList(); - } - - @Nullable - @Override - public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) - { - IModelState state = sprite.getState(); - ImmutableMap transformMap = PerspectiveMapWrapper.getTransforms(state); - - // if the fluid is lighter than air, will manipulate the initial state to be rotated 180° to turn it upside down - if (flipGas && fluid != null && fluid.getAttributes().isLighterThanAir()) - { - sprite = new ModelStateComposition(state, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(null, new Quat4f(0, 0, 1, 0), null, null))); - state = sprite.getState(); - } - - TRSRTransformation transform = state.apply(Optional.empty()).orElse(TRSRTransformation.identity()); - TextureAtlasSprite fluidSprite = null; - TextureAtlasSprite particleSprite = null; - ImmutableList.Builder builder = ImmutableList.builder(); - - if(fluid != null) { - fluidSprite = spriteGetter.apply(fluid.getAttributes().getStillTexture()); - } - - Random random = new Random(); - if (baseLocation != null) - { - // build base (insidest) - IBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(bakery, spriteGetter, sprite, format); - random.setSeed(42); - builder.addAll(model.getQuads(null, null, random)); - particleSprite = model.getParticleTexture(); - } - if (liquidLocation != null && fluidSprite != null) - { - TextureAtlasSprite liquid = spriteGetter.apply(liquidLocation); - // build liquid layer (inside) - builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, liquid, fluidSprite, NORTH_Z_FLUID, Direction.NORTH, tint ? fluid.getAttributes().getColor() : 0xFFFFFFFF, 1)); - builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, liquid, fluidSprite, SOUTH_Z_FLUID, Direction.SOUTH, tint ? fluid.getAttributes().getColor() : 0xFFFFFFFF, 1)); - particleSprite = fluidSprite; - } - if (coverLocation != null) - { - // cover (the actual item around the other two) - TextureAtlasSprite cover = spriteGetter.apply(coverLocation); - builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16, 16, NORTH_Z_COVER, cover, Direction.NORTH, 0xFFFFFFFF, 2)); - builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16, 16, SOUTH_Z_COVER, cover, Direction.SOUTH, 0xFFFFFFFF, 2)); - if (particleSprite == null) - { - particleSprite = cover; - } - } - - return new BakedDynBucket(bakery, this, builder.build(), particleSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap(), transform.isIdentity()); + this.coverIsMask = coverIsMask; } /** @@ -188,67 +103,19 @@ public final class ModelDynBucket implements IUnbakedModel *

* If the fluid can't be found, water is used. */ - @Override - public ModelDynBucket process(ImmutableMap customData) + @Deprecated + public ModelDynBucket withFluid(String newFluid) { - ResourceLocation fluidName = new ResourceLocation(customData.get("fluid")); + ResourceLocation fluidName = new ResourceLocation(newFluid); Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidName); - if (fluid == null) fluid = this.fluid; - - boolean flip = flipGas; - if (customData.containsKey("flipGas")) - { - String flipStr = customData.get("flipGas"); - if (flipStr.equals("true")) flip = true; - else if (flipStr.equals("false")) flip = false; - else - throw new IllegalArgumentException(String.format("DynBucket custom data \"flipGas\" must have value \'true\' or \'false\' (was \'%s\')", flipStr)); - } - - boolean tint = this.tint; - if (customData.containsKey("applyTint")) - { - String string = customData.get("applyTint"); - switch (string) - { - case "true": tint = true; break; - case "false": tint = false; break; - default: throw new IllegalArgumentException(String.format("DynBucket custom data \"applyTint\" must have value \'true\' or \'false\' (was \'%s\')", string)); - } - } + if (fluid == null) + fluid = this.fluid; // create new model with correct liquid - return new ModelDynBucket(baseLocation, liquidLocation, coverLocation, fluid, flip, tint); + return new ModelDynBucket(fluid, flipGas, tint, coverIsMask); } - /** - * Allows to use different textures for the model. - * There are 3 layers: - * base - The empty bucket/container - * fluid - A texture representing the liquid portion. Non-transparent = liquid - * cover - An overlay that's put over the liquid (optional) - *

- * If no liquid is given a hardcoded variant for the bucket is used. - */ - @Override - public ModelDynBucket retexture(ImmutableMap textures) - { - - ResourceLocation base = baseLocation; - ResourceLocation liquid = liquidLocation; - ResourceLocation cover = coverLocation; - - if (textures.containsKey("base")) - base = new ResourceLocation(textures.get("base")); - if (textures.containsKey("fluid")) - liquid = new ResourceLocation(textures.get("fluid")); - if (textures.containsKey("cover")) - cover = new ResourceLocation(textures.get("cover")); - - return new ModelDynBucket(base, liquid, cover, fluid, flipGas, tint); - } - @Nullable protected static IResource getResource(ResourceLocation resourceLocation) { @@ -274,21 +141,128 @@ public final class ModelDynBucket implements IUnbakedModel throw new RuntimeException(e); } } - - public enum LoaderDynBucket implements ICustomModelLoader + + @Override + public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation) + { + Material particleLocation = owner.resolveTexture("particle"); + if (MissingTextureSprite.getLocation().toString().equals(particleLocation)) + { + particleLocation = null; + } + + Material baseLocation = owner.resolveTexture("base"); + if (MissingTextureSprite.getLocation().toString().equals(baseLocation)) + { + baseLocation = null; + } + + Material fluidMaskLocation = owner.resolveTexture("fluid"); + if (MissingTextureSprite.getLocation().toString().equals(fluidMaskLocation)) + { + fluidMaskLocation = null; + } + + Material coverLocation = owner.resolveTexture("cover"); + if (!MissingTextureSprite.getLocation().toString().equals(coverLocation)) + { + // cover (the actual item around the other two) + coverLocation = null; + } + + IModelTransform transformsFromModel = owner.getCombinedTransform(); + + IModelTransform state = sprite; + ImmutableMap transformMap = transformsFromModel != null ? + PerspectiveMapWrapper.getTransforms(new ModelTransformComposition(transformsFromModel, state)) : + PerspectiveMapWrapper.getTransforms(state); + + TextureAtlasSprite particleSprite = particleLocation != null ? spriteGetter.apply(particleLocation) : null; + + // if the fluid is lighter than air, will manipulate the initial state to be rotated 180° to turn it upside down + if (flipGas && fluid != Fluids.EMPTY && fluid.getAttributes().isLighterThanAir()) + { + sprite = new ModelTransformComposition(state, new SimpleModelTransform(TransformationHelper.blockCenterToCorner(new TransformationMatrix(null, new Quaternion(0, 0, 1, 0), null, null)))); + state = sprite; + } + + TransformationMatrix transform = state.func_225615_b_(); + + Material fluidLocation = fluid != Fluids.EMPTY ? fluid.getAttributes().getStillMaterial() : null; + TextureAtlasSprite fluidSprite = fluidLocation != null ? spriteGetter.apply(fluidLocation) : null; + + if (particleSprite == null) particleSprite = fluidSprite; + + Random random = new Random(); + ImmutableList.Builder builder = ImmutableList.builder(); + + if (baseLocation != null) + { + // build base (insidest) + IBakedModel model = new ItemLayerModel(ImmutableList.of(baseLocation)).bake(owner, bakery, spriteGetter, sprite, ItemOverrideList.EMPTY, modelLocation); + random.setSeed(42); + builder.addAll(model.getQuads(null, null, random)); + } + + if (fluidMaskLocation != null && fluidSprite != null) + { + TextureAtlasSprite templateSprite = spriteGetter.apply(fluidMaskLocation); + if (templateSprite != null) + { + // build liquid layer (inside) + builder.addAll(ItemTextureQuadConverter.convertTexture(DefaultVertexFormats.BLOCK, transform, templateSprite, fluidSprite, NORTH_Z_FLUID, Direction.NORTH, tint ? fluid.getAttributes().getColor() : 0xFFFFFFFF, 1)); + builder.addAll(ItemTextureQuadConverter.convertTexture(DefaultVertexFormats.BLOCK, transform, templateSprite, fluidSprite, SOUTH_Z_FLUID, Direction.SOUTH, tint ? fluid.getAttributes().getColor() : 0xFFFFFFFF, 1)); + } + } + + if (coverLocation != null && (!coverIsMask || baseLocation != null)) + { + // cover (the actual item around the other two) + TextureAtlasSprite coverSprite = spriteGetter.apply(coverLocation); + if (coverSprite != null) + { + if (coverIsMask) + { + TextureAtlasSprite baseSprite = spriteGetter.apply(baseLocation); + builder.addAll(ItemTextureQuadConverter.convertTexture(DefaultVertexFormats.BLOCK, transform, coverSprite, baseSprite, NORTH_Z_COVER, Direction.NORTH, 0xFFFFFFFF, 1)); + builder.addAll(ItemTextureQuadConverter.convertTexture(DefaultVertexFormats.BLOCK, transform, coverSprite, baseSprite, SOUTH_Z_COVER, Direction.SOUTH, 0xFFFFFFFF, 1)); + } + else + { + builder.add(ItemTextureQuadConverter.genQuad(DefaultVertexFormats.BLOCK, transform, 0, 0, 16, 16, NORTH_Z_COVER, coverSprite, Direction.NORTH, 0xFFFFFFFF, 2)); + builder.add(ItemTextureQuadConverter.genQuad(DefaultVertexFormats.BLOCK, transform, 0, 0, 16, 16, SOUTH_Z_COVER, coverSprite, Direction.SOUTH, 0xFFFFFFFF, 2)); + if (particleSprite == null) + { + particleSprite = coverSprite; + } + } + } + } + + return new BakedDynBucket(bakery, owner, this, builder.build(), particleSprite, DefaultVertexFormats.BLOCK, Maps.immutableEnumMap(transformMap), Maps.newHashMap(), transform.isIdentity()); + } + + @Override + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + { + Set texs = Sets.newHashSet(); + + texs.add(owner.resolveTexture("particle")); + texs.add(owner.resolveTexture("base")); + texs.add(owner.resolveTexture("fluid")); + texs.add(owner.resolveTexture("cover")); + + return texs; + } + + public enum LoaderDynBucket2 implements IModelLoader { INSTANCE; @Override - public boolean accepts(ResourceLocation modelLocation) + public IResourceType getResourceType() { - return modelLocation.getNamespace().equals(ForgeVersion.MOD_ID) && modelLocation.getPath().contains("forgebucket"); - } - - @Override - public IUnbakedModel loadModel(ResourceLocation modelLocation) - { - return MODEL; + return VanillaResourceType.MODELS; } @Override @@ -297,27 +271,46 @@ public final class ModelDynBucket implements IUnbakedModel // no need to clear cache since we create a new model instance } - public void register(AtlasTexture map) + @Override + public void onResourceManagerReload(IResourceManager resourceManager, Predicate resourcePredicate) { - // only create these textures if they are not added by a resource pack + // no need to clear cache since we create a new model instance + } - IResource res; - if (getResource(new ResourceLocation(ForgeVersion.MOD_ID, "textures/items/bucket_cover.png")) == null) + @Override + public ModelDynBucket read(JsonDeserializationContext deserializationContext, JsonObject modelContents) + { + if (!modelContents.has("fluid")) + throw new RuntimeException("Bucket model requires 'fluid' value."); + + ResourceLocation fluidName = new ResourceLocation(modelContents.get("fluid").getAsString()); + + Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidName); + + boolean flip = false; + if (modelContents.has("flipGas")) { - ResourceLocation bucketCover = new ResourceLocation(ForgeVersion.MOD_ID, "items/bucket_cover"); - BucketCoverSprite bucketCoverSprite = new BucketCoverSprite(bucketCover); -// map.setTextureEntry(bucketCoverSprite); + flip = modelContents.get("flipGas").getAsBoolean(); } - if (getResource(new ResourceLocation(ForgeVersion.MOD_ID, "textures/items/bucket_base.png")) == null) + boolean tint = true; + if (modelContents.has("applyTint")) { - ResourceLocation bucketBase = new ResourceLocation(ForgeVersion.MOD_ID, "items/bucket_base"); - BucketBaseSprite bucketBaseSprite = new BucketBaseSprite(bucketBase); -// map.setTextureEntry(bucketBaseSprite); + tint = modelContents.get("applyTint").getAsBoolean(); } + + boolean coverIsMask = true; + if (modelContents.has("coverIsMask")) + { + coverIsMask = modelContents.get("coverIsMask").getAsBoolean(); + } + + // create new model with correct liquid + return new ModelDynBucket(fluid, flip, tint, coverIsMask); } } + /* TODO Custom TAS private static final class BucketBaseSprite extends TextureAtlasSprite { private final ResourceLocation bucket = new ResourceLocation("item/bucket"); @@ -328,7 +321,6 @@ public final class ModelDynBucket implements IUnbakedModel super(res, getSizeInfo(getResource(new ResourceLocation("textures/item/bucket.png"))), getResource(new ResourceLocation("textures/item/bucket.png")).getMetadata(AnimationMetadataSection.SERIALIZER)); } - /* TODO Custom TAS @Override public boolean hasCustomLoader(@Nonnull IResourceManager manager, @Nonnull ResourceLocation location) { @@ -353,12 +345,13 @@ public final class ModelDynBucket implements IUnbakedModel this.clearFramesTextureData(); this.framesTextureData.add(pixels); return false; - }*/ - } + } + }*/ /** * Creates a bucket cover sprite from the vanilla resource. */ + /* TODO Custom TAS private static final class BucketCoverSprite extends TextureAtlasSprite { private final ResourceLocation bucket = new ResourceLocation("item/bucket"); @@ -370,7 +363,6 @@ public final class ModelDynBucket implements IUnbakedModel super(res, getSizeInfo(getResource(new ResourceLocation("textures/item/bucket.png"))), getResource(new ResourceLocation("textures/item/bucket.png")).getMetadata(AnimationMetadataSection.SERIALIZER)); } - /* TODO Custom TAS @Override public boolean hasCustomLoader(@Nonnull IResourceManager manager, @Nonnull ResourceLocation location) { @@ -422,8 +414,8 @@ public final class ModelDynBucket implements IUnbakedModel this.clearFramesTextureData(); this.framesTextureData.add(pixels); return false; - }*/ - } + } + }*/ private static final class BakedDynBucketOverrideHandler extends ItemOverrideList { @@ -446,11 +438,8 @@ public final class ModelDynBucket implements IUnbakedModel if (!model.cache.containsKey(name)) { - IUnbakedModel parent = model.parent.process(ImmutableMap.of("fluid", name)); - Function textureGetter; - textureGetter = location -> Minecraft.getInstance().getTextureMap().getAtlasSprite(location.toString()); - - IBakedModel bakedModel = parent.bake(bakery, textureGetter, new SimpleModelState(model.transforms), model.format); + ModelDynBucket parent = model.parent.withFluid(name); + IBakedModel bakedModel = parent.bake(model.owner, bakery, ModelLoader.defaultTextureGetter(), new SimpleModelTransform(model.transforms), model.getOverrides(), new ResourceLocation("forge:bucket_override")); model.cache.put(name, bakedModel); return bakedModel; } @@ -465,20 +454,22 @@ public final class ModelDynBucket implements IUnbakedModel // the dynamic bucket is based on the empty bucket private static final class BakedDynBucket extends BakedItemModel { + private final IModelConfiguration owner; private final ModelDynBucket parent; private final Map cache; // contains all the baked models since they'll never change private final VertexFormat format; BakedDynBucket(ModelBakery bakery, - ModelDynBucket parent, + IModelConfiguration owner, ModelDynBucket parent, ImmutableList quads, TextureAtlasSprite particle, VertexFormat format, - ImmutableMap transforms, + ImmutableMap transforms, Map cache, boolean untransformed) { super(quads, particle, transforms, new BakedDynBucketOverrideHandler(bakery), untransformed); + this.owner = owner; this.format = format; this.parent = parent; this.cache = cache; diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index f56ca6da5..ba6fd8bb3 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -21,7 +21,6 @@ package net.minecraftforge.client.model; import java.util.function.Function; import java.util.Collection; -import java.util.Collections; import java.util.EnumMap; import java.util.List; import java.util.Optional; @@ -29,31 +28,27 @@ import java.util.Random; import java.util.Set; import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; +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.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.ISprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; -import net.minecraft.resources.IResourceManager; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.model.data.IModelData; +import net.minecraftforge.client.model.geometry.IModelGeometry; import net.minecraftforge.client.model.pipeline.IVertexConsumer; import net.minecraftforge.client.model.pipeline.TRSRTransformer; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import net.minecraftforge.fluids.FluidAttributes; -import net.minecraftforge.versions.forge.ForgeVersion; -import net.minecraftforge.common.model.TRSRTransformation; - -import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; @@ -64,9 +59,8 @@ import com.google.common.collect.ImmutableSet; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -public final class ModelFluid implements IUnbakedModel +public final class ModelFluid implements IModelGeometry { - private static final Logger LOGGER = LogManager.getLogger(); public static final ModelFluid WATER = new ModelFluid(Fluids.WATER); public static final ModelFluid LAVA = new ModelFluid(Fluids.LAVA); @@ -78,60 +72,31 @@ public final class ModelFluid implements IUnbakedModel } @Override - public Collection getTextures(Function modelGetter, Set missingTextureErrors) + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { FluidAttributes attrs = fluid.getAttributes(); - return attrs.getOverlayTexture() != null - ? ImmutableSet.of(attrs.getStillTexture(), attrs.getFlowingTexture(), attrs.getOverlayTexture()) - : ImmutableSet.of(attrs.getStillTexture(), attrs.getFlowingTexture()); + return attrs.getOverlayMaterial() != null + ? ImmutableSet.of(attrs.getStillMaterial(), attrs.getFlowingMaterial(), attrs.getOverlayMaterial()) + : ImmutableSet.of(attrs.getStillMaterial(), attrs.getFlowingMaterial()); } @Override - public Collection getDependencies() { - return Collections.emptyList(); - } - - @Nullable - @Override - public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) + public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation) { FluidAttributes attrs = fluid.getAttributes(); return new CachingBakedFluid( - sprite.getState().apply(Optional.empty()), - PerspectiveMapWrapper.getTransforms(sprite.getState()), - format, + sprite.func_225615_b_(), + PerspectiveMapWrapper.getTransforms(sprite), + modelLocation, attrs.getColor(), - spriteGetter.apply(attrs.getStillTexture()), - spriteGetter.apply(attrs.getFlowingTexture()), - Optional.ofNullable(attrs.getOverlayTexture()).map(spriteGetter), + spriteGetter.apply(attrs.getStillMaterial()), + spriteGetter.apply(attrs.getFlowingMaterial()), + Optional.ofNullable(attrs.getOverlayMaterial()).map(spriteGetter), attrs.isLighterThanAir(), null ); } - public enum FluidLoader implements ICustomModelLoader - { - INSTANCE; - - @Override - public void onResourceManagerReload(IResourceManager resourceManager) {} - - @Override - public boolean accepts(ResourceLocation modelLocation) - { - return modelLocation.getNamespace().equals(ForgeVersion.MOD_ID) && ( - modelLocation.getPath().equals("fluid") || - modelLocation.getPath().equals("models/block/fluid") || - modelLocation.getPath().equals("models/item/fluid")); - } - - @Override - public IUnbakedModel loadModel(ResourceLocation modelLocation) - { - return WATER; - } - } - private static final class CachingBakedFluid extends BakedFluid { private final LoadingCache modelCache = CacheBuilder.newBuilder().maximumSize(200).build(new CacheLoader() @@ -155,13 +120,13 @@ public final class ModelFluid implements IUnbakedModel overlaySides[i] = (key & 1) != 0; key >>>= 1; } - return new BakedFluid(transformation, transforms, format, color, still, flowing, overlay, gas, statePresent, cornerRound, flowRound, overlaySides); + return new BakedFluid(transformation, transforms, modelLocation, color, still, flowing, overlay, gas, statePresent, cornerRound, flowRound, overlaySides); } }); - public CachingBakedFluid(Optional transformation, ImmutableMap transforms, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, Optional overlay, boolean gas, Optional stateOption) + public CachingBakedFluid(TransformationMatrix transformation, ImmutableMap transforms, ResourceLocation modelLocation, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, Optional overlay, boolean gas, Optional stateOption) { - super(transformation, transforms, format, color, still, flowing, overlay, gas, stateOption.isPresent(), getCorners(stateOption), getFlow(stateOption), getOverlay(stateOption)); + super(transformation, transforms, modelLocation, color, still, flowing, overlay, gas, stateOption.isPresent(), getCorners(stateOption), getFlow(stateOption), getOverlay(stateOption)); } /** @@ -270,20 +235,20 @@ public final class ModelFluid implements IUnbakedModel private static final int z[] = { 0, 1, 1, 0 }; private static final float eps = 1e-3f; - protected final Optional transformation; - protected final ImmutableMap transforms; - protected final VertexFormat format; + protected final TransformationMatrix transformation; + protected final ImmutableMap transforms; + protected final ResourceLocation modelLocation; protected final int color; protected final TextureAtlasSprite still, flowing; protected final Optional overlay; protected final boolean gas; protected final ImmutableMap> faceQuads; - public BakedFluid(Optional transformation, ImmutableMap transforms, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, Optional overlay, boolean gas, boolean statePresent, int[] cornerRound, int flowRound, boolean[] sideOverlays) + public BakedFluid(TransformationMatrix transformation, ImmutableMap transforms, ResourceLocation modelLocation, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, Optional overlay, boolean gas, boolean statePresent, int[] cornerRound, int flowRound, boolean[] sideOverlays) { this.transformation = transformation; this.transforms = transforms; - this.format = format; + this.modelLocation = modelLocation; this.color = color; this.still = still; this.flowing = flowing; @@ -401,14 +366,14 @@ public final class ModelFluid implements IUnbakedModel private BakedQuad buildQuad(Direction side, TextureAtlasSprite texture, boolean flip, boolean offset, VertexParameter x, VertexParameter y, VertexParameter z, VertexParameter u, VertexParameter v) { - UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); + UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.BLOCK); builder.setQuadOrientation(side); builder.setTexture(texture); builder.setQuadTint(0); - boolean hasTransform = transformation.isPresent() && !transformation.get().isIdentity(); - IVertexConsumer consumer = hasTransform ? new TRSRTransformer(builder, transformation.get()) : builder; + boolean hasTransform = !transformation.isIdentity(); + IVertexConsumer consumer = hasTransform ? new TRSRTransformer(builder, transformation) : builder; for (int i = 0; i < 4; i++) { @@ -426,9 +391,11 @@ public final class ModelFluid implements IUnbakedModel private void putVertex(IVertexConsumer consumer, Direction side, boolean offset, float x, float y, float z, float u, float v) { - for(int e = 0; e < format.getElementCount(); e++) + VertexFormat format = DefaultVertexFormats.BLOCK; + ImmutableList elements = format.func_227894_c_(); + for(int e = 0; e < elements.size(); e++) { - switch(format.getElement(e).getUsage()) + switch(elements.get(e).getUsage()) { case POSITION: float dx = offset ? side.getDirectionVec().getX() * eps : 0f; @@ -450,7 +417,7 @@ public final class ModelFluid implements IUnbakedModel consumer.put(e, offX, offY, offZ, 0f); break; case UV: - if(format.getElement(e).getIndex() == 0) + if(elements.get(e).getIndex() == 0) { consumer.put(e, u, v, 0f, 1f); break; @@ -500,13 +467,18 @@ public final class ModelFluid implements IUnbakedModel } @Override - public Pair handlePerspective(TransformType type) + public boolean doesHandlePerspectives() { - return PerspectiveMapWrapper.handlePerspective(this, transforms, type); + return true; + } + + @Override + public IBakedModel handlePerspective(TransformType type, MatrixStack mat) + { + return PerspectiveMapWrapper.handlePerspective(this, transforms, type, mat); } } - @Override public ModelFluid process(ImmutableMap customData) { if(!customData.containsKey("fluid")) return this; diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 2a0636a26..ede816811 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -19,102 +19,27 @@ package net.minecraftforge.client.model; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.NoSuchElementException; import java.util.Set; -import java.util.concurrent.TimeUnit; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BlockModelShapes; -import net.minecraft.client.renderer.ItemModelMesher; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.color.BlockColors; -import net.minecraft.client.renderer.model.BakedQuad; -import net.minecraft.client.renderer.model.BlockPart; -import net.minecraft.client.renderer.model.BlockPartFace; -import net.minecraft.client.renderer.model.BlockPartRotation; -import net.minecraft.client.renderer.model.BuiltInModel; -import net.minecraft.client.renderer.model.FaceBakery; -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.IUnbakedModel; -import net.minecraft.client.renderer.model.ItemCameraTransforms; -import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.model.ItemModelGenerator; -import net.minecraft.client.renderer.model.ItemOverrideList; -import net.minecraft.client.renderer.model.ModelBakery; -import net.minecraft.client.renderer.model.BlockModel; -import net.minecraft.client.renderer.model.BlockModelDefinition; -import net.minecraft.client.renderer.model.ModelResourceLocation; -import net.minecraft.client.renderer.model.ModelRotation; -import net.minecraft.client.renderer.model.MultipartBakedModel; -import net.minecraft.client.renderer.model.SimpleBakedModel; -import net.minecraft.client.renderer.model.Variant; -import net.minecraft.client.renderer.model.VariantList; -import net.minecraft.client.renderer.model.WeightedBakedModel; -import net.minecraft.client.renderer.model.multipart.Multipart; -import net.minecraft.client.renderer.model.multipart.Selector; -import net.minecraft.client.renderer.texture.ISprite; +import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.texture.MissingTextureSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.item.Item; import net.minecraft.profiler.IProfiler; import net.minecraft.resources.IResourceManager; -import net.minecraft.state.StateContainer; -import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.animation.AnimationItemOverrideList; -import net.minecraftforge.client.model.animation.ModelBlockAnimation; -import net.minecraftforge.client.model.data.IModelData; -import net.minecraftforge.common.ForgeMod; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.Models; -import net.minecraftforge.common.model.TRSRTransformation; -import net.minecraftforge.common.model.animation.IClip; -import net.minecraftforge.common.property.Properties; -import net.minecraftforge.fml.client.ClientModLoader; import net.minecraftforge.logging.ModelLoaderErrorMessage; -import net.minecraftforge.registries.IRegistryDelegate; - -import org.apache.commons.lang3.tuple.Pair; import java.util.function.Function; -import com.google.common.base.Joiner; -import com.google.common.base.Objects; -import com.google.common.base.Preconditions; -import java.util.Optional; -import java.util.Random; -import java.util.stream.Collectors; -import java.util.stream.StreamSupport; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.google.common.collect.Multimaps; -import com.google.common.collect.Sets; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import static net.minecraftforge.fml.Logging.MODELLOADING; @@ -122,25 +47,29 @@ import static net.minecraftforge.fml.Logging.MODELLOADING; public final class ModelLoader extends ModelBakery { private static final Logger LOGGER = LogManager.getLogger(); - private final Map stateModels = Maps.newHashMap(); - private final Map multipartDefinitions = Maps.newHashMap(); - private final Map multipartModels = Maps.newHashMap(); private final Map loadingExceptions = Maps.newHashMap(); private IUnbakedModel missingModel = null; private boolean isLoading = false; + + private static ModelLoader instance; + + @Nullable + public static ModelLoader instance() + { + return instance; + } + public boolean isLoading() { return isLoading; } - public ModelLoader(IResourceManager manager, AtlasTexture map, BlockColors colours, IProfiler profiler) + public ModelLoader(IResourceManager manager, BlockColors colours, IProfiler profiler, int p_i226056_4_) { - super(manager, map, colours, false); - VanillaLoader.INSTANCE.setLoader(this); - VariantLoader.INSTANCE.setLoader(this); - ModelLoaderRegistry.clearModelCache(manager); - processLoading(profiler); + super(manager, colours, false); + instance = this; + processLoading(profiler, p_i226056_4_); } private static Set specialModels = new HashSet<>(); @@ -178,420 +107,13 @@ public final class ModelLoader extends ModelBakery return new ResourceLocation(model.getNamespace(), model.getPath() + ".json"); } - private final class VanillaModelWrapper implements IUnbakedModel - { - private final ResourceLocation location; - private final BlockModel model; - private final boolean uvlock; - private final ModelBlockAnimation animation; - - public VanillaModelWrapper(ResourceLocation location, BlockModel model, boolean uvlock, ModelBlockAnimation animation) - { - this.location = location; - this.model = model; - this.uvlock = uvlock; - this.animation = animation; - } - - @Override - public Collection getDependencies() - { - Set set = Sets.newHashSet(); - for(ResourceLocation dep : model.getDependencies()) - { - if(!location.equals(dep)) - { - set.add(dep); - // TODO: check if this can go somewhere else, random access to global things is bad - stateModels.put(getInventoryVariant(dep.toString()), ModelLoaderRegistry.getModelOrLogError(dep, "Could not load override model " + dep + " for model " + location)); - } - } - if(model.getParentLocation() != null && !model.getParentLocation().getPath().startsWith("builtin/")) - { - set.add(model.getParentLocation()); - } - return ImmutableSet.copyOf(set); - } - - @Override - public Collection getTextures(Function modelGetter, Set missingTextureErrors) - { - // setting parent here to make textures resolve properly - if(model.getParentLocation() != null) - { - if(model.getParentLocation().getPath().equals("builtin/generated")) - { - model.parent = MODEL_GENERATED; - } - else - { - IUnbakedModel parent = ModelLoaderRegistry.getModelOrLogError(model.getParentLocation(), "Could not load vanilla model parent '" + model.getParentLocation() + "' for '" + model); - if(parent instanceof VanillaModelWrapper) - { - model.parent = ((VanillaModelWrapper) parent).model; - } - else - { - throw new IllegalStateException("vanilla model '" + model + "' can't have non-vanilla parent"); - } - } - } - - ImmutableSet.Builder builder = ImmutableSet.builder(); - - if(model == ModelBakery.MODEL_GENERATED) - { - for(String s : ItemModelGenerator.LAYERS) - { - String r = model.resolveTextureName(s); - ResourceLocation loc = new ResourceLocation(r); - if(!r.equals(s)) - { - builder.add(loc); - } - } - } - for(String s : model.textures.values()) - { - if(!s.startsWith("#")) - { - builder.add(new ResourceLocation(s)); - } - } - - if (model.parent != null) - builder.addAll(model.parent.getTextures(modelGetter, missingTextureErrors)); - - return builder.build(); - } - - @Nullable - @Override - public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) - { - return VanillaLoader.INSTANCE.modelCache.getUnchecked(new BakedModelCacheKey(this, bakery, spriteGetter, sprite.getState(), uvlock, format)); - } - - public IBakedModel bakeImpl(ModelBakery bakery, Function bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format) - { - if(!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT)) - { - throw new IllegalArgumentException("can't bake vanilla models to the format that doesn't fit into the default one: " + format); - } - BlockModel model = this.model; - if(model == null) return getMissingModel().bake(bakery, bakedTextureGetter, new BasicState(getMissingModel().getDefaultState(), uvlock), format); - - List newTransforms = Lists.newArrayList(); - for(int i = 0; i < model.getElements().size(); i++) - { - BlockPart part = model.getElements().get(i); - newTransforms.add(animation.getPartTransform(state, part, i)); - } - - ItemCameraTransforms transforms = model.getAllTransforms(); - Map tMap = Maps.newEnumMap(TransformType.class); - tMap.putAll(PerspectiveMapWrapper.getTransforms(transforms)); - tMap.putAll(PerspectiveMapWrapper.getTransforms(state)); - IModelState perState = new SimpleModelState(ImmutableMap.copyOf(tMap), state.apply(Optional.empty())); - - if(model == ModelBakery.MODEL_GENERATED) - { - return new ItemLayerModel(bakery, model, format).bake(bakery, bakedTextureGetter, new BasicState(perState, uvlock), format); - } - TextureAtlasSprite textureatlassprite = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle"))); - if(model == ModelBakery.MODEL_ENTITY) return new BuiltInModel(transforms, model.getOverrides(bakery, model, bakedTextureGetter, format), textureatlassprite); - return bakeNormal(bakery, model, perState, state, newTransforms, format, bakedTextureGetter, uvlock); - } - - private IBakedModel bakeNormal(ModelBakery bakery, BlockModel model, IModelState perState, final IModelState modelState, List newTransforms, final VertexFormat format, final Function bakedTextureGetter, boolean uvLocked) - { - final TRSRTransformation baseState = modelState.apply(Optional.empty()).orElse(TRSRTransformation.identity()); - TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle"))); - SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.getOverrides(bakery, model, bakedTextureGetter, format))).setTexture(particle); - for(int i = 0; i < model.getElements().size(); i++) - { - if(modelState.apply(Optional.of(Models.getHiddenModelPart(ImmutableList.of(Integer.toString(i))))).isPresent()) - { - continue; - } - BlockPart part = model.getElements().get(i); - TRSRTransformation transformation = baseState; - if(newTransforms.get(i) != null) - { - transformation = transformation.compose(newTransforms.get(i)); - BlockPartRotation rot = part.partRotation; - if(rot == null) rot = new BlockPartRotation(new Vector3f(), Direction.Axis.Y, 0, false); - part = new BlockPart(part.positionFrom, part.positionTo, part.mapFaces, rot, part.shade); - } - for(Map.Entry e : part.mapFaces.entrySet()) - { - TextureAtlasSprite textureatlassprite1 = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName(e.getValue().texture))); - - if (e.getValue().cullFace == null || !TRSRTransformation.isInteger(transformation.getMatrixVec())) - { - builder.addGeneralQuad(BlockModel.makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), new BasicState(transformation, uvLocked))); - } - else - { - builder.addFaceQuad(baseState.rotateTransform(e.getValue().cullFace), BlockModel.makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), new BasicState(transformation, uvLocked))); - } - } - } - - return new PerspectiveMapWrapper(builder.build(), perState) - { - private final ItemOverrideList overrides = new AnimationItemOverrideList(bakery, VanillaModelWrapper.this, modelState, format, bakedTextureGetter, super.getOverrides()); - - @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData modelData) - { - IModelState newState = modelData.getData(Properties.AnimationProperty); - if(newState != null) - { - return VanillaModelWrapper.this.bake(bakery, bakedTextureGetter, new ModelStateComposition(modelState, newState, uvlock), format).getQuads(state, side, rand, modelData); - } - return super.getQuads(state, side, rand); - } - - @Override - public ItemOverrideList getOverrides() - { - return overrides; - } - }; - } - - @Override - public VanillaModelWrapper retexture(ImmutableMap textures) - { - if (textures.isEmpty()) - return this; - - List elements = Lists.newArrayList(); //We have to duplicate this so we can edit it below. - for (BlockPart part : this.model.getElements()) - { - elements.add(new BlockPart(part.positionFrom, part.positionTo, Maps.newHashMap(part.mapFaces), part.partRotation, part.shade)); - } - - BlockModel newModel = new BlockModel(this.model.getParentLocation(), elements, - Maps.newHashMap(this.model.textures), this.model.isAmbientOcclusion(), this.model.isGui3d(), //New Textures man VERY IMPORTANT - model.getAllTransforms(), Lists.newArrayList(model.getOverrides())); - newModel.name = this.model.name; - newModel.parent = this.model.parent; - - Set removed = Sets.newHashSet(); - - for (Entry e : textures.entrySet()) - { - if ("".equals(e.getValue())) - { - removed.add(e.getKey()); - newModel.textures.remove(e.getKey()); - } - else - newModel.textures.put(e.getKey(), e.getValue()); - } - - // Map the model's texture references as if it was the parent of a model with the retexture map as its textures. - Map remapped = Maps.newHashMap(); - - for (Entry e : newModel.textures.entrySet()) - { - if (e.getValue().startsWith("#")) - { - String key = e.getValue().substring(1); - if (newModel.textures.containsKey(key)) - remapped.put(e.getKey(), newModel.textures.get(key)); - } - } - - newModel.textures.putAll(remapped); - - //Remove any faces that use a null texture, this is for performance reasons, also allows some cool layering stuff. - for (BlockPart part : newModel.getElements()) - { - part.mapFaces.entrySet().removeIf(entry -> removed.contains(entry.getValue().texture)); - } - - return new VanillaModelWrapper(location, newModel, uvlock, animation); - } - - @Override - public Optional getClip(String name) - { - if(animation.getClips().containsKey(name)) - { - return Optional.ofNullable(animation.getClips().get(name)); - } - return Optional.empty(); - } - - @Override - public VanillaModelWrapper smoothLighting(boolean value) - { - if(model.ambientOcclusion == value) - { - return this; - } - BlockModel newModel = new BlockModel(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.getAllTransforms(), Lists.newArrayList(model.getOverrides())); - newModel.parent = model.parent; - newModel.name = model.name; - return new VanillaModelWrapper(location, newModel, uvlock, animation); - } - - @Override - public VanillaModelWrapper gui3d(boolean value) - { - if(model.isGui3d() == value) - { - return this; - } - BlockModel newModel = new BlockModel(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.getAllTransforms(), Lists.newArrayList(model.getOverrides())); - newModel.parent = model.parent; - newModel.name = model.name; - return new VanillaModelWrapper(location, newModel, uvlock, animation); - } - } - - private static final class WeightedRandomModel implements IUnbakedModel - { - private final List variants; - private final List locations; - private final Set textures; - private final List models; - private final IModelState defaultState; - - public WeightedRandomModel(ResourceLocation parent, VariantList variants) throws Exception - { - this.variants = variants.getVariantList(); - this.locations = new ArrayList<>(); - this.textures = Sets.newHashSet(); - this.models = new ArrayList<>(); - ImmutableList.Builder> builder = ImmutableList.builder(); - for (Variant v : this.variants) - { - ResourceLocation loc = v.getModelLocation(); - locations.add(loc); - - /* - * Vanilla eats this, which makes it only show variants that have models. - * But that doesn't help debugging, so throw the exception - */ - IUnbakedModel model; - if(loc.equals(MODEL_MISSING)) - { - // explicit missing location, happens if blockstate has "model"=null - model = ModelLoaderRegistry.getMissingModel(); - } - else - { - model = ModelLoaderRegistry.getModel(loc); - } - - for(ResourceLocation location : model.getDependencies()) - { - ModelLoaderRegistry.getModelOrMissing(location); - } - //FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e); - textures.addAll(model.getTextures(ModelLoader.defaultModelGetter(), new HashSet<>())); // Kick this, just in case. - - models.add(model); - - IModelState modelDefaultState = model.getDefaultState(); - Preconditions.checkNotNull(modelDefaultState, "Model %s returned null as default state", loc); - builder.add(Pair.of(model, new ModelStateComposition(v.getState(), modelDefaultState, v.isUvLock()))); - } - - if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation. - { - // FIXME: log this? - IUnbakedModel missing = ModelLoaderRegistry.getMissingModel(); - models.add(missing); - builder.add(Pair.of(missing, TRSRTransformation.identity())); - } - - defaultState = new MultiModelState(builder.build()); - } - - private WeightedRandomModel(List variants, List locations, Set textures, List models, IModelState defaultState) - { - this.variants = variants; - this.locations = locations; - this.textures = textures; - this.models = models; - this.defaultState = defaultState; - } - - @Override - public Collection getDependencies() - { - return ImmutableList.copyOf(locations); - } - - @Override - public Collection getTextures(Function modelGetter, Set missingTextureErrors) - { - return ImmutableSet.copyOf(textures); - } - - @Nullable - @Override - public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) - { - if(!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT)) - { - throw new IllegalArgumentException("can't bake vanilla weighted models to the format that doesn't fit into the default one: " + format); - } - if(variants.size() == 1) - { - IUnbakedModel model = models.get(0); - return model.bake(bakery, spriteGetter, new BasicState(MultiModelState.getPartState(sprite.getState(), model, 0), sprite.isUvLock()), format); - } - WeightedBakedModel.Builder builder = new WeightedBakedModel.Builder(); - for(int i = 0; i < variants.size(); i++) - { - IUnbakedModel model = models.get(i); - builder.add(model.bake(bakery, spriteGetter, new BasicState(MultiModelState.getPartState(sprite.getState(), model, i), sprite.isUvLock()), format), variants.get(i).getWeight()); - } - return builder.build(); - } - - @Override - public IModelState getDefaultState() - { - return defaultState; - } - - @Override - public WeightedRandomModel retexture(ImmutableMap textures) - { - if (textures.isEmpty()) - return this; - - // rebuild the texture list taking into account new textures - Set modelTextures = Sets.newHashSet(); - // also recreate the MultiModelState so IModelState data is properly applied to the retextured model - ImmutableList.Builder> builder = ImmutableList.builder(); - List retexturedModels = Lists.newArrayList(); - for(int i = 0; i < this.variants.size(); i++) - { - IUnbakedModel retextured = this.models.get(i).retexture(textures); - modelTextures.addAll(retextured.getTextures(ModelLoader.defaultModelGetter(), new HashSet<>())); - retexturedModels.add(retextured); - builder.add(Pair.of(retextured, this.variants.get(i).getState())); - } - - return new WeightedRandomModel(this.variants, this.locations, modelTextures, retexturedModels, new MultiModelState(builder.build())); - } - } - protected IUnbakedModel getMissingModel() { if (missingModel == null) { try { - missingModel = VanillaLoader.INSTANCE.loadModel(new ResourceLocation(MODEL_MISSING.getNamespace(), MODEL_MISSING.getPath())); + missingModel = getUnbakedModel(MODEL_MISSING); } catch(Exception e) { @@ -601,122 +123,49 @@ public final class ModelLoader extends ModelBakery return missingModel; } - protected final class BakedModelCacheKey + /** + * Use this if you don't care about the exception and want some model anyway. + */ + public IUnbakedModel getModelOrMissing(ResourceLocation location) { - private final VanillaModelWrapper model; - private final ModelBakery bakery; - private final Function bakedTextureGetter; - private final IModelState state; - private final boolean uvlock; - private final VertexFormat format; - - public BakedModelCacheKey(VanillaModelWrapper model, ModelBakery bakery, Function bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format) + try { - this.model = model; - this.bakery = bakery; - this.bakedTextureGetter = bakedTextureGetter; - this.state = state; - this.uvlock = uvlock; - this.format = format; + return getUnbakedModel(location); } - - @Override - public boolean equals(Object o) + catch(Exception e) { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - BakedModelCacheKey that = (BakedModelCacheKey) o; - return Objects.equal(model, that.model) && Objects.equal(bakery, that.bakery) && Objects.equal(bakedTextureGetter, that.bakedTextureGetter) && Objects.equal(state, that.state) && uvlock == that.uvlock && Objects.equal(format, that.format); - } - - @Override - public int hashCode() - { - return Objects.hashCode(model, state, format, bakedTextureGetter); + return getMissingModel(); } } /** - * Adapter from the vanilla json model loader to a custom model loader + * Use this if you want the model, but need to log the error. */ - protected static enum VanillaLoader implements ICustomModelLoader + public IUnbakedModel getModelOrLogError(ResourceLocation location, String error) { - INSTANCE; - - @Nullable - private ModelLoader loader; - private LoadingCache modelCache = CacheBuilder.newBuilder().maximumSize(50).expireAfterWrite(100, TimeUnit.MILLISECONDS).build(new CacheLoader() { - @Override - public IBakedModel load(BakedModelCacheKey key) throws Exception - { - return key.model.bakeImpl(key.bakery, key.bakedTextureGetter, key.state, key.uvlock, key.format); - } - }); - - void setLoader(ModelLoader loader) + try { - this.loader = loader; + return getUnbakedModel(location); } - - @Nullable - ModelLoader getLoader() + catch(Exception e) { - return loader; - } - - // NOOP, handled by ModelLoader itself - @Override - public void onResourceManagerReload(IResourceManager resourceManager) {} - - @Override - public boolean accepts(ResourceLocation modelLocation) - { - return true; - } - - @Override - public IUnbakedModel loadModel(ResourceLocation modelLocation) throws Exception - { - if(modelLocation.equals(MODEL_MISSING) && loader.missingModel != null) - { - return loader.getMissingModel(); - } - - String trimmedPath = modelLocation.getPath(); - if(modelLocation.getPath().startsWith("models/")) - { - trimmedPath = trimmedPath.substring("models/".length()); - } - ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getNamespace(), "armatures/" + trimmedPath + ".json"); - ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation(loader.resourceManager, armatureLocation); - - ResourceLocation trimmedLocation = new ResourceLocation(modelLocation.getNamespace(), trimmedPath); - BlockModel model = loader.loadModel(trimmedLocation); - IUnbakedModel iModel = loader.new VanillaModelWrapper(modelLocation, model, false, animation); - if(loader.missingModel == null && modelLocation.equals(MODEL_MISSING)) - { - loader.missingModel = iModel; - } - return iModel; - } - - @Override - public String toString() - { - return "VanillaLoader.INSTANCE"; + LOGGER.error(error, e); + return getMissingModel(); } } // Temporary to compile things public static final class White { public static final ResourceLocation LOCATION = new ResourceLocation("white"); - public static final TextureAtlasSprite INSTANCE = MissingTextureSprite.func_217790_a(); + private static TextureAtlasSprite instance = null; + public static final TextureAtlasSprite instance() + { + if (instance == null) + { + instance = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, LOCATION).func_229314_c_(); + } + return instance; + } } /** @@ -762,7 +211,7 @@ public final class ModelLoader extends ModelBakery } */ @SuppressWarnings("serial") - public static class ItemLoadingException extends ModelLoaderRegistry.LoaderException + public static class ItemLoadingException extends ModelLoadingException { private final Exception normalException; private final Exception blockstateException; @@ -808,66 +257,18 @@ public final class ModelLoader extends ModelBakery } */ - private static enum DefaultTextureGetter implements Function - { - INSTANCE; - - @Override - public TextureAtlasSprite apply(ResourceLocation location) - { - return Minecraft.getInstance().getTextureMap().getAtlasSprite(location.toString()); - } - } - - private static final Function DEFAULT_MODEL_GETTER = ModelLoaderRegistry::getModelOrMissing; + private static final Function DEFAULT_MODEL_GETTER = (rl) -> ModelLoader.instance().getModelOrMissing(rl); /** * Get the default texture getter the models will be baked with. */ - public static Function defaultTextureGetter() + public static Function defaultTextureGetter() { - return DefaultTextureGetter.INSTANCE; + return Material::func_229314_c_; } public static Function defaultModelGetter() { return DEFAULT_MODEL_GETTER; } - - /** - * Exposes the blockstate json loader as a custom model loader - */ - protected static enum VariantLoader implements ICustomModelLoader - { - INSTANCE; - - private ModelLoader loader; - - void setLoader(ModelLoader loader) - { - this.loader = loader; - } - - // NOOP, handled in loader - @Override - public void onResourceManagerReload(IResourceManager resourceManager) {} - - @Override - public boolean accepts(ResourceLocation modelLocation) - { - return modelLocation instanceof ModelResourceLocation; - } - - @Override - public IUnbakedModel loadModel(ResourceLocation modelLocation) - { - return loader.getUnbakedModel(modelLocation); - } - - @Override - public String toString() - { - return "VariantLoader.INSTANCE"; - } - } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 763e24206..554593663 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -19,255 +19,345 @@ package net.minecraftforge.client.model; -import java.util.Deque; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.google.common.collect.Queues; 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.model.IUnbakedModel; -import net.minecraft.client.renderer.model.ModelResourceLocation; +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; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.resources.IResourceManager; +import net.minecraft.util.Direction; +import net.minecraft.util.JSONUtils; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ModelLoader.VanillaLoader; -import net.minecraftforge.client.model.ModelLoader.VariantLoader; -import net.minecraftforge.client.model.b3d.B3DLoader; +import net.minecraftforge.client.model.composite.CompositeModel; +import net.minecraftforge.client.model.geometry.IModelGeometry; +import net.minecraftforge.client.model.geometry.ISimpleModelGeometry; import net.minecraftforge.client.model.obj.OBJLoader; -import net.minecraftforge.common.animation.ITimeValue; -import net.minecraftforge.common.model.animation.AnimationStateMachine; -import net.minecraftforge.common.model.animation.IAnimationStateMachine; +import net.minecraftforge.common.model.TransformationHelper; + +import javax.annotation.Nullable; +import java.lang.reflect.Type; +import java.util.*; +import java.util.function.Function; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Central hub for custom model loaders. */ public class ModelLoaderRegistry { - private static final Logger LOGGER = LogManager.getLogger(); - - private static final Set loaders = Sets.newHashSet(); - private static final Map cache = Maps.newHashMap(); - private static final Deque loadingModels = Queues.newArrayDeque(); - - private static IResourceManager manager; + private static final Map> loaders = Maps.newHashMap(); // Forge built-in loaders public static void init() { - registerLoader(B3DLoader.INSTANCE); - registerLoader(OBJLoader.INSTANCE); - registerLoader(ModelFluid.FluidLoader.INSTANCE); - registerLoader(ItemLayerModel.Loader.INSTANCE); - registerLoader(MultiLayerModel.Loader.INSTANCE); - registerLoader(ModelDynBucket.LoaderDynBucket.INSTANCE); + registerLoader(new ResourceLocation("forge:obj"), OBJLoader.INSTANCE); + registerLoader(new ResourceLocation("forge:bucket"), ModelDynBucket.LoaderDynBucket2.INSTANCE); + registerLoader(new ResourceLocation("forge:composite"), CompositeModel.Loader.INSTANCE); + registerLoader(new ResourceLocation("minecraft:elements"), VanillaProxy.Loader.INSTANCE); + + // TODO: Implement as new model loaders + //registerLoader(new ResourceLocation("forge:b3d"), new ModelLoaderAdapter(B3DLoader.INSTANCE)); + //registerLoader(new ResourceLocation("forge:fluid"), new ModelLoaderAdapter(ModelFluid.FluidLoader.INSTANCE)); + //registerLoader(new ResourceLocation("forge:multi-layer"), new ModelLoaderAdapter(MultiLayerModel.Loader.INSTANCE)); } /** * Makes system aware of your loader. */ - public static void registerLoader(ICustomModelLoader loader) + public static void registerLoader(ResourceLocation id, IModelLoader loader) { - loaders.add(loader); + loaders.put(id, loader); ((IReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener(loader); - // FIXME: Existing model loaders expect to receive a call as soon as they are registered, which was the old behaviour pre-1.13 - // without this, their manager field is never initialized. - loader.onResourceManagerReload(Minecraft.getInstance().getResourceManager()); } - public static boolean loaded(ResourceLocation location) + public static IModelGeometry getModel(ResourceLocation loaderId, JsonDeserializationContext deserializationContext, JsonObject data) { - return cache.containsKey(location); - } - - - public static ResourceLocation getActualLocation(ResourceLocation location) - { - if(location instanceof ModelResourceLocation) return location; - if(location.getPath().startsWith("builtin/")) return location; - return new ResourceLocation(location.getNamespace(), "models/" + location.getPath()); - } - - /** - * Primary method to get IModel instances. - * @param location The path to load, either: - * - Pure {@link ResourceLocation}. "models/" will be prepended to the path, then - * the path is passed to the {@link ICustomModelLoader}s, which may further modify - * the path before asking resource packs for it. For example, the {@link VanillaLoader} - * appends ".json" before looking the model up. - * - {@link ModelResourceLocation}. The blockstate system will load the model, using {@link VariantLoader}. - */ - public static IUnbakedModel getModel(ResourceLocation location) throws Exception - { - IUnbakedModel model; - - IUnbakedModel cached = cache.get(location); - if (cached != null) return cached; - - for(ResourceLocation loading : loadingModels) - { - if(location.getClass() == loading.getClass() && location.equals(loading)) - { - throw new LoaderException("circular model dependencies, stack: [" + Joiner.on(", ").join(loadingModels) + "]"); - } - } - loadingModels.addLast(location); try { - ResourceLocation actual = getActualLocation(location); - ICustomModelLoader accepted = null; - for(ICustomModelLoader loader : loaders) - { - try - { - if(loader.accepts(actual)) - { - if(accepted != null) - { - throw new LoaderException(String.format("2 loaders (%s and %s) want to load the same model %s", accepted, loader, location)); - } - accepted = loader; - } - } - catch(Exception e) - { - throw new LoaderException(String.format("Exception checking if model %s can be loaded with loader %s, skipping", location, loader), e); - } - } + if (!loaders.containsKey(loaderId)) + throw new IllegalStateException(String.format("Model loader '%s' not found.", loaderId)); - // no custom loaders found, try vanilla ones - if(accepted == null) - { - if(VariantLoader.INSTANCE.accepts(actual)) - { - accepted = VariantLoader.INSTANCE; - } - else if(VanillaLoader.INSTANCE.accepts(actual)) - { - accepted = VanillaLoader.INSTANCE; - } - } + IModelLoader loader = loaders.get(loaderId); - if(accepted == null) - { - throw new LoaderException("no suitable loader found for the model " + location + ", skipping"); - } + return loader.read(deserializationContext, data); + } + catch(Exception e) + { + e.printStackTrace(); + throw e; + } + } + + @Nullable + public static IModelGeometry deserializeGeometry(JsonDeserializationContext deserializationContext, JsonObject object) { + if (!object.has("loader")) { + return null; + } + + ResourceLocation loader = new ResourceLocation(JSONUtils.getString(object,"loader")); + return getModel(loader, deserializationContext, object); + } + + 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) + { + if (tex == null) + return blockMaterial("forge:white"); + if (tex.startsWith("#")) + return owner.resolveTexture(tex); + + // Attempt to convert a common (windows/linux/mac) filesystem path to a ResourceLocation. + // This makes no promises, if it doesn't work, too bad, fix your mtl file. + Matcher match = FILESYSTEM_PATH_TO_RESLOC.matcher(tex); + if (match.matches()) + { + String namespace = match.group("namespace"); + String path = match.group("path").replace("\\", "/"); + if (namespace != null) + return blockMaterial(new ResourceLocation(namespace, path)); + return blockMaterial(path); + } + + return blockMaterial(tex); + } + + public static Material blockMaterial(String location) + { + return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(location)); + } + + public static Material blockMaterial(ResourceLocation location) + { + return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, location); + } + + @Nullable + public static IModelTransform deserializeModelTransforms(JsonDeserializationContext deserializationContext, JsonObject modelData) + { + if (!modelData.has("transform")) + return null; + + return deserializeTransform(deserializationContext, modelData.get("transform")).orElse(null); + } + + public static Optional deserializeTransform(JsonDeserializationContext context, JsonElement transformData) + { + if (!transformData.isJsonObject()) + { try { - model = accepted.loadModel(actual); + TransformationMatrix base = context.deserialize(transformData, TransformationMatrix.class); + return Optional.of(new SimpleModelTransform(ImmutableMap.of(), TransformationHelper.blockCenterToCorner(base))); } - catch(Exception e) + catch (JsonParseException e) { - throw new LoaderException(String.format("Exception loading model %s with loader %s, skipping", location, accepted), e); - } - if(model == getMissingModel()) - { - throw new LoaderException(String.format("Loader %s returned missing model while loading model %s", accepted, location)); - } - if(model == null) - { - throw new LoaderException(String.format("Loader %s returned null while loading model %s", accepted, location)); + throw new JsonParseException("transform: expected a string, object or valid base transformation, got: " + transformData); } } - finally + else { - ResourceLocation popLoc = loadingModels.removeLast(); - if(popLoc != location) + JsonObject transform = transformData.getAsJsonObject(); + EnumMap transforms = Maps.newEnumMap(ItemCameraTransforms.TransformType.class); + + deserializeTRSR(context, transforms, transform, "thirdperson", ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND); + deserializeTRSR(context, transforms, transform, "thirdperson_righthand", ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND); + deserializeTRSR(context, transforms, transform, "thirdperson_lefthand", ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND); + + deserializeTRSR(context, transforms, transform, "firstperson", ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND); + deserializeTRSR(context, transforms, transform, "firstperson_righthand", ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND); + deserializeTRSR(context, transforms, transform, "firstperson_lefthand", ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND); + + deserializeTRSR(context, transforms, transform, "head", ItemCameraTransforms.TransformType.HEAD); + deserializeTRSR(context, transforms, transform, "gui", ItemCameraTransforms.TransformType.GUI); + deserializeTRSR(context, transforms, transform, "ground", ItemCameraTransforms.TransformType.GROUND); + deserializeTRSR(context, transforms, transform, "fixed", ItemCameraTransforms.TransformType.FIXED); + + int k = transform.entrySet().size(); + if(transform.has("matrix")) k--; + if(transform.has("translation")) k--; + if(transform.has("rotation")) k--; + if(transform.has("scale")) k--; + if(transform.has("post-rotation")) k--; + if(k > 0) { - throw new IllegalStateException("Corrupted loading model stack: " + popLoc + " != " + location); + throw new JsonParseException("transform: allowed keys: 'thirdperson', 'firstperson', 'gui', 'head', 'matrix', 'translation', 'rotation', 'scale', 'post-rotation'"); } + TransformationMatrix base = TransformationMatrix.func_227983_a_(); + if(!transform.entrySet().isEmpty()) + { + base = context.deserialize(transform, TransformationMatrix.class); + base = TransformationHelper.blockCenterToCorner(base); + } + IModelTransform state = new SimpleModelTransform(Maps.immutableEnumMap(transforms), base); + return Optional.of(state); } - cache.put(location, model); - for (ResourceLocation dep : model.getDependencies()) + } + + private static void deserializeTRSR(JsonDeserializationContext context, EnumMap transforms, JsonObject transform, String name, ItemCameraTransforms.TransformType itemCameraTransform) + { + if(transform.has(name)) { - getModelOrMissing(dep); + TransformationMatrix t = context.deserialize(transform.remove(name), TransformationMatrix.class); + transforms.put(itemCameraTransform, TransformationHelper.blockCenterToCorner(t)); } + } + + public static IBakedModel bakeHelper(BlockModel blockModel, ModelBakery modelBakery, BlockModel otherModel, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) + { + IBakedModel model; + IModelGeometry customModel = blockModel.customData.getCustomGeometry(); + IModelTransform customModelState = blockModel.customData.getCustomModelState(); + if (customModelState != null) + { + sprite = new ModelTransformComposition(customModelState, sprite, sprite.isUvLock()); + } + if (customModel != null) + { + model = customModel.bake(blockModel.customData, modelBakery, spriteGetter, sprite, blockModel.getOverrides(modelBakery, otherModel, spriteGetter), modelLocation); + } + else + { + model = blockModel.bakeVanilla(modelBakery, otherModel, spriteGetter, sprite, modelLocation); + } + + if (customModelState != null && !model.doesHandlePerspectives()) + { + model = new PerspectiveMapWrapper(model, customModelState); + } + return model; } - /** - * Use this if you don't care about the exception and want some model anyway. - */ - public static IUnbakedModel getModelOrMissing(ResourceLocation location) + public static class VanillaProxy implements ISimpleModelGeometry { - try + private final List elements; + + public VanillaProxy(List list) { - return getModel(location); + this.elements = list; } - catch(Exception e) + + @Override + public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) { - return getMissingModel(location, e); + for(BlockPart blockpart : elements) { + for(Direction direction : blockpart.mapFaces.keySet()) { + BlockPartFace blockpartface = blockpart.mapFaces.get(direction); + TextureAtlasSprite textureatlassprite1 = spriteGetter.apply(owner.resolveTexture(blockpartface.texture)); + if (blockpartface.cullFace == null) { + modelBuilder.addGeneralQuad(BlockModel.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, direction, sprite, modelLocation)); + } else { + modelBuilder.addFaceQuad( + sprite.func_225615_b_().rotateTransform(blockpartface.cullFace), + BlockModel.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, direction, sprite, modelLocation)); + } + } + } + } + + @Override + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + { + Set textures = Sets.newHashSet(); + + for(BlockPart part : elements) { + for(BlockPartFace face : part.mapFaces.values()) { + Material texture = owner.resolveTexture(face.texture); + if (Objects.equals(texture, MissingTextureSprite.getLocation().toString())) { + missingTextureErrors.add(Pair.of(face.texture, owner.getModelName())); + } + + textures.add(texture); + } + } + + return textures; + } + + public static class Loader implements IModelLoader + { + public static final Loader INSTANCE = new Loader(); + + private Loader() + { + } + + @Override + public void onResourceManagerReload(IResourceManager resourceManager) + { + + } + + @Override + public VanillaProxy read(JsonDeserializationContext deserializationContext, JsonObject modelContents) + { + List list = this.getModelElements(deserializationContext, modelContents); + return new VanillaProxy(list); + } + + private List getModelElements(JsonDeserializationContext deserializationContext, JsonObject object) { + List list = Lists.newArrayList(); + if (object.has("elements")) { + for(JsonElement jsonelement : JSONUtils.getJsonArray(object, "elements")) { + list.add(deserializationContext.deserialize(jsonelement, BlockPart.class)); + } + } + + return list; + } } } - /** - * Use this if you want the model, but need to log the error. - */ - public static IUnbakedModel getModelOrLogError(ResourceLocation location, String error) + public static class ExpandedBlockModelDeserializer extends BlockModel.Deserializer { - try - { - return getModel(location); + public static final Gson INSTANCE = (new GsonBuilder()) + .registerTypeAdapter(BlockModel.class, new ExpandedBlockModelDeserializer()) + .registerTypeAdapter(BlockPart.class, new BlockPart.Deserializer()) + .registerTypeAdapter(BlockPartFace.class, new BlockPartFace.Deserializer()) + .registerTypeAdapter(BlockFaceUV.class, new BlockFaceUV.Deserializer()) + .registerTypeAdapter(ItemTransformVec3f.class, new ItemTransformVec3f.Deserializer()) + .registerTypeAdapter(ItemCameraTransforms.class, new ItemCameraTransforms.Deserializer()) + .registerTypeAdapter(ItemOverride.class, new ItemOverride.Deserializer()) + .registerTypeAdapter(TransformationMatrix.class, new TransformationHelper.Deserializer()) + .create(); + + public BlockModel deserialize(JsonElement element, Type targetType, JsonDeserializationContext deserializationContext) throws JsonParseException { + BlockModel model = super.deserialize(element, targetType, deserializationContext); + JsonObject jsonobject = element.getAsJsonObject(); + IModelGeometry geometry = deserializeGeometry(deserializationContext, jsonobject); + + List elements = model.getElements(); + if (geometry != null) { + elements.clear(); + model.customData.setCustomGeometry(geometry); + } + + IModelTransform modelState = deserializeModelTransforms(deserializationContext, jsonobject); + if (modelState != null) + { + model.customData.setCustomModelState(modelState); + } + + if (jsonobject.has("visibility")) + { + JsonObject visibility = JSONUtils.getJsonObject(jsonobject, "visibility"); + for(Map.Entry part : visibility.entrySet()) + { + model.customData.visibilityData.setVisibilityState(part.getKey(), part.getValue().getAsBoolean()); + } + } + + return model; } - catch(Exception e) - { - LOGGER.error(error, e); - return getMissingModel(location, e); - } - } - - public static IUnbakedModel getMissingModel() - { - final ModelLoader loader = VanillaLoader.INSTANCE.getLoader(); - if(loader == null) - { - throw new IllegalStateException("Using ModelLoaderRegistry too early."); - } - return loader.getMissingModel(); - } - - static IUnbakedModel getMissingModel(ResourceLocation location, Throwable cause) - { - //IModel model = new FancyMissingModel(ExceptionUtils.getStackTrace(cause).replaceAll("\\t", " ")); - IUnbakedModel model = new FancyMissingModel(getMissingModel(), location.toString()); - return model; - } - - public static void clearModelCache(IResourceManager manager) - { - ModelLoaderRegistry.manager = manager; - cache.clear(); - // putting the builtin models in - cache.put(new ResourceLocation("minecraft:builtin/generated"), ItemLayerModel.INSTANCE); - cache.put(new ResourceLocation("minecraft:block/builtin/generated"), ItemLayerModel.INSTANCE); - cache.put(new ResourceLocation("minecraft:item/builtin/generated"), ItemLayerModel.INSTANCE); - } - - public static class LoaderException extends Exception - { - public LoaderException(String message) - { - super(message); - } - - public LoaderException(String message, Throwable cause) - { - super(message, cause); - } - - private static final long serialVersionUID = 1L; - } - - public static IAnimationStateMachine loadASM(ResourceLocation location, ImmutableMap customParameters) - { - return AnimationStateMachine.load(manager, location, customParameters); } } diff --git a/src/main/java/net/minecraftforge/client/model/ISmartVariant.java b/src/main/java/net/minecraftforge/client/model/ModelLoadingException.java similarity index 72% rename from src/main/java/net/minecraftforge/client/model/ISmartVariant.java rename to src/main/java/net/minecraftforge/client/model/ModelLoadingException.java index 975e96320..476ed4f17 100644 --- a/src/main/java/net/minecraftforge/client/model/ISmartVariant.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoadingException.java @@ -19,12 +19,17 @@ package net.minecraftforge.client.model; -import net.minecraft.client.renderer.model.IUnbakedModel; - -@Deprecated -public interface ISmartVariant +public class ModelLoadingException extends RuntimeException { - default IUnbakedModel process(IUnbakedModel base) { - return base; + public ModelLoadingException(String message) + { + super(message); } + + public ModelLoadingException(String message, Throwable cause) + { + super(message, cause); + } + + private static final long serialVersionUID = 1L; } diff --git a/src/main/java/net/minecraftforge/client/model/ModelStateComposition.java b/src/main/java/net/minecraftforge/client/model/ModelTransformComposition.java similarity index 58% rename from src/main/java/net/minecraftforge/client/model/ModelStateComposition.java rename to src/main/java/net/minecraftforge/client/model/ModelTransformComposition.java index 112921fad..34bfe7bf2 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelStateComposition.java +++ b/src/main/java/net/minecraftforge/client/model/ModelTransformComposition.java @@ -20,40 +20,30 @@ package net.minecraftforge.client.model; import com.google.common.base.Objects; -import net.minecraft.client.renderer.texture.ISprite; -import net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; - -import java.util.Optional; +import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.client.renderer.model.IModelTransform; /** - * An {@link IModelState} that combines the transforms from two child {@link IModelState}. + * An {@link IModelTransform} that combines the transforms from two child {@link IModelTransform}. */ -public class ModelStateComposition implements IModelState, ISprite +public class ModelTransformComposition implements IModelTransform { - private final IModelState first; - private final IModelState second; + private final IModelTransform first; + private final IModelTransform second; private final boolean uvLock; - public ModelStateComposition(IModelState first, IModelState second) + public ModelTransformComposition(IModelTransform first, IModelTransform second) { this(first, second, false); } - public ModelStateComposition(IModelState first, IModelState second, boolean uvLock) + public ModelTransformComposition(IModelTransform first, IModelTransform second, boolean uvLock) { this.first = first; this.second = second; this.uvLock = uvLock; } - @Override - public IModelState getState() - { - return this; - } - @Override public boolean isUvLock() { @@ -61,17 +51,15 @@ public class ModelStateComposition implements IModelState, ISprite } @Override - public Optional apply(Optional part) + public TransformationMatrix func_225615_b_() { - Optional f = first.apply(part), s = second.apply(part); - if(f.isPresent() && s.isPresent()) - { - return Optional.of(f.get().compose(s.get())); - } - if (f.isPresent()) { - return f; - } - return s; + return first.func_225615_b_().compose(second.func_225615_b_()); + } + + @Override + public TransformationMatrix getPartTransformation(Object part) + { + return first.getPartTransformation(part).compose(second.getPartTransformation(part)); } @Override @@ -85,7 +73,7 @@ public class ModelStateComposition implements IModelState, ISprite { return false; } - ModelStateComposition that = (ModelStateComposition) o; + ModelTransformComposition that = (ModelTransformComposition) o; return Objects.equal(first, that.first) && Objects.equal(second, that.second); } diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index c8f7c359a..5553f73ab 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -27,19 +27,13 @@ import javax.annotation.Nullable; import javax.vecmath.Matrix4f; import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.ISprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.resources.IResourceManager; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.versions.forge.ForgeVersion; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; @@ -58,14 +52,15 @@ import com.google.gson.JsonParser; /** * A model that can be rendered in multiple {@link BlockRenderLayer}. */ +/* TODO: reimplement public final class MultiLayerModel implements IUnbakedModel { private static final Logger LOGGER = LogManager.getLogger(); public static final MultiLayerModel INSTANCE = new MultiLayerModel(ImmutableMap.of()); - private final ImmutableMap, ModelResourceLocation> models; + private final ImmutableMap, ResourceLocation> models; - public MultiLayerModel(ImmutableMap, ModelResourceLocation> models) + public MultiLayerModel(ImmutableMap, ResourceLocation> models) { this.models = models; } @@ -75,40 +70,40 @@ public final class MultiLayerModel implements IUnbakedModel { return ImmutableList.copyOf(models.values()); } - + @Override - public Collection getTextures(Function modelGetter, Set missingTextureErrors) + public Collection func_225614_a_(Function p_225614_1_, Set> p_225614_2_) { - return Collections.emptyList(); + return Collections.emptyList(); } - private static ImmutableMap, IBakedModel> buildModels(ImmutableMap, ModelResourceLocation> models, ISprite sprite, VertexFormat format, ModelBakery bakery, Function spriteGetter) + + private static ImmutableMap, IBakedModel> buildModels(ImmutableMap, ResourceLocation> models, IModelTransform sprite, ModelBakery bakery, Function spriteGetter, ResourceLocation p_225613_4_) { ImmutableMap.Builder, IBakedModel> builder = ImmutableMap.builder(); for(Optional key : models.keySet()) { - IUnbakedModel model = ModelLoaderRegistry.getModelOrLogError(models.get(key), "Couldn't load MultiLayerModel dependency: " + models.get(key)); - builder.put(key, model.bake(bakery, spriteGetter, new ModelStateComposition(sprite.getState(), model.getDefaultState(), sprite.isUvLock()), format)); + IUnbakedModel model = ModelLoader.defaultModelGetter().apply(models.get(key)); + builder.put(key, model.func_225613_a_(bakery, spriteGetter, sprite, p_225613_4_)); } return builder.build(); } @Nullable @Override - public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) + public IBakedModel func_225613_a_(ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation p_225613_4_) { - IUnbakedModel missing = ModelLoaderRegistry.getMissingModel(); + IUnbakedModel missing = ModelLoader.instance().getMissingModel(); return new MultiLayerBakedModel( - buildModels(models, sprite, format, bakery, spriteGetter), - missing.bake(bakery, spriteGetter, new BasicState(missing.getDefaultState(), sprite.isUvLock()), format), - PerspectiveMapWrapper.getTransforms(sprite.getState()) + buildModels(models, sprite, bakery, spriteGetter, p_225613_4_), + missing.func_225613_a_(bakery, spriteGetter, sprite, p_225613_4_), + PerspectiveMapWrapper.getTransforms(sprite) ); } - @Override public MultiLayerModel process(ImmutableMap customData) { - ImmutableMap.Builder, ModelResourceLocation> builder = ImmutableMap.builder(); + ImmutableMap.Builder, ResourceLocation> builder = ImmutableMap.builder(); for(String key : customData.keySet()) { if("base".equals(key)) @@ -123,12 +118,12 @@ public final class MultiLayerModel implements IUnbakedModel } } } - ImmutableMap, ModelResourceLocation> models = builder.build(); + ImmutableMap, ResourceLocation> models = builder.build(); if(models.isEmpty()) return INSTANCE; return new MultiLayerModel(models); } - private ModelResourceLocation getLocation(String json) + private ResourceLocation getLocation(String json) { JsonElement e = new JsonParser().parse(json); if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) @@ -142,11 +137,11 @@ public final class MultiLayerModel implements IUnbakedModel private static final class MultiLayerBakedModel implements IBakedModel { private final ImmutableMap, IBakedModel> models; - private final ImmutableMap cameraTransforms; + private final ImmutableMap cameraTransforms; private final IBakedModel base; private final IBakedModel missing; - public MultiLayerBakedModel(ImmutableMap, IBakedModel> models, IBakedModel missing, ImmutableMap cameraTransforms) + public MultiLayerBakedModel(ImmutableMap, IBakedModel> models, IBakedModel missing, ImmutableMap cameraTransforms) { this.models = models; this.cameraTransforms = cameraTransforms; @@ -201,6 +196,12 @@ public final class MultiLayerModel implements IUnbakedModel return base.getParticleTexture(); } + @Override + public boolean doesHandlePerspectives() + { + return true; + } + @Override public Pair handlePerspective(TransformType cameraTransformType) { @@ -213,27 +214,5 @@ public final class MultiLayerModel implements IUnbakedModel return ItemOverrideList.EMPTY; } } - - public static enum Loader implements ICustomModelLoader - { - INSTANCE; - - @Override - public void onResourceManagerReload(IResourceManager resourceManager) {} - - @Override - public boolean accepts(ResourceLocation modelLocation) - { - return modelLocation.getNamespace().equals(ForgeVersion.MOD_ID) && ( - modelLocation.getPath().equals("multi-layer") || - modelLocation.getPath().equals("models/block/multi-layer") || - modelLocation.getPath().equals("models/item/multi-layer")); - } - - @Override - public IUnbakedModel loadModel(ResourceLocation modelLocation) - { - return MultiLayerModel.INSTANCE; - } - } } +*/ \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java deleted file mode 100644 index 7babfb466..000000000 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ /dev/null @@ -1,287 +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.Collection; -import java.util.EnumMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Map.Entry; -import java.util.Set; - -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; - -import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.model.*; -import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.ISprite; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; - -import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.util.function.Function; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - -// TODO: Switch to vanilla class, or to something similar -@Deprecated -public final class MultiModel implements IUnbakedModel -{ - private static final Logger LOGGER = LogManager.getLogger(); - - private static final class Baked implements IBakedModel - { - private final ResourceLocation location; - @Nullable - private final IBakedModel base; - private final ImmutableMap parts; - - private final IBakedModel internalBase; - private final ImmutableMap> transforms; - private final ItemOverrideList overrides = new ItemOverrideList() - { - @Override - public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity) - { - if(originalModel != Baked.this) - { - return originalModel; - } - boolean dirty = false; - IBakedModel newBase = null; - - if(base != null) - { - newBase = base.getOverrides().getModelWithOverrides(base, stack, world, entity); - if(base != newBase) - { - dirty = true; - } - } - ImmutableMap.Builder builder = ImmutableMap.builder(); - for(Map.Entry entry : parts.entrySet()) - { - IBakedModel newPart = entry.getValue().getOverrides().getModelWithOverrides(entry.getValue(), stack, world, entity); - builder.put(entry.getKey(), newPart); - if(entry.getValue() != newPart) - { - dirty = true; - } - } - if(dirty) - { - // TODO: caching? - return new Baked(location, true, newBase, builder.build()); - } - return Baked.this; - } - }; - - public Baked(ResourceLocation location, boolean perspective, @Nullable IBakedModel base, ImmutableMap parts) - { - this.location = location; - this.base = base; - this.parts = parts; - - if (base != null) - internalBase = base; - else - { - Iterator iter = parts.values().iterator(); - if (iter.hasNext()) - internalBase = iter.next(); - else - throw new IllegalArgumentException("No base model or submodel provided for MultiModel.Baked " + location + "."); - } - - // Only changes the base model based on perspective, may recurse for parts in the future. - if(base != null && perspective) - { - EnumMap> map = new EnumMap<>(TransformType.class); - for(TransformType type : TransformType.values()) - { - Pair p = base.handlePerspective(type); - IBakedModel newBase = p.getLeft(); - Matrix4f matrix = p.getRight(); - if (newBase != base || matrix != null) - { - map.put(type, Pair.of(new Baked(location, false, newBase, parts), new TRSRTransformation(matrix))); - } - } - transforms = ImmutableMap.copyOf(map); - } - else - { - transforms = ImmutableMap.of(); - } - } - - @Override - public boolean isAmbientOcclusion() - { - return internalBase.isAmbientOcclusion(); - } - - @Override - public boolean isAmbientOcclusion(BlockState state) - { - return internalBase.isAmbientOcclusion(state); - } - - @Override - public boolean isGui3d() - { - return internalBase.isGui3d(); - } - - @Override - public boolean isBuiltInRenderer() - { - return internalBase.isBuiltInRenderer(); - } - - @Override - public TextureAtlasSprite getParticleTexture() - { - return internalBase.getParticleTexture(); - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() - { - return internalBase.getItemCameraTransforms(); - } - - @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) - { - ImmutableList.Builder quads = ImmutableList.builder(); - if (base != null) - { - quads.addAll(base.getQuads(state, side, rand)); - } - for (IBakedModel bakedPart : parts.values()) - { - quads.addAll(bakedPart.getQuads(state, side, rand)); - } - return quads.build(); - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) - { - Pair p = transforms.get(cameraTransformType); - if (p == null) return Pair.of(this, null); - return Pair.of(p.getLeft(), p.getRight().getMatrixVec()); - } - - @Override - public ItemOverrideList getOverrides() - { - return overrides; - } - } - - private final ResourceLocation location; - @Nullable - private final IUnbakedModel base; - private final Map> parts; - - public MultiModel(ResourceLocation location, @Nullable IUnbakedModel base, ImmutableMap> parts) - { - this.location = location; - this.base = base; - this.parts = parts; - } - - public MultiModel(ResourceLocation location, IUnbakedModel base, Map> parts) - { - this(location, base, ImmutableMap.copyOf(parts)); - } - - @Override - public Collection getDependencies() - { - Set deps = Sets.newHashSet(); - - if (base != null) - deps.addAll(base.getDependencies()); - - for (Pair pair : parts.values()) - deps.addAll(pair.getLeft().getDependencies()); - - return deps; - } - - @Override - public Collection getTextures(Function modelGetter, Set missingTextures) - { - Set deps = Sets.newHashSet(); - - if (base != null) - deps.addAll(base.getTextures(modelGetter, missingTextures)); - - for (Pair pair : parts.values()) - deps.addAll(pair.getLeft().getTextures(modelGetter, missingTextures)); - - return deps; - } - - @Nullable - @Override - public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) - { - IBakedModel bakedBase = null; - - if (base != null) - bakedBase = base.bake(bakery, spriteGetter, sprite, format); - - ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); - - for (Entry> entry : parts.entrySet()) - { - Pair pair = entry.getValue(); - mapBuilder.put(entry.getKey(), pair.getLeft().bake(bakery, spriteGetter, new ModelStateComposition(sprite.getState(), pair.getRight(), sprite.isUvLock()), format)); - } - - if(bakedBase == null && parts.isEmpty()) - { - LOGGER.error("MultiModel {} is empty (no base model or parts were provided/resolved)", location); - IUnbakedModel missing = ModelLoaderRegistry.getMissingModel(); - return missing.bake(bakery, spriteGetter, new BasicState(missing.getDefaultState(), sprite.isUvLock()), format); - } - return new Baked(location, true, bakedBase, mapBuilder.build()); - } -} diff --git a/src/main/java/net/minecraftforge/client/model/MultiModelState.java b/src/main/java/net/minecraftforge/client/model/MultiModelState.java deleted file mode 100644 index 145ab70a6..000000000 --- a/src/main/java/net/minecraftforge/client/model/MultiModelState.java +++ /dev/null @@ -1,156 +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 net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; - -import org.apache.commons.lang3.tuple.Pair; - -import com.google.common.base.Objects; -import java.util.Optional; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - -public final class MultiModelState implements IModelState -{ - private final ImmutableMap states; - - public MultiModelState(ImmutableList> states) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - for(int i = 0; i < states.size(); i++) - { - Pair pair = states.get(i); - builder.put(new MultiModelPart(pair.getLeft(), i), pair.getRight()); - } - this.states = builder.build(); - } - - public static IModelState getPartState(IModelState state, IModel model, int index) - { - if(state.apply(Optional.of(new MultiModelPart(model, index))).isPresent()) - { - return new PartState(state, model, index); - } - return state; - } - - @Override - public Optional apply(Optional part) - { - if(part.isPresent()) - { - if(part.get() instanceof MultiModelPart) - { - MultiModelPart key = (MultiModelPart)part.get(); - if(states.containsKey(key)) - { - return Optional.of(states.get(key).apply(Optional.empty()).orElse(TRSRTransformation.identity())); - } - } - else if(part.get() instanceof PartPart) - { - PartPart partPart = (PartPart)part.get(); - MultiModelPart key = new MultiModelPart(partPart.model, partPart.index); - if(states.containsKey(key)) - { - return states.get(key).apply(partPart.part); - } - } - } - return Optional.empty(); - } - - private static class PartState implements IModelState - { - private final IModelState state; - private final IModel model; - private final int index; - - public PartState(IModelState state, IModel model, int index) - { - this.state = state; - this.model = model; - this.index = index; - } - - @Override - public Optional apply(Optional part) - { - Optional normal = state.apply(part); - Optional multi = state.apply(Optional.of(new PartPart(model, index, part))); - if(normal.isPresent() && multi.isPresent()) - { - return Optional.of(normal.get().compose(multi.get())); - } - if (normal.isPresent()) { - return normal; - } - return multi; - } - } - - private static class MultiModelPart implements IModelPart - { - private final IModel model; - private final int index; - - public MultiModelPart(IModel model, int index) - { - this.model = model; - this.index = index; - } - - @Override - public int hashCode() - { - return Objects.hashCode(model, index); - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - MultiModelPart other = (MultiModelPart)obj; - return Objects.equal(this.model, other.model) && this.index == other.index; - } - } - - private static class PartPart implements IModelPart - { - private final IModel model; - private final int index; - private final Optional part; - - public PartPart(IModel model, int index, Optional part) - { - this.model = model; - this.index = index; - this.part = part; - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java b/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java index bfd99ea50..73ac49215 100644 --- a/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java +++ b/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java @@ -20,87 +20,110 @@ package net.minecraftforge.client.model; import java.util.EnumMap; -import java.util.Optional; import java.util.Random; +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.model.BakedQuad; -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.ItemCameraTransforms; -import net.minecraft.client.renderer.model.ItemOverrideList; +import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; -import org.apache.commons.lang3.tuple.Pair; +import net.minecraft.world.World; +import net.minecraftforge.common.model.TransformationHelper; import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; import java.util.List; public class PerspectiveMapWrapper implements IBakedModel { private final IBakedModel parent; - private final ImmutableMap transforms; + private final ImmutableMap transforms; + private final OverrideListWrapper overrides = new OverrideListWrapper(); - public PerspectiveMapWrapper(IBakedModel parent, ImmutableMap transforms) + public PerspectiveMapWrapper(IBakedModel parent, ImmutableMap transforms) { this.parent = parent; this.transforms = transforms; } - public PerspectiveMapWrapper(IBakedModel parent, IModelState state) + public PerspectiveMapWrapper(IBakedModel parent, IModelTransform state) { this(parent, getTransforms(state)); } - public static ImmutableMap getTransforms(IModelState state) + public static ImmutableMap getTransforms(IModelTransform state) { - EnumMap map = new EnumMap<>(ItemCameraTransforms.TransformType.class); + EnumMap map = new EnumMap<>(ItemCameraTransforms.TransformType.class); for(ItemCameraTransforms.TransformType type : ItemCameraTransforms.TransformType.values()) { - Optional tr = state.apply(Optional.of(type)); - if(tr.isPresent()) + TransformationMatrix tr = state.getPartTransformation(type); + if(!tr.isIdentity()) { - map.put(type, tr.get()); + map.put(type, tr); } } return ImmutableMap.copyOf(map); } @SuppressWarnings("deprecation") - public static ImmutableMap getTransforms(ItemCameraTransforms transforms) + public static ImmutableMap getTransforms(ItemCameraTransforms transforms) { - EnumMap map = new EnumMap<>(ItemCameraTransforms.TransformType.class); + EnumMap map = new EnumMap<>(ItemCameraTransforms.TransformType.class); for(ItemCameraTransforms.TransformType type : ItemCameraTransforms.TransformType.values()) { if (transforms.hasCustomTransform(type)) { - map.put(type, TRSRTransformation.blockCenterToCorner(TRSRTransformation.from(transforms.getTransform(type)))); + map.put(type, TransformationHelper.blockCenterToCorner(TransformationHelper.toTransformation(transforms.getTransform(type)))); } } return ImmutableMap.copyOf(map); } - public static Pair handlePerspective(IBakedModel model, ImmutableMap transforms, ItemCameraTransforms.TransformType cameraTransformType) + @SuppressWarnings("deprecation") + public static ImmutableMap getTransformsWithFallback(IModelTransform state, ItemCameraTransforms transforms) { - TRSRTransformation tr = transforms.getOrDefault(cameraTransformType, TRSRTransformation.identity()); - if (!tr.isIdentity()) + EnumMap map = new EnumMap<>(ItemCameraTransforms.TransformType.class); + for(ItemCameraTransforms.TransformType type : ItemCameraTransforms.TransformType.values()) { - return Pair.of(model, TRSRTransformation.blockCornerToCenter(tr).getMatrixVec()); + TransformationMatrix tr = state.getPartTransformation(type); + if(!tr.isIdentity()) + { + map.put(type, tr); + } + else if (transforms.hasCustomTransform(type)) + { + map.put(type, TransformationHelper.blockCenterToCorner(TransformationHelper.toTransformation(transforms.getTransform(type)))); + } } - return Pair.of(model, null); + return ImmutableMap.copyOf(map); } - public static Pair handlePerspective(IBakedModel model, IModelState state, ItemCameraTransforms.TransformType cameraTransformType) + public static IBakedModel handlePerspective(IBakedModel model, ImmutableMap transforms, ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat) { - TRSRTransformation tr = state.apply(Optional.of(cameraTransformType)).orElse(TRSRTransformation.identity()); + TransformationMatrix tr = transforms.getOrDefault(cameraTransformType, TransformationMatrix.func_227983_a_()); if (!tr.isIdentity()) { - return Pair.of(model, TRSRTransformation.blockCornerToCenter(tr).getMatrixVec()); + // Push to the matrix to make it not empty and indicate that we want to transform things + mat.func_227860_a_(); + mat.func_227866_c_().func_227870_a_().func_226595_a_(TransformationHelper.blockCornerToCenter(tr).func_227988_c_()); } - return Pair.of(model, null); + return model; + } + + public static IBakedModel handlePerspective(IBakedModel model, IModelTransform state, ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat) + { + TransformationMatrix tr = state.getPartTransformation(cameraTransformType); + if (!tr.isIdentity()) + { + // Push to the matrix to make it not empty and indicate that we want to transform things + mat.func_227860_a_(); + mat.func_227866_c_().func_227870_a_().func_226595_a_(TransformationHelper.blockCornerToCenter(tr).func_227988_c_()); + } + return model; } @Override public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); } @@ -111,11 +134,45 @@ public class PerspectiveMapWrapper implements IBakedModel @SuppressWarnings("deprecation") @Override public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); } @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) { return parent.getQuads(state, side, rand); } - @Override public ItemOverrideList getOverrides() { return parent.getOverrides(); } + @Override - public Pair handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) + public ItemOverrideList getOverrides() { - return handlePerspective(this, transforms, cameraTransformType); + return overrides; + } + + @Override + public boolean doesHandlePerspectives() + { + return true; + } + + @Override + public IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat) + { + return handlePerspective(this, transforms, cameraTransformType, mat); + } + + private class OverrideListWrapper extends ItemOverrideList + { + public OverrideListWrapper() + { + super(); + } + + @Nullable + @Override + public IBakedModel getModelWithOverrides(IBakedModel model, ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn) + { + model = parent.getOverrides().getModelWithOverrides(parent, stack, worldIn, entityIn); + return new PerspectiveMapWrapper(model, transforms); + } + + @Override + public ImmutableList getOverrides() + { + return parent.getOverrides().getOverrides(); + } } } diff --git a/src/main/java/net/minecraftforge/client/model/QuadTransformer.java b/src/main/java/net/minecraftforge/client/model/QuadTransformer.java new file mode 100644 index 000000000..5cf838fc4 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/QuadTransformer.java @@ -0,0 +1,200 @@ +/* + * 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.Lists; +import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.client.renderer.Vector4f; +import net.minecraft.client.renderer.model.BakedQuad; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; + +import javax.vecmath.Vector3f; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class QuadTransformer +{ + private final VertexFormat format; + private final int positionOffset; + private final int normalOffset; + private final TransformationMatrix transform; + + public QuadTransformer(VertexFormat format, TransformationMatrix transform) + { + this.format = format; + this.positionOffset = findPositionOffset(format); + this.normalOffset = findNormalOffset(format); + this.transform = transform; + } + + private void processVertices(int[] inData, int[] outData) + { + // TODO: Extract rotation matrix and fix NORMALs if present. + int stride = format.getSize() / 4; + for (int i=0;i<4;i++) + { + int offset = positionOffset + i * stride; + float x = Float.intBitsToFloat(inData[offset ]); + float y = Float.intBitsToFloat(inData[offset + 1]); + float z = Float.intBitsToFloat(inData[offset + 2]); + + Vector4f pos = new Vector4f(x, y, z, 1); + transform.transformPosition(pos); + pos.func_229374_e_(); + + outData[offset] = Float.floatToRawIntBits(pos.getX()); + outData[offset + 1] = Float.floatToRawIntBits(pos.getY()); + outData[offset + 2] = Float.floatToRawIntBits(pos.getZ()); + } + + if (normalOffset >= 0) + { + for (int i=0;i<4;i++) + { + int offset = normalOffset + i * stride; + int normalIn = inData[offset]; + float x = (((normalIn)>>24)&0xFF)/255.0f; + float y = (((normalIn<<8)>>24)&0xFF)/255.0f; + float z = (((normalIn<<16)>>24)&0xFF)/255.0f; + + Vector3f pos = new Vector3f(x, y, z); + transform.transformNormal(pos); + + int normalOut = + (((int)(x/255.0)&0xFF)<<24) | + (((int)(y/255.0)&0xFF)<<16) | + (((int)(z/255.0)&0xFF)<<8) | + (normalIn&0xFF); + + outData[offset] = normalOut; + } + } + } + + private static int findPositionOffset(VertexFormat fmt) + { + int index; + VertexFormatElement element = null; + for (index = 0; index < fmt.func_227894_c_().size(); index++) + { + VertexFormatElement el = fmt.func_227894_c_().get(index); + if (el.getUsage() == VertexFormatElement.Usage.POSITION) + { + element = el; + break; + } + } + if (index == fmt.func_227894_c_().size() || element == null) + throw new RuntimeException("Expected vertex format to have a POSITION attribute"); + if (element.getType() != VertexFormatElement.Type.FLOAT) + throw new RuntimeException("Expected POSITION attribute to have data type FLOAT"); + if (element.getSize() < 3) + throw new RuntimeException("Expected POSITION attribute to have at least 3 dimensions"); + return fmt.getOffset(index); + } + + private static int findNormalOffset(VertexFormat fmt) + { + int index; + VertexFormatElement element = null; + for (index = 0; index < fmt.func_227894_c_().size(); index++) + { + VertexFormatElement el = fmt.func_227894_c_().get(index); + if (el.getUsage() == VertexFormatElement.Usage.NORMAL) + { + element = el; + break; + } + } + if (index == fmt.func_227894_c_().size() || element == null) + return -1; + if (element.getType() != VertexFormatElement.Type.BYTE) + throw new RuntimeException("Expected NORMAL attribute to have data type BYTE"); + if (element.getSize() < 3) + throw new RuntimeException("Expected NORMAL attribute to have at least 3 dimensions"); + return fmt.getOffset(index); + } + + /** + * Processes a single quad, producing a new quad. + * @param input A single quad to transform. + * @return A new BakedQuad object with the new position. + */ + public BakedQuad processOne(BakedQuad input) + { + int[] inData = input.getVertexData(); + int[] outData = Arrays.copyOf(inData, inData.length); + processVertices(inData, outData); + + return new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.getSprite(), input.shouldApplyDiffuseLighting(), format); + } + + /** + * Processes a single quad, modifying the input quad. + * @param input A single quad to transform. + * @return The input BakedQuad object with the new position applied. + */ + public BakedQuad processOneInPlace(BakedQuad input) + { + int[] data = input.getVertexData(); + processVertices(data, data); + return input; + } + + /** + * Processes multiple quads, producing a new array of new quads. + * @param inputs The list of quads to transform + * @return A new array of new BakedQuad objects. + */ + public List processMany(List inputs) + { + if(inputs.size() == 0) + return Collections.emptyList(); + + List outputs = Lists.newArrayList(); + for(BakedQuad input : inputs) + { + int[] inData = input.getVertexData(); + int[] outData = Arrays.copyOf(inData, inData.length); + processVertices(inData, outData); + + outputs.add(new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.getSprite(), input.shouldApplyDiffuseLighting(), format)); + } + return outputs; + } + + /** + * Processes multiple quads in place, modifying the input quads. + * @param inputs The list of quads to transform + */ + public void processManyInPlace(List inputs) + { + if(inputs.size() == 0) + return; + + for(BakedQuad input : inputs) + { + int[] data = input.getVertexData(); + processVertices(data, data); + } + } +} diff --git a/src/main/java/net/minecraftforge/client/model/SimpleModelFontRenderer.java b/src/main/java/net/minecraftforge/client/model/SimpleModelFontRenderer.java index 3080172b0..6b8c42070 100644 --- a/src/main/java/net/minecraftforge/client/model/SimpleModelFontRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/SimpleModelFontRenderer.java @@ -19,17 +19,16 @@ package net.minecraftforge.client.model; -import javax.vecmath.Matrix4f; -import javax.vecmath.Vector3f; -import javax.vecmath.Vector4f; - +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.vertex.VertexFormatElement; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; -import net.minecraftforge.common.model.TRSRTransformation; import com.google.common.collect.ImmutableList; import net.minecraft.client.GameSettings; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -41,7 +40,7 @@ import net.minecraft.util.ResourceLocation; public abstract class SimpleModelFontRenderer extends FontRenderer { private float r, g, b, a; - private final TRSRTransformation transform; + private final TransformationMatrix transform; private ImmutableList.Builder builder = ImmutableList.builder(); private final VertexFormat format; private final Vector3f normal = new Vector3f(0, 0, 1); @@ -53,10 +52,10 @@ public abstract class SimpleModelFontRenderer extends FontRenderer { public SimpleModelFontRenderer(GameSettings settings, ResourceLocation font, TextureManager manager, boolean isUnicode, Matrix4f matrix, VertexFormat format) { super(manager, null); - this.transform = new TRSRTransformation(matrix); + this.transform = new TransformationMatrix(matrix); this.format = format; transform.transformNormal(normal); - orientation = Direction.getFacingFromVector(normal.x, normal.y, normal.z); + orientation = Direction.getFacingFromVector(normal.getX(), normal.getY(), normal.getZ()); } public void setSprite(TextureAtlasSprite sprite) @@ -73,14 +72,16 @@ public abstract class SimpleModelFontRenderer extends FontRenderer { private void addVertex(UnpackedBakedQuad.Builder quadBuilder, float x, float y, float u, float v) { - for(int e = 0; e < format.getElementCount(); e++) + ImmutableList elements = format.func_227894_c_(); + for(int e = 0; e < elements.size(); e++) { - switch(format.getElement(e).getUsage()) + VertexFormatElement element = elements.get(e); + switch(element.getUsage()) { case POSITION: vec.set(x, y, 0f, 1f); transform.transformPosition(vec); - quadBuilder.put(e, vec.x, vec.y, vec.z, vec.w); + quadBuilder.put(e, vec.getX(), vec.getY(), vec.getZ(), vec.getW()); break; case COLOR: quadBuilder.put(e, r, g, b, a); @@ -90,7 +91,7 @@ public abstract class SimpleModelFontRenderer extends FontRenderer { quadBuilder.put(e, 0, 0, 1, 1); break; case UV: - if(format.getElement(e).getIndex() == 0) + if(element.getIndex() == 0) { quadBuilder.put(e, sprite.getInterpolatedU(u * 16), sprite.getInterpolatedV(v * 16), 0, 1); break; diff --git a/src/main/java/net/minecraftforge/client/model/SimpleModelState.java b/src/main/java/net/minecraftforge/client/model/SimpleModelState.java index 036751506..381afccd2 100644 --- a/src/main/java/net/minecraftforge/client/model/SimpleModelState.java +++ b/src/main/java/net/minecraftforge/client/model/SimpleModelState.java @@ -19,50 +19,39 @@ package net.minecraftforge.client.model; -import net.minecraft.client.renderer.texture.ISprite; -import net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.client.renderer.model.IModelTransform; -import java.util.Optional; import com.google.common.collect.ImmutableMap; /** * Simple implementation of IModelState via a map and a default value. */ -public final class SimpleModelState implements IModelState, ISprite +public final class SimpleModelState implements IModelTransform { - private final ImmutableMap map; - private final Optional def; + private final ImmutableMap map; + private final TransformationMatrix def; - public SimpleModelState(ImmutableMap map) + public SimpleModelState(ImmutableMap map) { - this(map, Optional.empty()); + this(map, TransformationMatrix.func_227983_a_()); } - public SimpleModelState(ImmutableMap map, Optional def) + public SimpleModelState(ImmutableMap map, TransformationMatrix def) { this.map = map; this.def = def; } @Override - public IModelState getState() + public TransformationMatrix func_225615_b_() { - return this; + return def; } @Override - public Optional apply(Optional part) + public TransformationMatrix getPartTransformation(Object part) { - if(!part.isPresent()) - { - return def; - } - if(!map.containsKey(part.get())) - { - return Optional.empty(); - } - return Optional.ofNullable(map.get(part.get())); + return map.getOrDefault(part, TransformationMatrix.func_227983_a_()); } } diff --git a/src/main/java/net/minecraftforge/client/model/SimpleModelTransform.java b/src/main/java/net/minecraftforge/client/model/SimpleModelTransform.java new file mode 100644 index 000000000..a5c52d9dc --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/SimpleModelTransform.java @@ -0,0 +1,64 @@ +/* + * 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 net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.client.renderer.model.IModelTransform; + +import com.google.common.collect.ImmutableMap; + +/** + * Simple implementation of IModelState via a map and a default value. + */ +public final class SimpleModelTransform implements IModelTransform +{ + public static final SimpleModelTransform IDENTITY = new SimpleModelTransform(TransformationMatrix.func_227983_a_()); + + private final ImmutableMap map; + private final TransformationMatrix base; + + public SimpleModelTransform(ImmutableMap map) + { + this(map, TransformationMatrix.func_227983_a_()); + } + + public SimpleModelTransform(TransformationMatrix base) + { + this(ImmutableMap.of(), base); + } + + public SimpleModelTransform(ImmutableMap map, TransformationMatrix base) + { + this.map = map; + this.base = base; + } + + @Override + public TransformationMatrix func_225615_b_() + { + return base; + } + + @Override + public TransformationMatrix getPartTransformation(Object part) + { + return map.getOrDefault(part, TransformationMatrix.func_227983_a_()); + } +} 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 b8a2ba89f..0316ad1e2 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationItemOverrideList.java @@ -20,13 +20,12 @@ package net.minecraftforge.client.model.animation; import java.util.List; +import java.util.function.Function; + +import javax.annotation.Nullable; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.IUnbakedModel; -import net.minecraft.client.renderer.model.ItemOverride; -import net.minecraft.client.renderer.model.ItemOverrideList; -import net.minecraft.client.renderer.model.ModelBakery; +import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.entity.LivingEntity; @@ -34,36 +33,31 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.client.model.ModelStateComposition; -import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.client.model.ModelTransformComposition; import net.minecraftforge.common.model.animation.CapabilityAnimation; -import net.minecraftforge.common.model.animation.IAnimationStateMachine; - -import java.util.function.Function; - -import javax.annotation.Nullable; public final class AnimationItemOverrideList extends ItemOverrideList { private final ModelBakery bakery; private final IUnbakedModel model; - private final IModelState state; - private final VertexFormat format; - private final Function bakedTextureGetter; + private final ResourceLocation modelLoc; + private final IModelTransform state; - public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, IModelState state, VertexFormat format, Function bakedTextureGetter, ItemOverrideList overrides) + + private final Function bakedTextureGetter; + + public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function bakedTextureGetter, ItemOverrideList overrides) { - this(bakery, model, state, format, bakedTextureGetter, overrides.getOverrides().reverse()); + this(bakery, model, modelLoc, state, bakedTextureGetter, overrides.getOverrides().reverse()); } - public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, IModelState state, VertexFormat format, 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, format); + super(bakery, model, ModelLoader.defaultModelGetter(), bakedTextureGetter, overrides); this.bakery = bakery; this.model = model; + this.modelLoc = modelLoc; this.state = state; - this.format = format; this.bakedTextureGetter = bakedTextureGetter; } @@ -86,7 +80,7 @@ public final class AnimationItemOverrideList extends ItemOverrideList return asm.apply(Animation.getWorldTime(world, Animation.getPartialTickTime())).getLeft(); }) // TODO where should uvlock data come from? - .map(state -> model.bake(bakery, bakedTextureGetter, new ModelStateComposition(state, this.state), format)) + .map(state -> model.func_225613_a_(bakery, bakedTextureGetter, new ModelTransformComposition(state, this.state), modelLoc)) .orElseGet(() -> super.getModelWithOverrides(originalModel, stack, world, entity)); } } diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java index c35975880..1ee29e669 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java @@ -35,7 +35,6 @@ import net.minecraft.block.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.BasicState; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.pipeline.VertexLighterFlat; 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 22050f1ed..f97330b7d 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java @@ -33,10 +33,12 @@ import java.util.TreeMap; import javax.annotation.Nullable; import javax.vecmath.AxisAngle4f; -import javax.vecmath.Matrix4f; -import javax.vecmath.Quat4f; -import javax.vecmath.Vector3f; +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.IModelTransform; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -49,8 +51,7 @@ import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.I import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.Type; import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.Variable; import net.minecraftforge.common.animation.Event; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraftforge.common.model.TransformationHelper; import net.minecraftforge.common.model.animation.IClip; import net.minecraftforge.common.model.animation.IJoint; import net.minecraftforge.common.model.animation.IJointClip; @@ -327,7 +328,7 @@ public class ModelBlockAnimation } @Override - public TRSRTransformation apply(float time) + public TransformationMatrix apply(float time) { time -= Math.floor(time); Vector3f translation = new Vector3f(0, 0, 0); @@ -365,13 +366,13 @@ public class ModelBlockAnimation switch(var.variable) { case X: - translation.x = value; + translation.setX(value); break; case Y: - translation.y = value; + translation.setY(value); break; case Z: - translation.z = value; + translation.setZ(value); break; case XROT: rotation.x = value; @@ -386,35 +387,34 @@ public class ModelBlockAnimation rotation.angle = (float)Math.toRadians(value); break; case SCALE: - scale.x = scale.y = scale.z = value; + scale.set(value, value, value); break; case XS: - scale.x = value; + scale.setX(value); break; case YS: - scale.y = value; + scale.setY(value); break; case ZS: - scale.z = value; + scale.setX(value); break; case XORIGIN: - origin.x = value - 0.5F; + origin.setX(value - 0.5F); break; case YORIGIN: - origin.y = value - 0.5F; + origin.setY(value - 0.5F); break; case ZORIGIN: - origin.z = value - 0.5F; + origin.setX(value - 0.5F); break; } } - Quat4f rot = new Quat4f(); - rot.set(rotation); - TRSRTransformation base = new TRSRTransformation(translation, rot, scale, null); - Vector3f negOrigin = new Vector3f(origin); - negOrigin.negate(); - base = new TRSRTransformation(origin, null, null, null).compose(base).compose(new TRSRTransformation(negOrigin, null, null, null)); - return TRSRTransformation.blockCenterToCorner(base); + Quaternion rot = new Quaternion(new Vector3f(rotation.x, rotation.y, rotation.z), rotation.angle, false); + TransformationMatrix base = new TransformationMatrix(translation, rot, scale, null); + Vector3f negOrigin = origin.func_229195_e_(); + negOrigin.func_229192_b_(-1,-1,-1); + base = new TransformationMatrix(origin, null, null, null).compose(base).compose(new TransformationMatrix(negOrigin, null, null, null)); + return TransformationHelper.blockCenterToCorner(base); } } } @@ -429,9 +429,9 @@ public class ModelBlockAnimation } @Override - public TRSRTransformation getInvBindPose() + public TransformationMatrix getInvBindPose() { - return TRSRTransformation.identity(); + return TransformationMatrix.func_227983_a_(); } @Override @@ -518,7 +518,13 @@ public class ModelBlockAnimation } @Nullable - public TRSRTransformation getPartTransform(IModelState state, BlockPart part, int i) + public TransformationMatrix getPartTransform(IModelTransform state, BlockPart part, int i) + { + return getPartTransform(state, i); + } + + @Nullable + public TransformationMatrix getPartTransform(IModelTransform state, int i) { ImmutableCollection infos = getJoint(i); if(!infos.isEmpty()) @@ -530,12 +536,12 @@ public class ModelBlockAnimation if(info.getWeights().containsKey(i)) { ModelBlockAnimation.MBJoint joint = new ModelBlockAnimation.MBJoint(info.getName()); - Optional trOp = state.apply(Optional.of(joint)); - if(trOp.isPresent() && !trOp.get().isIdentity()) + TransformationMatrix trOp = state.getPartTransformation(joint); + if(!trOp.isIdentity()) { float w = info.getWeights().get(i)[0]; - tmp = trOp.get().getMatrixVec(); - tmp.mul(w); + tmp = trOp.func_227988_c_(); + tmp.func_226592_a_(w); m.add(tmp); weight += w; } @@ -543,8 +549,8 @@ public class ModelBlockAnimation } if(weight > 1e-5) { - m.mul(1f / weight); - return new TRSRTransformation(m); + m.func_226592_a_(1f / weight); + return new TransformationMatrix(m); } } return null; 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 81d548d75..beaa15fbc 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/TileEntityRendererAnimation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/TileEntityRendererAnimation.java @@ -21,14 +21,19 @@ package net.minecraftforge.client.model.animation; import java.util.Random; +import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Atlases; import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.model.IBakedModel; +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.IWorldReader; +import net.minecraft.world.ILightReader; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.model.ModelDataManager; import net.minecraftforge.client.model.data.IModelData; @@ -42,12 +47,17 @@ import net.minecraftforge.common.util.LazyOptional; /** * Generic {@link TileGameRenderer} that works with the Forge model system and animations. */ -public class TileEntityRendererAnimation extends TileEntityRendererFast implements IEventHandler +public class TileEntityRendererAnimation extends TileEntityRenderer implements IEventHandler { - protected static BlockRendererDispatcher blockRenderer; + public TileEntityRendererAnimation(TileEntityRendererDispatcher p_i226006_1_) + { + super(p_i226006_1_); + } + protected static BlockRendererDispatcher blockRenderer; + @Override - public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, BufferBuilder renderer) + public void func_225616_a_(T te, float partialTick, MatrixStack mat, IRenderTypeBuffer renderer, int light, int otherlight) { LazyOptional cap = te.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY); if(!cap.isPresent()) @@ -56,13 +66,13 @@ public class TileEntityRendererAnimation extends TileEntit } if(blockRenderer == null) blockRenderer = Minecraft.getInstance().getBlockRendererDispatcher(); BlockPos pos = te.getPos(); - net.minecraft.world.IEnviromentBlockReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos); + ILightReader 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)); if (data.hasProperty(Properties.AnimationProperty)) { - float time = Animation.getWorldTime(getWorld(), partialTick); + float time = Animation.getWorldTime(Minecraft.getInstance().world, partialTick); cap .map(asm -> asm.apply(time)) .ifPresent(pair -> { @@ -70,10 +80,7 @@ public class TileEntityRendererAnimation extends TileEntit // TODO: caching? data.setData(Properties.AnimationProperty, pair.getLeft()); - - renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ()); - - blockRenderer.getBlockModelRenderer().renderModel(world, model, state, pos, renderer, false, new Random(), 42, data); + blockRenderer.getBlockModelRenderer().renderModel(world, model, state, pos, mat, renderer.getBuffer(Atlases.func_228782_g_()), false, new Random(), 42, light, data); }); } } diff --git a/src/main/java/net/minecraftforge/client/model/animation/TileEntityRendererFast.java b/src/main/java/net/minecraftforge/client/model/animation/TileEntityRendererFast.java deleted file mode 100644 index c861ada24..000000000 --- a/src/main/java/net/minecraftforge/client/model/animation/TileEntityRendererFast.java +++ /dev/null @@ -1,95 +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.animation; - -import org.lwjgl.opengl.GL11; - -import com.mojang.blaze3d.platform.GlStateManager; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.tileentity.TileEntity; - -/** - * A special case {@link TileGameRenderer} which can be batched with other - * renderers that are also instances of this class. - *

- * Advantages: - *

    - *
  • All batched renderers are drawn with a single draw call
  • - *
  • Renderers have their vertices depth sorted for better translucency - * support
  • - *
- *

- * Disadvantages: - *

    - *
  • OpenGL operations are not permitted
  • - *
  • All renderers must use the same {@link VertexFormat} - * ({@link DefaultVertexFormats#BLOCK})
  • - *
- * - * @param The type of {@link TileEntity} being rendered. - */ -public abstract class TileEntityRendererFast extends TileEntityRenderer -{ - @Override - public final void render(T te, double x, double y, double z, float partialTicks, int destroyStage) - { - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder buffer = tessellator.getBuffer(); - this.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); - RenderHelper.disableStandardItemLighting(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.enableBlend(); - GlStateManager.disableCull(); - - if (Minecraft.isAmbientOcclusionEnabled()) - { - GlStateManager.shadeModel(GL11.GL_SMOOTH); - } - else - { - GlStateManager.shadeModel(GL11.GL_FLAT); - } - - buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - - renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer); - buffer.setTranslation(0, 0, 0); - - tessellator.draw(); - - RenderHelper.enableStandardItemLighting(); - } - - /** - * Draw this renderer to the passed {@link BufferBuilder}. DO - * NOT draw to any buffers other than the one passed, or use any OpenGL - * operations as they will not be applied when this renderer is batched. - */ - @Override - public abstract void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer); -} 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 27455baa4..90b3c5277 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java @@ -19,11 +19,12 @@ package net.minecraftforge.client.model.b3d; +import net.minecraft.client.renderer.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; import net.minecraftforge.common.animation.Event; -import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraftforge.common.model.TransformationHelper; import net.minecraftforge.common.model.animation.IClip; import net.minecraftforge.common.model.animation.IJoint; import net.minecraftforge.common.model.animation.IJointClip; @@ -62,25 +63,25 @@ public enum B3DClip implements IClip } @Override - public TRSRTransformation apply(float time) + public TransformationMatrix apply(float time) { - TRSRTransformation ret = TRSRTransformation.identity(); + TransformationMatrix ret = TransformationMatrix.func_227983_a_(); if(node.getAnimation() == null) { - return ret.compose(new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null)); + return ret.compose(B3DLoader.fromVecmath(node.getPos(), node.getRot(), node.getScale(), null)); } int start = Math.max(1, (int)Math.round(Math.floor(time))); int end = Math.min(start + 1, (int)Math.round(Math.ceil(time))); float progress = time - (float)Math.floor(time); Key keyStart = node.getAnimation().getKeys().get(start, node); Key keyEnd = node.getAnimation().getKeys().get(end, node); - TRSRTransformation startTr = keyStart == null ? null : new TRSRTransformation(keyStart.getPos(), keyStart.getRot(),keyStart.getScale(), null); - TRSRTransformation endTr = keyEnd == null ? null : new TRSRTransformation(keyEnd.getPos(), keyEnd.getRot(),keyEnd.getScale(), null); + TransformationMatrix startTr = keyStart == null ? null : B3DLoader.fromVecmath(keyStart.getPos(), keyStart.getRot(),keyStart.getScale(), null); + TransformationMatrix endTr = keyEnd == null ? null : B3DLoader.fromVecmath(keyEnd.getPos(), keyEnd.getRot(),keyEnd.getScale(), null); if(keyStart == null) { if(keyEnd == null) { - ret = ret.compose(new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null)); + ret = ret.compose(B3DLoader.fromVecmath(node.getPos(), node.getRot(), node.getScale(), null)); } // TODO animated TRSRTransformation for speed? else @@ -94,7 +95,7 @@ public enum B3DClip implements IClip } else { - ret = ret.compose(startTr.slerp(endTr, progress)); + ret = ret.compose(TransformationHelper.slerp(startTr, endTr, progress)); } return ret; } 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 fda550780..824b881c8 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -32,15 +32,25 @@ import java.util.Random; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; import javax.annotation.Nullable; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; +import com.mojang.blaze3d.matrix.MatrixStack; +import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.model.*; -import net.minecraft.client.renderer.texture.ISprite; +import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.renderer.texture.MissingTextureSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraftforge.client.model.*; +import net.minecraftforge.common.model.*; +import net.minecraftforge.resource.IResourceType; +import net.minecraftforge.resource.ISelectiveResourceReloadListener; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -49,7 +59,6 @@ import com.google.common.base.Objects; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; -import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -65,11 +74,6 @@ import net.minecraft.resources.IResourceManager; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; -import net.minecraftforge.client.model.ICustomModelLoader; -import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.client.model.ModelStateComposition; -import net.minecraftforge.client.model.PerspectiveMapWrapper; import net.minecraftforge.client.model.b3d.B3DModel.Animation; import net.minecraftforge.client.model.b3d.B3DModel.Face; import net.minecraftforge.client.model.b3d.B3DModel.Key; @@ -80,10 +84,6 @@ import net.minecraftforge.client.model.b3d.B3DModel.Vertex; import net.minecraftforge.client.model.data.IDynamicBakedModel; import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; -import net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.Models; -import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.common.model.animation.IClip; import net.minecraftforge.common.model.animation.IJoint; import net.minecraftforge.common.property.Properties; @@ -93,7 +93,8 @@ import net.minecraftforge.common.property.Properties; * To enable for your mod call instance.addDomain(modId). * If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry. */ -public enum B3DLoader implements ICustomModelLoader +// TODO: Implement as a new model loader +public enum B3DLoader implements ISelectiveResourceReloadListener { INSTANCE; @@ -104,25 +105,13 @@ public enum B3DLoader implements ICustomModelLoader private final Set enabledDomains = new HashSet<>(); private final Map cache = new HashMap<>(); - public void addDomain(String domain) - { - enabledDomains.add(domain.toLowerCase()); - } - @Override - public void onResourceManagerReload(IResourceManager manager) + public void onResourceManagerReload(IResourceManager manager, Predicate resourcePredicate) { this.manager = manager; cache.clear(); } - @Override - public boolean accepts(ResourceLocation modelLocation) - { - return enabledDomains.contains(modelLocation.getNamespace()) && modelLocation.getPath().endsWith(".b3d"); - } - - @Override @SuppressWarnings("unchecked") public IUnbakedModel loadModel(ResourceLocation modelLocation) throws Exception { @@ -159,7 +148,7 @@ public enum B3DLoader implements ICustomModelLoader } } B3DModel model = cache.get(file); - if(model == null) throw new ModelLoaderRegistry.LoaderException("Error loading model previously: " + file); + if(model == null) throw new ModelLoadingException("Error loading model previously: " + file); if(!(model.getRoot().getKind() instanceof Mesh)) { return new ModelWrapper(modelLocation, model, ImmutableSet.of(), true, true, 1); @@ -167,7 +156,13 @@ public enum B3DLoader implements ICustomModelLoader return new ModelWrapper(modelLocation, model, ImmutableSet.of(model.getRoot().getName()), true, true, 1); } - public static final class B3DState implements IModelState + @Deprecated // TODO: Does a lot of unnecessary work converting things, should use the TransformationMatrix constructor directly with mojang vector classes instead. + public static TransformationMatrix fromVecmath(javax.vecmath.Vector3f pos, javax.vecmath.Quat4f rot, javax.vecmath.Vector3f scale, javax.vecmath.Quat4f rot2) + { + return new TransformationMatrix(TransformationHelper.toMojang(pos), TransformationHelper.toMojang(rot), TransformationHelper.toMojang(scale), TransformationHelper.toMojang(rot2)); + } + + public static final class B3DState implements IModelTransform { @Nullable private final Animation animation; @@ -175,14 +170,14 @@ public enum B3DLoader implements ICustomModelLoader private final int nextFrame; private final float progress; @Nullable - private final IModelState parent; + private final IModelTransform parent; public B3DState(@Nullable Animation animation, int frame) { this(animation, frame, frame, 0); } - public B3DState(@Nullable Animation animation, int frame, IModelState parent) + public B3DState(@Nullable Animation animation, int frame, IModelTransform parent) { this(animation, frame, frame, 0, parent); } @@ -192,7 +187,7 @@ public enum B3DLoader implements ICustomModelLoader this(animation, frame, nextFrame, progress, null); } - public B3DState(@Nullable Animation animation, int frame, int nextFrame, float progress, @Nullable IModelState parent) + public B3DState(@Nullable Animation animation, int frame, int nextFrame, float progress, @Nullable IModelTransform parent) { this.animation = animation; this.frame = frame; @@ -202,7 +197,7 @@ public enum B3DLoader implements ICustomModelLoader } @Nullable - private IModelState getParent(@Nullable IModelState parent) + private IModelTransform getParent(@Nullable IModelTransform parent) { if (parent == null) return null; else if (parent instanceof B3DState) return ((B3DState)parent).parent; @@ -231,29 +226,33 @@ public enum B3DLoader implements ICustomModelLoader } @Nullable - public IModelState getParent() + public IModelTransform getParent() { return parent; } + @Override - public Optional apply(Optional part) + public TransformationMatrix func_225615_b_() + { + if(parent != null) + { + return parent.func_225615_b_(); + } + return TransformationMatrix.func_227983_a_(); + } + + @Override + public TransformationMatrix getPartTransformation(Object part) { // TODO make more use of Optional - if(!part.isPresent()) + + if(!(part instanceof NodeJoint)) { - if(parent != null) - { - return parent.apply(part); - } - return Optional.empty(); + return TransformationMatrix.func_227983_a_(); } - if(!(part.get() instanceof NodeJoint)) - { - return Optional.empty(); - } - Node node = ((NodeJoint)part.get()).getNode(); - TRSRTransformation nodeTransform; + Node node = ((NodeJoint)part).getNode(); + TransformationMatrix nodeTransform; if(progress < 1e-5 || frame == nextFrame) { nodeTransform = getNodeMatrix(node, frame); @@ -265,40 +264,40 @@ public enum B3DLoader implements ICustomModelLoader else { nodeTransform = getNodeMatrix(node, frame); - nodeTransform = nodeTransform.slerp(getNodeMatrix(node, nextFrame), progress); + nodeTransform = TransformationHelper.slerp(nodeTransform,getNodeMatrix(node, nextFrame), progress); } if(parent != null && node.getParent() == null) { - return Optional.of(parent.apply(part).orElse(TRSRTransformation.identity()).compose(nodeTransform)); + return parent.getPartTransformation(part).compose(nodeTransform); } - return Optional.of(nodeTransform); + return nodeTransform; } - private static LoadingCache, Integer>, TRSRTransformation> cache = CacheBuilder.newBuilder() + private static LoadingCache, Integer>, TransformationMatrix> cache = CacheBuilder.newBuilder() .maximumSize(16384) .expireAfterAccess(2, TimeUnit.MINUTES) - .build(new CacheLoader, Integer>, TRSRTransformation>() + .build(new CacheLoader, Integer>, TransformationMatrix>() { @Override - public TRSRTransformation load(Triple, Integer> key) throws Exception + public TransformationMatrix load(Triple, Integer> key) throws Exception { return getNodeMatrix(key.getLeft(), key.getMiddle(), key.getRight()); } }); - public TRSRTransformation getNodeMatrix(Node node) + public TransformationMatrix getNodeMatrix(Node node) { return getNodeMatrix(node, frame); } - public TRSRTransformation getNodeMatrix(Node node, int frame) + public TransformationMatrix getNodeMatrix(Node node, int frame) { return cache.getUnchecked(Triple.of(animation, node, frame)); } - public static TRSRTransformation getNodeMatrix(@Nullable Animation animation, Node node, int frame) + public static TransformationMatrix getNodeMatrix(@Nullable Animation animation, Node node, int frame) { - TRSRTransformation ret = TRSRTransformation.identity(); + TransformationMatrix ret = TransformationMatrix.func_227983_a_(); Key key = null; if(animation != null) key = animation.getKeys().get(frame, node); else if(node.getAnimation() != null) key = node.getAnimation().getKeys().get(frame, node); @@ -308,13 +307,13 @@ public enum B3DLoader implements ICustomModelLoader if(parent != null) { // parent model-global current pose - TRSRTransformation pm = cache.getUnchecked(Triple.of(animation, node.getParent(), frame)); + TransformationMatrix pm = cache.getUnchecked(Triple.of(animation, node.getParent(), frame)); ret = ret.compose(pm); // joint offset in the parent coords - ret = ret.compose(new TRSRTransformation(parent.getPos(), parent.getRot(), parent.getScale(), null)); + ret = ret.compose(fromVecmath(parent.getPos(), parent.getRot(), parent.getScale(), null)); } // current node local pose - ret = ret.compose(new TRSRTransformation(key.getPos(), key.getRot(), key.getScale(), null)); + ret = ret.compose(fromVecmath(key.getPos(), key.getRot(), key.getScale(), null)); // this part moved inside the model // inverse bind of the current node /*Matrix4f rm = new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null).getMatrix(); @@ -328,7 +327,7 @@ public enum B3DLoader implements ICustomModelLoader ret = ret.compose(new TRSRTransformation(rm)); }*/ // TODO cache - TRSRTransformation invBind = new NodeJoint(node).getInvBindPose(); + TransformationMatrix invBind = new NodeJoint(node).getInvBindPose(); ret = ret.compose(invBind); } else @@ -337,14 +336,14 @@ public enum B3DLoader implements ICustomModelLoader if(parent != null) { // parent model-global current pose - TRSRTransformation pm = cache.getUnchecked(Triple.of(animation, node.getParent(), frame)); + TransformationMatrix pm = cache.getUnchecked(Triple.of(animation, node.getParent(), frame)); ret = ret.compose(pm); // joint offset in the parent coords - ret = ret.compose(new TRSRTransformation(parent.getPos(), parent.getRot(), parent.getScale(), null)); + ret = ret.compose(fromVecmath(parent.getPos(), parent.getRot(), parent.getScale(), null)); } - ret = ret.compose(new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null)); + ret = ret.compose(fromVecmath(node.getPos(), node.getRot(), node.getScale(), null)); // TODO cache - TRSRTransformation invBind = new NodeJoint(node).getInvBindPose(); + TransformationMatrix invBind = new NodeJoint(node).getInvBindPose(); ret = ret.compose(invBind); } return ret; @@ -361,15 +360,15 @@ public enum B3DLoader implements ICustomModelLoader } @Override - public TRSRTransformation getInvBindPose() + public TransformationMatrix getInvBindPose() { - Matrix4f m = new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null).getMatrixVec(); + Matrix4f m = TransformationHelper.toVecmath(fromVecmath(node.getPos(), node.getRot(), node.getScale(), null).func_227988_c_()); m.invert(); - TRSRTransformation pose = new TRSRTransformation(m); + TransformationMatrix pose = new TransformationMatrix(TransformationHelper.toMojang(m)); if(node.getParent() != null) { - TRSRTransformation parent = new NodeJoint(node.getParent()).getInvBindPose(); + TransformationMatrix parent = new NodeJoint(node.getParent()).getInvBindPose(); pose = pose.compose(parent); } return pose; @@ -410,7 +409,7 @@ public enum B3DLoader implements ICustomModelLoader private final ResourceLocation modelLocation; private final B3DModel model; private final ImmutableSet meshes; - private final ImmutableMap textures; + private final ImmutableMap textures; private final boolean smooth; private final boolean gui3d; private final int defaultKey; @@ -420,7 +419,7 @@ public enum B3DLoader implements ICustomModelLoader this(modelLocation, model, meshes, smooth, gui3d, defaultKey, buildTextures(model.getTextures())); } - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, boolean smooth, boolean gui3d, int defaultKey, ImmutableMap textures) + public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, boolean smooth, boolean gui3d, int defaultKey, ImmutableMap textures) { this.modelLocation = modelLocation; this.model = model; @@ -431,16 +430,16 @@ public enum B3DLoader implements ICustomModelLoader this.defaultKey = defaultKey; } - private static ImmutableMap buildTextures(List textures) + private static ImmutableMap buildTextures(List textures) { - ImmutableMap.Builder builder = ImmutableMap.builder(); + ImmutableMap.Builder builder = ImmutableMap.builder(); for(Texture t : textures) { String path = t.getPath(); String location = getLocation(path); if(!location.startsWith("#")) location = "#" + location; - builder.put(path, new ResourceLocation(location)); + builder.put(path, location); } return builder.build(); } @@ -452,9 +451,11 @@ public enum B3DLoader implements ICustomModelLoader } @Override - public Collection getTextures(Function modelGetter, Set missingTextureErrors) + public Collection func_225614_a_(Function p_225614_1_, Set> p_225614_2_) { - return Collections2.filter(textures.values(), loc -> !loc.getPath().startsWith("#")); + return textures.values().stream().filter(loc -> !loc.startsWith("#")) + .map(t -> new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(t))) + .collect(Collectors.toList()); } @Override @@ -465,39 +466,41 @@ public enum B3DLoader implements ICustomModelLoader @Nullable @Override - public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) + public IBakedModel func_225613_a_(ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) { ImmutableMap.Builder builder = ImmutableMap.builder(); - TextureAtlasSprite missing = spriteGetter.apply(new ResourceLocation("missingno")); - for(Map.Entry e : textures.entrySet()) + TextureAtlasSprite missing = spriteGetter.apply(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, MissingTextureSprite.getLocation())); + for(Map.Entry e : textures.entrySet()) { - if(e.getValue().getPath().startsWith("#")) + if(e.getValue().startsWith("#")) { - LOGGER.fatal("unresolved texture '{}' for b3d model '{}'", e.getValue().getPath(), modelLocation); + LOGGER.fatal("unresolved texture '{}' for b3d model '{}'", e.getValue(), this.modelLocation); builder.put(e.getKey(), missing); } else { - builder.put(e.getKey(), spriteGetter.apply(e.getValue())); + builder.put(e.getKey(), spriteGetter.apply(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(e.getValue())))); } } builder.put("missingno", missing); - return new BakedWrapper(model.getRoot(), sprite.getState(), smooth, gui3d, format, meshes, builder.build()); + return new BakedWrapper(model.getRoot(), sprite, smooth, gui3d, DefaultVertexFormats.BLOCK, meshes, builder.build()); } - @Override public ModelWrapper retexture(ImmutableMap textures) { - ImmutableMap.Builder builder = ImmutableMap.builder(); - for(Map.Entry e : this.textures.entrySet()) + ImmutableMap.Builder builder = ImmutableMap.builder(); + for(Map.Entry e : this.textures.entrySet()) { String path = e.getKey(); String loc = getLocation(path); - if(textures.containsKey(loc)) + // FIXME: Backward compatibilty: support finding textures that start with #, even though this is not how vanilla works + if(loc.startsWith("#") && (textures.containsKey(loc) || textures.containsKey(loc.substring(1)))) { + String alt = loc.substring(1); String newLoc = textures.get(loc); - if(newLoc == null) newLoc = getLocation(path); - builder.put(e.getKey(), new ResourceLocation(newLoc)); + if(newLoc == null) newLoc = textures.get(alt); + if(newLoc == null) newLoc = path.substring(1); + builder.put(e.getKey(), newLoc); } else { @@ -507,7 +510,6 @@ public enum B3DLoader implements ICustomModelLoader return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, defaultKey, builder.build()); } - @Override public ModelWrapper process(ImmutableMap data) { ImmutableSet newMeshes = this.meshes; @@ -571,13 +573,11 @@ public enum B3DLoader implements ICustomModelLoader return Optional.empty(); } - @Override - public IModelState getDefaultState() + public IModelTransform getDefaultState() { return new B3DState(model.getRoot().getAnimation(), defaultKey, defaultKey, 0); } - @Override public ModelWrapper smoothLighting(boolean value) { if(value == smooth) @@ -587,7 +587,6 @@ public enum B3DLoader implements ICustomModelLoader return new ModelWrapper(modelLocation, model, meshes, value, gui3d, defaultKey, textures); } - @Override public ModelWrapper gui3d(boolean value) { if(value == gui3d) @@ -601,7 +600,7 @@ public enum B3DLoader implements ICustomModelLoader private static final class BakedWrapper implements IDynamicBakedModel { private final Node node; - private final IModelState state; + private final IModelTransform state; private final boolean smooth; private final boolean gui3d; private final VertexFormat format; @@ -611,7 +610,7 @@ public enum B3DLoader implements ICustomModelLoader private ImmutableList quads; - public BakedWrapper(final Node node, final IModelState state, final boolean smooth, final boolean gui3d, final VertexFormat format, final ImmutableSet meshes, final ImmutableMap textures) + public BakedWrapper(final Node node, final IModelTransform state, final boolean smooth, final boolean gui3d, final VertexFormat format, final ImmutableSet meshes, final ImmutableMap textures) { this(node, state, smooth, gui3d, format, meshes, textures, CacheBuilder.newBuilder() .maximumSize(128) @@ -621,7 +620,7 @@ public enum B3DLoader implements ICustomModelLoader @Override public B3DState load(Integer frame) throws Exception { - IModelState parent = state; + IModelTransform parent = state; Animation newAnimation = node.getAnimation(); if(parent instanceof B3DState) { @@ -633,7 +632,7 @@ public enum B3DLoader implements ICustomModelLoader })); } - public BakedWrapper(Node node, IModelState state, boolean smooth, boolean gui3d, VertexFormat format, ImmutableSet meshes, ImmutableMap textures, LoadingCache cache) + public BakedWrapper(Node node, IModelTransform state, boolean smooth, boolean gui3d, VertexFormat format, ImmutableSet meshes, ImmutableMap textures, LoadingCache cache) { this.node = node; this.state = state; @@ -649,12 +648,12 @@ public enum B3DLoader implements ICustomModelLoader public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData data) { if(side != null) return ImmutableList.of(); - IModelState modelState = this.state; - IModelState newState = data.getData(Properties.AnimationProperty); + IModelTransform modelState = this.state; + IModelTransform newState = data.getData(Properties.AnimationProperty); if(newState != null) { // FIXME: should animation state handle the parent state, or should it remain here? - IModelState parent = this.state; + IModelTransform parent = this.state; if(parent instanceof B3DState) { B3DState ps = (B3DState)parent; @@ -666,7 +665,7 @@ public enum B3DLoader implements ICustomModelLoader } else { - modelState = new ModelStateComposition(parent, newState); + modelState = new ModelTransformComposition(parent, newState); } } if(quads == null) @@ -685,7 +684,7 @@ public enum B3DLoader implements ICustomModelLoader return quads; } - private void generateQuads(ImmutableList.Builder builder, Node node, final IModelState state, ImmutableList path) + private void generateQuads(ImmutableList.Builder builder, Node node, final IModelTransform state, ImmutableList path) { ImmutableList.Builder pathBuilder = ImmutableList.builder(); pathBuilder.addAll(path); @@ -695,27 +694,27 @@ public enum B3DLoader implements ICustomModelLoader { generateQuads(builder, child, state, newPath); } - if(node.getKind() instanceof Mesh && meshes.contains(node.getName()) && !state.apply(Optional.of(Models.getHiddenModelPart(newPath))).isPresent()) + if(node.getKind() instanceof Mesh && meshes.contains(node.getName()) && state.getPartTransformation(Models.getHiddenModelPart(newPath)).isIdentity()) { Mesh mesh = (Mesh)node.getKind(); Collection faces = mesh.bake(new Function, Matrix4f>() { - private final TRSRTransformation global = state.apply(Optional.empty()).orElse(TRSRTransformation.identity()); - private final LoadingCache, TRSRTransformation> localCache = CacheBuilder.newBuilder() + private final TransformationMatrix global = state.func_225615_b_(); + private final LoadingCache, TransformationMatrix> localCache = CacheBuilder.newBuilder() .maximumSize(32) - .build(new CacheLoader, TRSRTransformation>() + .build(new CacheLoader, TransformationMatrix>() { @Override - public TRSRTransformation load(Node node) throws Exception + public TransformationMatrix load(Node node) throws Exception { - return state.apply(Optional.of(new NodeJoint(node))).orElse(TRSRTransformation.identity()); + return state.getPartTransformation(new NodeJoint(node)); } }); @Override public Matrix4f apply(Node node) { - return global.compose(localCache.getUnchecked(node)).getMatrixVec(); + return TransformationHelper.toVecmath(global.compose(localCache.getUnchecked(node)).func_227988_c_()); } }); for(Face f : faces) @@ -727,7 +726,7 @@ public enum B3DLoader implements ICustomModelLoader if(f.getBrush() != null) textures = f.getBrush().getTextures(); TextureAtlasSprite sprite; if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno"); - else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.INSTANCE; + else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance(); else sprite = this.textures.get(textures.get(0).getPath()); quadBuilder.setTexture(sprite); putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite); @@ -742,9 +741,10 @@ public enum B3DLoader implements ICustomModelLoader private final void putVertexData(UnpackedBakedQuad.Builder builder, Vertex v, Vector3f faceNormal, TextureAtlasSprite sprite) { // TODO handle everything not handled (texture transformations, bones, transformations, normals, e.t.c) - for(int e = 0; e < format.getElementCount(); e++) + ImmutableList vertexFormatElements = format.func_227894_c_(); + for(int e = 0; e < vertexFormatElements.size(); e++) { - switch(format.getElement(e).getUsage()) + switch(vertexFormatElements.get(e).getUsage()) { case POSITION: builder.put(e, v.getPos().x, v.getPos().y, v.getPos().z, 1); @@ -761,7 +761,7 @@ public enum B3DLoader implements ICustomModelLoader break; case UV: // TODO handle more brushes - if(format.getElement(e).getIndex() < v.getTexCoords().length) + if(vertexFormatElements.get(e).getIndex() < v.getTexCoords().length) { builder.put(e, sprite.getInterpolatedU(v.getTexCoords()[0].x * 16), @@ -817,9 +817,15 @@ public enum B3DLoader implements ICustomModelLoader } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public boolean doesHandlePerspectives() { - return PerspectiveMapWrapper.handlePerspective(this, state, cameraTransformType); + return true; + } + + @Override + public IBakedModel handlePerspective(TransformType cameraTransformType, MatrixStack mat) + { + return PerspectiveMapWrapper.handlePerspective(this, state, cameraTransformType, mat); } @Override 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 371a67713..56aded75a 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java @@ -43,8 +43,9 @@ import javax.vecmath.Vector2f; import javax.vecmath.Vector3f; import javax.vecmath.Vector4f; +import net.minecraft.client.renderer.TransformationMatrix; import net.minecraftforge.versions.forge.ForgeVersion; -import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraftforge.common.model.TransformationHelper; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; @@ -681,12 +682,12 @@ public class B3DModel else t.setIdentity(); } - TRSRTransformation trsr = new TRSRTransformation(t); + TransformationMatrix trsr = new TransformationMatrix(TransformationHelper.toMojang(t)); // pos Vector4f pos = new Vector4f(this.pos); pos.w = 1; - trsr.transformPosition(pos); + trsr.transformPosition(TransformationHelper.toMojang(pos)); Vector3f rPos = new Vector3f(pos.x / pos.w, pos.y / pos.w, pos.z / pos.w); // normal diff --git a/src/main/java/net/minecraftforge/client/model/composite/CompositeModel.java b/src/main/java/net/minecraftforge/client/model/composite/CompositeModel.java new file mode 100644 index 000000000..9db53878d --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/composite/CompositeModel.java @@ -0,0 +1,267 @@ +/* + * 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.composite; + +import com.google.common.collect.ImmutableMap; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.mojang.datafixers.util.Pair; +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.model.*; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.resources.IResourceManager; +import net.minecraft.util.Direction; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.*; +import net.minecraftforge.client.model.data.EmptyModelData; +import net.minecraftforge.client.model.data.IModelData; +import net.minecraftforge.client.model.data.ModelProperty; +import net.minecraftforge.client.model.geometry.IModelGeometryPart; +import net.minecraftforge.client.model.geometry.IMultipartModelGeometry; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.*; +import java.util.function.Function; + +public class CompositeModel implements IBakedModel +{ + public static final ModelProperty SUBMODEL_DATA = new ModelProperty<>(); + + private final ImmutableMap bakedParts; + private final boolean isAmbientOcclusion; + private final boolean isGui3d; + private final TextureAtlasSprite particle; + private final ItemOverrideList overrides; + + public CompositeModel(boolean isGui3d, boolean isAmbientOcclusion, TextureAtlasSprite particle, ImmutableMap bakedParts, ItemOverrideList overrides) + { + this.bakedParts = bakedParts; + this.isAmbientOcclusion = isAmbientOcclusion; + this.isGui3d = isGui3d; + this.particle = particle; + this.overrides = overrides; + } + + @Nonnull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) + { + List quads = new ArrayList<>(); + for(Map.Entry entry : bakedParts.entrySet()) + { + // TODO: Some way to provide submodel data? + quads.addAll(entry.getValue().getQuads(state, side, rand, getSubmodelData(extraData, entry.getKey()))); + } + return quads; + } + + @Deprecated + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) + { + List quads = new ArrayList<>(); + for(IBakedModel part : bakedParts.values()) + { + quads.addAll(part.getQuads(state, side, rand, EmptyModelData.INSTANCE)); + } + return null; + } + + @Override + public boolean isAmbientOcclusion() + { + return isAmbientOcclusion; + } + + @Override + public boolean isGui3d() + { + return isGui3d; + } + + @Override + public boolean isBuiltInRenderer() + { + return false; + } + + @Override + public TextureAtlasSprite getParticleTexture() + { + return particle; + } + + @Override + public ItemOverrideList getOverrides() + { + return overrides; + } + + @Nullable + public IBakedModel getPart(String name) + { + return bakedParts.get(name); + } + + private IModelData getSubmodelData(IModelData extraData, String name) + { + SubmodelModelData data = extraData.getData(SUBMODEL_DATA); + if (data == null) + return EmptyModelData.INSTANCE; + return data.getSubmodelData(name); + } + + public static class SubmodelModelData + { + private final Map parts = new HashMap<>(); + + public IModelData getSubmodelData(String name) + { + return parts.getOrDefault(name, EmptyModelData.INSTANCE); + } + + public void putSubmodelData(String name, IModelData data) + { + parts.put(name, data); + } + } + + private static class Submodel implements IModelGeometryPart + { + private final String name; + private final BlockModel model; + private final IModelTransform sprite; + + private Submodel(String name, BlockModel model, IModelTransform sprite) + { + this.name = name; + this.model = model; + this.sprite = sprite; + } + + @Override + public String name() + { + return name; + } + + @Override + public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) + { + throw new UnsupportedOperationException("Attempted to call adQuads on a Submodel instance. Please don't."); + } + + public IBakedModel func_225613_a_(ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) + { + return model.func_225613_a_(bakery, spriteGetter, new ModelTransformComposition(this.sprite, sprite, + this.sprite.isUvLock() || sprite.isUvLock()), modelLocation); + } + + @Override + public Collection getTextureDependencies(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + { + return model.func_225614_a_(modelGetter, missingTextureErrors); + } + } + + public static class Geometry implements IMultipartModelGeometry + { + private final ImmutableMap parts; + + Geometry(ImmutableMap parts) + { + this.parts = parts; + } + + @Override + public Collection getParts() + { + return parts.values(); + } + + @Override + public Optional getPart(String name) + { + return Optional.ofNullable(parts.get(name)); + } + + @Override + public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation) + { + Material particleLocation = owner.resolveTexture("particle"); + TextureAtlasSprite particle = spriteGetter.apply(particleLocation); + + ImmutableMap.Builder bakedParts = ImmutableMap.builder(); + for(Map.Entry part : parts.entrySet()) + { + Submodel submodel = part.getValue(); + if (!owner.getPartVisibility(submodel)) + continue; + bakedParts.put(part.getKey(), submodel.func_225613_a_(bakery, spriteGetter, sprite, modelLocation)); + } + return new CompositeModel(owner.isShadedInGui(), owner.useSmoothLighting(), particle, bakedParts.build(), overrides); + } + + @Override + public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + { + Set textures = new HashSet<>(); + for(Submodel part : parts.values()) + { + part.getTextureDependencies(owner, modelGetter, missingTextureErrors); + } + return textures; + } + } + + public static class Loader implements IModelLoader + { + public static final Loader INSTANCE = new Loader(); + + private Loader() {} + + @Override + public void onResourceManagerReload(IResourceManager resourceManager) + { + + } + + @Override + public Geometry read(JsonDeserializationContext deserializationContext, JsonObject modelContents) + { + if (!modelContents.has("parts")) + throw new RuntimeException("Composite model requires a \"parts\" element."); + ImmutableMap.Builder parts = ImmutableMap.builder(); + for(Map.Entry part : modelContents.get("parts").getAsJsonObject().entrySet()) + { + // TODO: Allow customizing state? If so, how? + IModelTransform sprite = SimpleModelTransform.IDENTITY; + parts.put(part.getKey(), new Submodel( + part.getKey(), + ModelLoaderRegistry.ExpandedBlockModelDeserializer.INSTANCE.fromJson(part.getValue(), BlockModel.class), + sprite)); + } + return new Geometry(parts.build()); + } + } +} diff --git a/src/main/java/net/minecraftforge/common/model/IModelPart.java b/src/main/java/net/minecraftforge/client/model/composite/package-info.java similarity index 76% rename from src/main/java/net/minecraftforge/common/model/IModelPart.java rename to src/main/java/net/minecraftforge/client/model/composite/package-info.java index feb6bd18d..6cfe58709 100644 --- a/src/main/java/net/minecraftforge/common/model/IModelPart.java +++ b/src/main/java/net/minecraftforge/client/model/composite/package-info.java @@ -17,11 +17,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.common.model; +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +package net.minecraftforge.client.model.composite; -/** - * Represents some part of a model you can refer to, for example: mesh, - * skeleton, bone or some separately animated submodel. - * @see IModelState - */ -public interface IModelPart {} +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/net/minecraftforge/client/model/generators/BlockModelProvider.java b/src/main/java/net/minecraftforge/client/model/generators/BlockModelProvider.java index bbb964eaa..c262ef857 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/BlockModelProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/BlockModelProvider.java @@ -1,3 +1,22 @@ +/* + * 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.generators; import net.minecraft.data.DataGenerator; diff --git a/src/main/java/net/minecraftforge/client/model/generators/ConfiguredModel.java b/src/main/java/net/minecraftforge/client/model/generators/ConfiguredModel.java index a90ea96ee..c7999ffa3 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ConfiguredModel.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ConfiguredModel.java @@ -1,3 +1,22 @@ +/* + * 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.generators; import java.util.Arrays; 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 13f152613..93ca5811d 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ExistingFileHelper.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ExistingFileHelper.java @@ -1,3 +1,22 @@ +/* + * 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.generators; import java.io.File; @@ -26,7 +45,7 @@ import net.minecraftforge.fml.event.lifecycle.GatherDataEvent; */ public class ExistingFileHelper { - private final IResourceManager clientResources, serverData; + private final SimpleReloadableResourceManager clientResources, serverData; private final boolean enable; public ExistingFileHelper(Collection existingPacks, boolean enable) { diff --git a/src/main/java/net/minecraftforge/client/model/generators/IGeneratedBlockstate.java b/src/main/java/net/minecraftforge/client/model/generators/IGeneratedBlockstate.java index 3fb2389dd..7a8237d20 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/IGeneratedBlockstate.java +++ b/src/main/java/net/minecraftforge/client/model/generators/IGeneratedBlockstate.java @@ -1,3 +1,22 @@ +/* + * 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.generators; import com.google.common.annotations.VisibleForTesting; diff --git a/src/main/java/net/minecraftforge/client/model/generators/ItemModelProvider.java b/src/main/java/net/minecraftforge/client/model/generators/ItemModelProvider.java index 1c9e8f5e5..7463acf83 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ItemModelProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ItemModelProvider.java @@ -1,3 +1,22 @@ +/* + * 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.generators; import net.minecraft.data.DataGenerator; 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 7a7801320..4b6554559 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/MultiPartBlockStateBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/MultiPartBlockStateBuilder.java @@ -1,3 +1,22 @@ +/* + * 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.generators; import java.util.ArrayList; diff --git a/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometry.java b/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometry.java new file mode 100644 index 000000000..1693814a3 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometry.java @@ -0,0 +1,51 @@ +/* + * 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.geometry; + +import com.mojang.datafixers.util.Pair; +import net.minecraft.client.renderer.model.*; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.IModelConfiguration; + +import java.util.Collection; +import java.util.Collections; +import java.util.Optional; +import java.util.Set; +import java.util.function.Function; + +/** + * General interface for any model that can be baked, superset of vanilla {@link net.minecraft.client.renderer.model.IUnbakedModel}. + * Models can be baked to different vertex formats and with different state. + */ +public interface IModelGeometry> +{ + default Collection getParts() { + return Collections.emptyList(); + } + + default Optional getPart(String name) { + return Optional.empty(); + } + + IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation); + + 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 new file mode 100644 index 000000000..fe1227f3a --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/geometry/IModelGeometryPart.java @@ -0,0 +1,48 @@ +/* + * 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.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.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.IModelBuilder; +import net.minecraftforge.client.model.IModelConfiguration; + +import java.util.Collection; +import java.util.Collections; +import java.util.Set; +import java.util.function.Function; + +public interface IModelGeometryPart +{ + String name(); + + void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation); + + default Collection getTextureDependencies(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 new file mode 100644 index 000000000..4b2030702 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/geometry/IMultipartModelGeometry.java @@ -0,0 +1,60 @@ +/* + * 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.geometry; + +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.texture.TextureAtlasSprite; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.IModelBuilder; +import net.minecraftforge.client.model.IModelConfiguration; + +import java.util.Collection; +import java.util.Optional; +import java.util.Set; +import java.util.function.Function; + +public interface IMultipartModelGeometry> extends ISimpleModelGeometry +{ + @Override + Collection getParts(); + + Optional getPart(String name); + + @Override + default void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) + { + getParts().stream().filter(part -> owner.getPartVisibility(part)) + .forEach(part -> part.addQuads(owner, modelBuilder, bakery, spriteGetter, sprite, modelLocation)); + } + + @Override + default Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + { + Set combined = Sets.newHashSet(); + for (IModelGeometryPart part : getParts()) + combined.addAll(part.getTextureDependencies(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 new file mode 100644 index 000000000..c35c0bef1 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/geometry/ISimpleModelGeometry.java @@ -0,0 +1,51 @@ +/* + * 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.geometry; + +import com.mojang.datafixers.util.Pair; +import net.minecraft.client.renderer.model.*; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.IModelBuilder; +import net.minecraftforge.client.model.IModelConfiguration; + +import java.util.Collection; +import java.util.Set; +import java.util.function.Function; + +public interface ISimpleModelGeometry> extends IModelGeometry +{ + @Override + default IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation) + { + TextureAtlasSprite particle = spriteGetter.apply(owner.resolveTexture("particle")); + + IModelBuilder builder = IModelBuilder.of(owner, overrides, particle); + + addQuads(owner, builder, bakery, spriteGetter, sprite, modelLocation); + + return builder.build(); + } + + void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation); + + @Override + 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 new file mode 100644 index 000000000..4a06310d2 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/obj/MaterialLibrary.java @@ -0,0 +1,125 @@ +/* + * 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.obj; + +import com.google.common.collect.Maps; +import joptsimple.internal.Strings; + +import javax.vecmath.Vector4f; +import java.io.IOException; +import java.util.Arrays; +import java.util.Map; + +public class MaterialLibrary +{ + final Map materials = Maps.newHashMap(); + + public MaterialLibrary(OBJLoader.LineReader reader) throws IOException + { + Material currentMaterial = null; + + String[] line; + while((line = reader.readAndSplitLine(true)) != null) + { + switch(line[0]) + { + case "newmtl": + { + String name = Strings.join(Arrays.copyOfRange(line, 1, line.length), " "); + currentMaterial = new Material(name); + materials.put(name, currentMaterial); + break; + } + + case "Ka": + currentMaterial.ambientColor = OBJModel.parseVector4(line); + break; + + case "map_Ka": + // Ignores all options params + currentMaterial.ambientColorMap = line[line.length-1]; + break; + + case "Kd": + currentMaterial.diffuseColor = OBJModel.parseVector4(line); + break; + + case "forge_TintIndex": + currentMaterial.diffuseTintIndex = Integer.parseInt(line[1]); + break; + + case "map_Kd": + // Ignores all options params + currentMaterial.diffuseColorMap = line[line.length-1]; + break; + + case "Ks": + currentMaterial.specularColor = OBJModel.parseVector4(line); + break; + + case "Ns": + currentMaterial.specularHighlight = Integer.parseInt(line[1]); + break; + + case "map_Ks": + // Ignores all options params + currentMaterial.specularColorMap = line[line.length-1]; + break; + + case "d": + // Ignores all options params + currentMaterial.dissolve = Float.parseFloat(line[1]); + break; + case "Tr": + // Ignores all options params + currentMaterial.transparency = Float.parseFloat(line[1]); + break; + } + } + } + + public Material getMaterial(String mat) + { + return materials.get(mat); + } + + public class Material + { + public final String name; + public Vector4f ambientColor = new Vector4f(0,0,0,1); + public String ambientColorMap; + public Vector4f diffuseColor = new Vector4f(1,1,1,1); + public String diffuseColorMap; + public Vector4f specularColor = new Vector4f(0,0,0,1); + public float specularHighlight = 0; + public String specularColorMap; + + public float dissolve = 1.0f; + public float transparency = 0.0f; + + // non-standard + public int diffuseTintIndex = 0; + + public Material(String name) + { + this.name = name; + } + } +} diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java index 0250aa044..9372333c6 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java @@ -19,101 +19,210 @@ package net.minecraftforge.client.model.obj; -import java.io.FileNotFoundException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import net.minecraft.client.renderer.model.IUnbakedModel; +import com.google.common.base.Charsets; +import com.google.common.collect.Maps; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import joptsimple.internal.Strings; +import net.minecraft.client.Minecraft; import net.minecraft.resources.IResource; import net.minecraft.resources.IResourceManager; +import net.minecraft.util.JSONUtils; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ICustomModelLoader; -import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.client.model.IModelLoader; -import org.apache.commons.io.IOUtils; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.*; -/* - * Loader for OBJ models. - * To enable your mod call instance.addDomain(modid). - * If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry. - */ -public enum OBJLoader implements ICustomModelLoader { - INSTANCE; +public class OBJLoader implements IModelLoader +{ + public static OBJLoader INSTANCE = new OBJLoader(); - private static final Logger LOGGER = LogManager.getLogger(); - private IResourceManager manager; - private final Set enabledDomains = new HashSet<>(); - private final Map cache = new HashMap<>(); - private final Map errors = new HashMap<>(); + private final Map modelCache = Maps.newHashMap(); + private final Map materialCache = Maps.newHashMap(); - public void addDomain(String domain) - { - enabledDomains.add(domain.toLowerCase()); - LOGGER.info("OBJLoader: Domain {} has been added.", domain.toLowerCase()); - } + private IResourceManager manager = Minecraft.getInstance().getResourceManager(); @Override public void onResourceManagerReload(IResourceManager resourceManager) { - this.manager = resourceManager; - cache.clear(); - errors.clear(); + modelCache.clear(); + materialCache.clear(); + manager = resourceManager; } @Override - public boolean accepts(ResourceLocation modelLocation) + public OBJModel read(JsonDeserializationContext deserializationContext, JsonObject modelContents) { - return enabledDomains.contains(modelLocation.getNamespace()) && modelLocation.getPath().endsWith(".obj"); + if (!modelContents.has("model")) + throw new RuntimeException("OBJ Loader requires a 'model' key that points to a valid .OBJ model."); + + String modelLocation = modelContents.get("model").getAsString(); + + boolean detectCullableFaces = JSONUtils.getBoolean(modelContents, "detectCullableFaces", true); + boolean diffuseLighting = JSONUtils.getBoolean(modelContents, "diffuseLighting", false); + boolean flipV = JSONUtils.getBoolean(modelContents, "flip-v", false); + boolean ambientToFullbright = JSONUtils.getBoolean(modelContents, "ambientToFullbright", true); + + return loadModel(new ResourceLocation(modelLocation), detectCullableFaces, diffuseLighting, flipV, ambientToFullbright); } - @Override - public IUnbakedModel loadModel(ResourceLocation modelLocation) throws Exception + public OBJModel loadModel(ResourceLocation modelLocation, boolean detectCullableFaces, boolean diffuseLighting, boolean flipV, boolean ambientToFullbright) { - ResourceLocation file = new ResourceLocation(modelLocation.getNamespace(), modelLocation.getPath()); - if (!cache.containsKey(file)) - { - IResource resource = null; + return modelCache.computeIfAbsent(new ModelSettings(modelLocation, detectCullableFaces, diffuseLighting, flipV, ambientToFullbright), (data) -> { + IResource resource; try { - try - { - resource = manager.getResource(file); - } - catch (FileNotFoundException e) - { - if (modelLocation.getPath().startsWith("models/block/")) - resource = manager.getResource(new ResourceLocation(file.getNamespace(), "models/item/" + file.getPath().substring("models/block/".length()))); - else if (modelLocation.getPath().startsWith("models/item/")) - resource = manager.getResource(new ResourceLocation(file.getNamespace(), "models/block/" + file.getPath().substring("models/item/".length()))); - else throw e; - } - OBJModel.Parser parser = new OBJModel.Parser(resource, manager); - OBJModel model = null; - try - { - model = parser.parse(); - } - catch (Exception e) - { - errors.put(modelLocation, e); - } - finally - { - cache.put(modelLocation, model); - } + resource = manager.getResource(modelLocation); } - finally + catch (IOException e) { - IOUtils.closeQuietly(resource); + throw new RuntimeException("Could not find OBJ model", e); } + + try(LineReader rdr = new LineReader(resource)) + { + return new OBJModel(modelLocation, rdr, detectCullableFaces, diffuseLighting, flipV, ambientToFullbright); + } + catch (Exception e) + { + throw new RuntimeException("Could not read OBJ model", e); + } + }); + } + + public MaterialLibrary loadMaterialLibrary(ResourceLocation materialLocation) + { + return materialCache.computeIfAbsent(materialLocation, (location) -> { + IResource resource; + try + { + resource = manager.getResource(location); + } + catch (IOException e) + { + throw new RuntimeException("Could not find OBJ material library", e); + } + + try(LineReader rdr = new LineReader(resource)) + { + return new MaterialLibrary(rdr); + } + catch (Exception e) + { + throw new RuntimeException("Could not read OBJ material library", e); + } + }); + } + + public static class LineReader implements AutoCloseable + { + InputStreamReader lineStream; + BufferedReader lineReader; + + public LineReader(IResource resource) + { + this.lineStream = new InputStreamReader(resource.getInputStream(), Charsets.UTF_8); + this.lineReader = new BufferedReader(lineStream); + } + + @Nullable + public String[] readAndSplitLine(boolean ignoreEmptyLines) throws IOException + { + do + { + String currentLine = lineReader.readLine(); + if (currentLine == null) + return null; + + List lineParts = new ArrayList<>(); + + if (currentLine.startsWith("#")) + currentLine = ""; + + if (currentLine.length() > 0) + { + + boolean hasContinuation; + do + { + hasContinuation = currentLine.endsWith("\\"); + String tmp = hasContinuation ? currentLine.substring(0, currentLine.length() - 1) : currentLine; + + Arrays.stream(tmp.split("[\t ]+")).filter(s -> !Strings.isNullOrEmpty(s)).forEach(lineParts::add); + + if (hasContinuation) + { + currentLine = lineReader.readLine(); + if (currentLine == null) + break; + + if (currentLine.length() == 0 || currentLine.startsWith("#")) + break; + } + } while (hasContinuation); + } + + if (lineParts.size() > 0) + return lineParts.toArray(new String[0]); + } + while (ignoreEmptyLines); // conditional expression is not updated, yes, I know. + + return new String[0]; + } + + @Override + public void close() throws Exception + { + lineReader.close(); + lineStream.close(); + } + } + + private class ModelSettings + { + @Nonnull + private final ResourceLocation modelLocation; + private final boolean detectCullableFaces; + private final boolean diffuseLighting; + private final boolean flipV; + private final boolean ambientToFullbright; + + public ModelSettings(@Nonnull ResourceLocation modelLocation, boolean detectCullableFaces, boolean diffuseLighting, boolean flipV, boolean ambientToFullbright) + { + this.modelLocation = modelLocation; + this.detectCullableFaces = detectCullableFaces; + this.diffuseLighting = diffuseLighting; + this.flipV = flipV; + this.ambientToFullbright = ambientToFullbright; + } + + @Override + public boolean equals(Object o) + { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ModelSettings that = (ModelSettings) o; + return equals(that); + } + + public boolean equals(@Nonnull ModelSettings that) + { + return detectCullableFaces == that.detectCullableFaces && + diffuseLighting == that.diffuseLighting && + flipV == that.flipV && + ambientToFullbright == that.ambientToFullbright && + modelLocation.equals(that.modelLocation); + } + + @Override + public int hashCode() + { + return Objects.hash(modelLocation, detectCullableFaces, diffuseLighting, flipV, ambientToFullbright); } - OBJModel model = cache.get(file); - if (model == null) throw new ModelLoaderRegistry.LoaderException("Error loading model previously: " + file, errors.get(modelLocation)); - return model; } } 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 fcc0d5317..cda474d6f 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -19,1550 +19,745 @@ package net.minecraftforge.client.model.obj; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; +import com.google.common.collect.ImmutableList; +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.model.*; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +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.minecraft.util.math.MathHelper; +import net.minecraftforge.client.model.*; +import net.minecraftforge.client.model.geometry.IModelGeometryPart; +import net.minecraftforge.client.model.geometry.IMultipartModelGeometry; +import net.minecraftforge.client.model.pipeline.IVertexConsumer; +import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; +import net.minecraftforge.common.model.TransformationHelper; +import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; -import javax.vecmath.Matrix3f; -import javax.vecmath.Matrix4f; import javax.vecmath.Vector2f; import javax.vecmath.Vector3f; import javax.vecmath.Vector4f; - -import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.model.*; -import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.ISprite; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.resources.IResource; -import net.minecraft.resources.IResourceManager; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.*; -import net.minecraftforge.client.model.data.IDynamicBakedModel; -import net.minecraftforge.client.model.data.IModelData; -import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; -import net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.Models; -import net.minecraftforge.common.model.TRSRTransformation; -import net.minecraftforge.common.property.Properties; - -import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - +import java.io.IOException; +import java.util.*; import java.util.function.Function; -import com.google.common.base.Objects; -import java.util.Optional; -import java.util.Random; +import java.util.stream.Collectors; -import com.google.common.base.Strings; -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.ImmutableMap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -public class OBJModel implements IUnbakedModel +public class OBJModel implements IMultipartModelGeometry { - private static final Logger LOGGER = LogManager.getLogger(); + private static Vector2f[] DEFAULT_COORDS = { + new Vector2f(0, 0), + new Vector2f(0, 1), + new Vector2f(1, 1), + new Vector2f(1, 0), + }; - //private Gson GSON = new GsonBuilder().create(); - private MaterialLibrary matLib; - private final ResourceLocation modelLocation; - private CustomData customData; + private final Map parts = Maps.newHashMap(); - public OBJModel(MaterialLibrary matLib, ResourceLocation modelLocation) + private final List positions = Lists.newArrayList(); + private final List texCoords = Lists.newArrayList(); + private final List normals = Lists.newArrayList(); + private final List colors = Lists.newArrayList(); + + public final boolean detectCullableFaces; + public final boolean diffuseLighting; + public final boolean flipV; + public final boolean ambientToFullbright; + + public final ResourceLocation modelLocation; + + OBJModel(ResourceLocation modelLocation, OBJLoader.LineReader reader, boolean detectCullableFaces, boolean diffuseLighting, boolean flipV, boolean ambientToFullbright) throws IOException { - this(matLib, modelLocation, new CustomData()); - } - - public OBJModel(MaterialLibrary matLib, ResourceLocation modelLocation, CustomData customData) - { - this.matLib = matLib; this.modelLocation = modelLocation; - this.customData = customData; - } + this.detectCullableFaces = detectCullableFaces; + this.diffuseLighting = diffuseLighting; + this.flipV = flipV; + this.ambientToFullbright = ambientToFullbright; - @Override - public Collection getTextures(Function modelGetter, Set missingTextureErrors) - { - Iterator materialIterator = this.matLib.materials.values().iterator(); - List textures = Lists.newArrayList(); - while (materialIterator.hasNext()) + // for relative references to material libraries + String modelDomain = modelLocation.getNamespace(); + String modelPath = modelLocation.getPath(); + int lastSlash = modelPath.lastIndexOf('/'); + if (lastSlash >= 0) + modelPath = modelPath.substring(0,lastSlash+1); // include the '/' + else + modelPath = ""; + + MaterialLibrary mtllib = null; + MaterialLibrary.Material currentMat = null; + String currentSmoothingGroup = null; + ModelGroup currentGroup = null; + ModelObject currentObject = null; + ModelMesh currentMesh = null; + + boolean objAboveGroup = false; + + String[] line; + while((line = reader.readAndSplitLine(true)) != null) { - Material mat = materialIterator.next(); - ResourceLocation textureLoc = new ResourceLocation(mat.getTexture().getPath()); - if (!textures.contains(textureLoc) && !mat.isWhite()) - textures.add(textureLoc); - } - return textures; - } - - @Override - public Collection getDependencies() - { - return Collections.emptyList(); - } - - @Nullable - @Override - public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - builder.put(ModelLoader.White.LOCATION.toString(), ModelLoader.White.INSTANCE); - TextureAtlasSprite missing = spriteGetter.apply(new ResourceLocation("missingno")); - for (Map.Entry e : matLib.materials.entrySet()) - { - if (e.getValue().getTexture().getTextureLocation().getPath().startsWith("#")) + switch(line[0]) { - LOGGER.fatal("OBJLoader: Unresolved texture '{}' for obj model '{}'", e.getValue().getTexture().getTextureLocation().getPath(), modelLocation); - builder.put(e.getKey(), missing); - } - else - { - builder.put(e.getKey(), spriteGetter.apply(e.getValue().getTexture().getTextureLocation())); - } - } - builder.put("missingno", missing); - return new OBJBakedModel(this, sprite.getState(), format, builder.build()); - } - - public MaterialLibrary getMatLib() - { - return this.matLib; - } - - @Override - public IUnbakedModel process(ImmutableMap customData) - { - OBJModel ret = new OBJModel(this.matLib, this.modelLocation, new CustomData(this.customData, customData)); - return ret; - } - - @Override - public IUnbakedModel retexture(ImmutableMap textures) - { - OBJModel ret = new OBJModel(this.matLib.makeLibWithReplacements(textures), this.modelLocation, this.customData); - return ret; - } - - static class CustomData - { - public boolean ambientOcclusion = true; - public boolean gui3d = true; - // should be an enum, TODO - //public boolean modifyUVs = false; - public boolean flipV = false; - - public CustomData(CustomData parent, ImmutableMap customData) - { - this.ambientOcclusion = parent.ambientOcclusion; - this.gui3d = parent.gui3d; - this.flipV = parent.flipV; - this.process(customData); - } - - public CustomData() {} - - public void process(ImmutableMap customData) - { - for (Map.Entry e : customData.entrySet()) - { - if (e.getKey().equals("ambient")) - this.ambientOcclusion = Boolean.valueOf(e.getValue()); - else if (e.getKey().equals("gui3d")) - this.gui3d = Boolean.valueOf(e.getValue()); - /*else if (e.getKey().equals("modifyUVs")) - this.modifyUVs = Boolean.valueOf(e.getValue());*/ - else if (e.getKey().equals("flip-v")) - this.flipV = Boolean.valueOf(e.getValue()); - } - } - } - - public static class Parser - { - private static final Pattern WHITE_SPACE = Pattern.compile("\\s+"); - private static Set unknownObjectCommands = new HashSet(); - public MaterialLibrary materialLibrary = new MaterialLibrary(); - private IResourceManager manager; - private InputStreamReader objStream; - private BufferedReader objReader; - private ResourceLocation objFrom; - - private List groupList = Lists.newArrayList(); - private List vertices = Lists.newArrayList(); - private List normals = Lists.newArrayList(); - private List texCoords = Lists.newArrayList(); - - public Parser(IResource from, IResourceManager manager) throws IOException - { - this.manager = manager; - this.objFrom = from.getLocation(); - this.objStream = new InputStreamReader(from.getInputStream(), StandardCharsets.UTF_8); - this.objReader = new BufferedReader(objStream); - } - - public List getElements() - { - return this.groupList; - } - - private float[] parseFloats(String[] data) // Helper converting strings to floats - { - float[] ret = new float[data.length]; - for (int i = 0; i < data.length; i++) - ret[i] = Float.parseFloat(data[i]); - return ret; - } - - //Partial reading of the OBJ format. Documentation taken from http://paulbourke.net/dataformats/obj/ - public OBJModel parse() throws IOException - { - String currentLine = ""; - Material material = new Material(); - material.setName(Material.DEFAULT_NAME); - int usemtlCounter = 0; - int lineNum = 0; - - for (;;) - { - lineNum++; - currentLine = objReader.readLine(); - if (currentLine == null) break; - currentLine.trim(); - if (currentLine.isEmpty() || currentLine.startsWith("#")) continue; - - try + case "mtllib": // Loads material library { - String[] fields = WHITE_SPACE.split(currentLine, 2); - String key = fields[0]; - String data = fields[1]; - String[] splitData = WHITE_SPACE.split(data); + String lib = line[1]; + if (lib.contains(":")) + mtllib = OBJLoader.INSTANCE.loadMaterialLibrary(new ResourceLocation(lib)); + else + mtllib = OBJLoader.INSTANCE.loadMaterialLibrary(new ResourceLocation(modelDomain, modelPath + lib)); + break; + } - if (key.equalsIgnoreCase("mtllib")) + case "usemtl": // Sets the current material (starts new mesh) + { + String mat = Strings.join(Arrays.copyOfRange(line, 1, line.length), " "); + MaterialLibrary.Material newMat = mtllib.getMaterial(mat); + if (!Objects.equals(newMat, currentMat)) { - this.materialLibrary.parseMaterials(manager, data, objFrom); - } - else if (key.equalsIgnoreCase("usemtl")) - { - if (this.materialLibrary.materials.containsKey(data)) + currentMat = newMat; + if (currentMesh != null && currentMesh.mat == null) { - material = this.materialLibrary.materials.get(data); + currentMesh.mat = currentMat; } else { - LOGGER.error("OBJModel.Parser: (Model: '{}', Line: {}) material '{}' referenced but was not found", objFrom, lineNum, data); - } - usemtlCounter++; - } - else if (key.equalsIgnoreCase("v")) // Vertices: x y z [w] - w Defaults to 1.0 - { - float[] coords = parseFloats(splitData); - Vector4f pos = new Vector4f(coords[0], coords[1], coords[2], coords.length == 4 ? coords[3] : 1.0F); - this.vertices.add(new Vertex(pos, material)); - } - else if (key.equalsIgnoreCase("vn")) // Vertex normals: x y z - { - this.normals.add(new Normal(parseFloats(splitData))); - } - else if (key.equalsIgnoreCase("vt")) // Vertex Textures: u [v] [w] - v/w Defaults to 0 - { - float[] coords = parseFloats(splitData); - TextureCoordinate texCoord = new TextureCoordinate(coords[0], - coords.length >= 2 ? coords[1] : 0.0F, - coords.length >= 3 ? coords[2] : 0.0F); - if (texCoord.u < 0.0f || texCoord.u > 1.0f || texCoord.v < 0.0f || texCoord.v > 1.0f) - throw new UVsOutOfBoundsException(this.objFrom); - this.texCoords.add(texCoord); - } - else if (key.equalsIgnoreCase("f")) // Face Elements: f v1[/vt1][/vn1] ... - { - if (splitData.length > 4) - LOGGER.warn("OBJModel.Parser: found a face ('f') with more than 4 vertices, only the first 4 of these vertices will be rendered!"); - - List v = Lists.newArrayListWithCapacity(splitData.length); - - for (int i = 0; i < splitData.length; i++) - { - String[] pts = splitData[i].split("/"); - - int vert = Integer.parseInt(pts[0]); - Integer texture = pts.length < 2 || Strings.isNullOrEmpty(pts[1]) ? null : Integer.parseInt(pts[1]); - Integer normal = pts.length < 3 || Strings.isNullOrEmpty(pts[2]) ? null : Integer.parseInt(pts[2]); - - vert = vert < 0 ? this.vertices.size() - 1 : vert - 1; - Vertex newV = new Vertex(new Vector4f(this.vertices.get(vert).getPos()), this.vertices.get(vert).getMaterial()); - - if (texture != null) - newV.setTextureCoordinate(this.texCoords.get(texture < 0 ? this.texCoords.size() - 1 : texture - 1)); - if (normal != null) - newV.setNormal(this.normals.get(normal < 0 ? this.normals.size() - 1 : normal - 1)); - - v.add(newV); - } - - Vertex[] va = v.toArray(new Vertex[v.size()]); - - Face face = new Face(va, material.name); - if (usemtlCounter < this.vertices.size()) - { - for (Vertex ver : face.getVertices()) + currentMesh = new ModelMesh(currentMat, currentSmoothingGroup); + if (currentObject != null) { - ver.setMaterial(material); - } - } - - if (groupList.isEmpty()) - { - if (this.materialLibrary.getGroups().containsKey(Group.DEFAULT_NAME)) - { - this.materialLibrary.getGroups().get(Group.DEFAULT_NAME).addFace(face); + currentObject.meshes.add(currentMesh); } else { - Group def = new Group(Group.DEFAULT_NAME, null); - def.addFace(face); - this.materialLibrary.getGroups().put(Group.DEFAULT_NAME, def); + if (currentGroup == null) + { + currentGroup = new ModelGroup(""); + parts.put("", currentGroup); + } + currentGroup.meshes.add(currentMesh); } } + } + break; + } + + case "v": // Vertex + positions.add(parseVector4To3(line)); + break; + case "vt": // Vertex texcoord + texCoords.add(parseVector2(line)); + break; + case "vn": // Vertex normal + normals.add(parseVector3(line)); + break; + case "vc": // Vertex color (non-standard) + colors.add(parseVector4(line)); + break; + + case "f": // Face + { + if (currentMesh == null) + { + currentMesh = new ModelMesh(currentMat, currentSmoothingGroup); + if (currentObject != null) + { + currentObject.meshes.add(currentMesh); + } else { - for (String s : groupList) + if (currentGroup == null) { - if (this.materialLibrary.getGroups().containsKey(s)) + currentGroup = new ModelGroup(""); + parts.put("", currentGroup); + } + currentGroup.meshes.add(currentMesh); + } + } + + int[][] vertices = new int[line.length-1][]; + for(int i=0;i Strings.isNullOrEmpty(num) ? 0 : Integer.parseInt(num)).toArray(); + if (vertex[0] < 0) vertex[0] = positions.size() + vertex[0]; + else vertex[0]--; + if (vertex.length > 1) + { + if (vertex[1] < 0) vertex[1] = texCoords.size() + vertex[1]; + else vertex[1]--; + if (vertex.length > 2) + { + if (vertex[2] < 0) vertex[2] = normals.size() + vertex[2]; + else vertex[2]--; + if (vertex.length > 3) { - this.materialLibrary.getGroups().get(s).addFace(face); - } - else - { - Group e = new Group(s, null); - e.addFace(face); - this.materialLibrary.getGroups().put(s, e); + if (vertex[3] < 0) vertex[3] = colors.size() + vertex[3]; + else vertex[3]--; } } } + vertices[i] = vertex; } - else if (key.equalsIgnoreCase("g") || key.equalsIgnoreCase("o")) + + currentMesh.faces.add(vertices); + + break; + } + + case "s": // Smoothing group (starts new mesh) + { + String smoothingGroup = "off".equals(line[1]) ? null : line[1]; + if (!Objects.equals(currentSmoothingGroup, smoothingGroup)) { - groupList.clear(); - if (key.equalsIgnoreCase("g")) + currentSmoothingGroup = smoothingGroup; + if (currentMesh != null && currentMesh.smoothingGroup == null) { - String[] splitSpace = data.split(" "); - for (String s : splitSpace) - groupList.add(s); + currentMesh.smoothingGroup = currentSmoothingGroup; } else { - groupList.add(data); + currentMesh = new ModelMesh(currentMat, currentSmoothingGroup); + if (currentObject != null) + { + currentObject.meshes.add(currentMesh); + } + else + { + if (currentGroup == null) + { + currentGroup = new ModelGroup(""); + parts.put("", currentGroup); + } + currentGroup.meshes.add(currentMesh); + } } } + break; + } + + case "g": + { + String name = line[1]; + if (objAboveGroup) + { + currentObject = new ModelObject(name); + if (currentMat != null || currentSmoothingGroup != null ) + currentObject.meshes.add(new ModelMesh(currentMat, currentSmoothingGroup)); + currentGroup.parts.put(name, currentObject); + } else { - if (!unknownObjectCommands.contains(key)) - { - unknownObjectCommands.add(key); - LOGGER.info("OBJLoader.Parser: command '{}' (model: '{}') is not currently supported, skipping. Line: {} '{}'", key, objFrom, lineNum, currentLine); - } + currentGroup = new ModelGroup(name); + if (currentMat != null || currentSmoothingGroup != null ) + currentGroup.meshes.add(new ModelMesh(currentMat, currentSmoothingGroup)); + parts.put(name, currentGroup); + currentObject = null; } + break; } - catch (RuntimeException e) + + case "o": { - throw new RuntimeException(String.format("OBJLoader.Parser: Exception parsing line #%d: `%s`", lineNum, currentLine), e); - } - } - - return new OBJModel(this.materialLibrary, this.objFrom); - } - } - - public static class MaterialLibrary - { - private static final Pattern WHITE_SPACE = Pattern.compile("\\s+"); - private Set unknownMaterialCommands = new HashSet(); - private Map materials = new HashMap(); - private Map groups = new HashMap(); - private InputStreamReader mtlStream; - private BufferedReader mtlReader; - -// private float[] minUVBounds = new float[] {0.0f, 0.0f}; -// private float[] maxUVBounds = new float[] {1.0f, 1.0f}; - - public MaterialLibrary() - { - this.groups.put(Group.DEFAULT_NAME, new Group(Group.DEFAULT_NAME, null)); - Material def = new Material(); - def.setName(Material.DEFAULT_NAME); - this.materials.put(Material.DEFAULT_NAME, def); - } - - public MaterialLibrary makeLibWithReplacements(ImmutableMap replacements) - { - Map mats = new HashMap(); - for (Map.Entry e : this.materials.entrySet()) - { - // key for the material name, with # added if missing - String keyMat = e.getKey(); - if(!keyMat.startsWith("#")) keyMat = "#" + keyMat; - // key for the texture name, with ".png" stripped and # added if missing - String keyTex = e.getValue().getTexture().getPath(); - if(keyTex.endsWith(".png")) keyTex = keyTex.substring(0, keyTex.length() - ".png".length()); - if(!keyTex.startsWith("#")) keyTex = "#" + keyTex; - if (replacements.containsKey(keyMat)) - { - Texture currentTexture = e.getValue().texture; - Texture replacementTexture = new Texture(replacements.get(keyMat), currentTexture.position, currentTexture.scale, currentTexture.rotation); - Material replacementMaterial = new Material(e.getValue().color, replacementTexture, e.getValue().name); - mats.put(e.getKey(), replacementMaterial); - } - else if (replacements.containsKey(keyTex)) - { - Texture currentTexture = e.getValue().texture; - Texture replacementTexture = new Texture(replacements.get(keyTex), currentTexture.position, currentTexture.scale, currentTexture.rotation); - Material replacementMaterial = new Material(e.getValue().color, replacementTexture, e.getValue().name); - mats.put(e.getKey(), replacementMaterial); - } - else - { - mats.put(e.getKey(), e.getValue()); - } - } - MaterialLibrary ret = new MaterialLibrary(); - ret.unknownMaterialCommands = this.unknownMaterialCommands; - ret.materials = mats; - ret.groups = this.groups; - ret.mtlStream = this.mtlStream; - ret.mtlReader = this.mtlReader; -// ret.minUVBounds = this.minUVBounds; -// ret.maxUVBounds = this.maxUVBounds; - return ret; - } - -// public float[] getMinUVBounds() -// { -// return this.minUVBounds; -// } - -// public float[] getMaxUVBounds() -// { -// return this.maxUVBounds; -// } - -// public void setUVBounds(float minU, float maxU, float minV, float maxV) -// { -// this.minUVBounds[0] = minU; -// this.maxUVBounds[0] = maxU; -// this.minUVBounds[1] = minV; -// this.maxUVBounds[1] = maxV; -// } - - public Map getGroups() - { - return this.groups; - } - - public List getGroupsContainingFace(Face f) - { - List groupList = Lists.newArrayList(); - for (Group g : this.groups.values()) - { - if (g.faces.contains(f)) groupList.add(g); - } - return groupList; - } - - public void changeMaterialColor(String name, int color) - { - Vector4f colorVec = new Vector4f(); - colorVec.w = (color >> 24 & 255) / 255; - colorVec.x = (color >> 16 & 255) / 255; - colorVec.y = (color >> 8 & 255) / 255; - colorVec.z = (color & 255) / 255; - this.materials.get(name).setColor(colorVec); - } - - public Material getMaterial(String name) - { - return this.materials.get(name); - } - - public ImmutableList getMaterialNames() - { - return ImmutableList.copyOf(this.materials.keySet()); - } - - public void parseMaterials(IResourceManager manager, String path, ResourceLocation from) throws IOException - { - this.materials.clear(); - boolean hasSetTexture = false; - boolean hasSetColor = false; - String domain = from.getNamespace(); - if (!path.contains("/")) - path = from.getPath().substring(0, from.getPath().lastIndexOf("/") + 1) + path; - mtlStream = new InputStreamReader(manager.getResource(new ResourceLocation(domain, path)).getInputStream(), StandardCharsets.UTF_8); - mtlReader = new BufferedReader(mtlStream); - - String currentLine = ""; - Material material = new Material(); - material.setName(Material.WHITE_NAME); - material.setTexture(Texture.WHITE); - this.materials.put(Material.WHITE_NAME, material); - this.materials.put(Material.DEFAULT_NAME, new Material(Texture.WHITE)); - - for (;;) - { - currentLine = mtlReader.readLine(); - if (currentLine == null) break; - currentLine.trim(); - if (currentLine.isEmpty() || currentLine.startsWith("#")) continue; - - String[] fields = WHITE_SPACE.split(currentLine, 2); - String key = fields[0]; - String data = fields[1]; - - if (key.equalsIgnoreCase("newmtl")) - { - hasSetColor = false; - hasSetTexture = false; - material = new Material(); - material.setName(data); - this.materials.put(data, material); - } - else if (key.equalsIgnoreCase("Ka") || key.equalsIgnoreCase("Kd") || key.equalsIgnoreCase("Ks")) - { - if (key.equalsIgnoreCase("Kd") || !hasSetColor) + String name = line[1]; + if (objAboveGroup || currentGroup == null) { - String[] rgbStrings = WHITE_SPACE.split(data, 3); - Vector4f color = new Vector4f(Float.parseFloat(rgbStrings[0]), Float.parseFloat(rgbStrings[1]), Float.parseFloat(rgbStrings[2]), 1.0f); - hasSetColor = true; - material.setColor(color); + objAboveGroup = true; + + currentGroup = new ModelGroup(name); + if (currentMat != null || currentSmoothingGroup != null ) + currentGroup.meshes.add(new ModelMesh(currentMat, currentSmoothingGroup)); + parts.put(name, currentGroup); + currentObject = null; } else { - LOGGER.info("OBJModel: A color has already been defined for material '{}' in '{}'. The color defined by key '{}' will not be applied!", material.getName(), new ResourceLocation(domain, path).toString(), key); + currentObject = new ModelObject(name); + if (currentMat != null || currentSmoothingGroup != null ) + currentObject.meshes.add(new ModelMesh(currentMat, currentSmoothingGroup)); + currentGroup.parts.put(name, currentObject); } + break; } - else if (key.equalsIgnoreCase("map_Ka") || key.equalsIgnoreCase("map_Kd") || key.equalsIgnoreCase("map_Ks")) - { - if (key.equalsIgnoreCase("map_Kd") || !hasSetTexture) + } + } + } + + public static Vector3f parseVector4To3(String[] line) + { + switch (line.length) { + case 1: return new Vector3f(0,0,0); + case 2: return new Vector3f(Float.parseFloat(line[1]), 0, 0); + case 3: return new Vector3f(Float.parseFloat(line[1]), Float.parseFloat(line[2]), 0); + case 4: return new Vector3f(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Float.parseFloat(line[3])); + default: + { + Vector4f vec4 = parseVector4(line); + return new Vector3f( + vec4.getX() / vec4.getW(), + vec4.getY() / vec4.getW(), + vec4.getZ() / vec4.getW() + ); + } + } + } + + public static Vector2f parseVector2(String[] line) + { + switch (line.length) { + 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])); + } + } + + public static Vector3f parseVector3(String[] line) + { + switch (line.length) { + case 1: return new Vector3f(0,0,0); + case 2: return new Vector3f(Float.parseFloat(line[1]), 0, 0); + case 3: return new Vector3f(Float.parseFloat(line[1]), Float.parseFloat(line[2]), 0); + default: return new Vector3f(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Float.parseFloat(line[3])); + } + } + + public static Vector4f parseVector4(String[] line) + { + switch (line.length) { + case 1: return new Vector4f(0,0,0,1); + case 2: return new Vector4f(Float.parseFloat(line[1]), 0, 0,1); + case 3: return new Vector4f(Float.parseFloat(line[1]), Float.parseFloat(line[2]), 0,1); + case 4: return new Vector4f(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Float.parseFloat(line[3]),1); + default: return new Vector4f(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Float.parseFloat(line[3]), Float.parseFloat(line[4])); + } + } + + @Override + public Collection getParts() + { + return parts.values(); + } + + @Override + public Optional getPart(String name) + { + return Optional.ofNullable(parts.get(name)); + } + + public VertexFormat calculateBestVertexFormat(@Nullable VertexFormat base) + { + List elements = Lists.newArrayList(base.func_227894_c_()); + + addElementIfNotPresent(elements, DefaultVertexFormats.POSITION_3F); + + if (texCoords.size() > 0) + { + addElementIfNotPresent(elements, DefaultVertexFormats.TEX_2F); + } + + if (normals.size() > 0) + { + addElementIfNotPresent(elements, DefaultVertexFormats.NORMAL_3B); + addElementIfNotPresent(elements, DefaultVertexFormats.PADDING_1B); + } + + if (colors.size() > 0) + { + addElementIfNotPresent(elements, DefaultVertexFormats.COLOR_4UB); + } + + if (ambientToFullbright && parts.values().stream().anyMatch(ModelGroup::hasAnyFullBright)) + { + addElementIfNotPresent(elements, DefaultVertexFormats.TEX_2S); + } + + return new VertexFormat(ImmutableList.copyOf(elements)); + } + + private static void addElementIfNotPresent(List fmt, VertexFormatElement element) + { + for(VertexFormatElement e : fmt) + { + if (e.getUsage() == element.getUsage() && e.getIndex() == element.getIndex()) + return; + } + fmt.add(element); + } + + private Pair makeQuad(int[][] indices, int tintIndex, Vector4f colorTint, Vector4f ambientColor, boolean isFullbright, TextureAtlasSprite texture, VertexFormat format, TransformationMatrix transform) + { + boolean needsNormalRecalculation = false; + for (int[] ints : indices) + { + needsNormalRecalculation |= ints.length < 3; + } + Vector3f faceNormal = new Vector3f(0,0,0); + if (needsNormalRecalculation) { + Vector3f a = positions.get(indices[0][0]); + Vector3f ab = positions.get(indices[1][0]); + Vector3f ac = positions.get(indices[2][0]); + Vector3f abs = new Vector3f(ab); + abs.sub(a); + Vector3f acs = new Vector3f(ac); + acs.sub(a); + abs.cross(abs,acs); + abs.normalize(); + faceNormal = abs; + } + + Vector4f[] pos = new Vector4f[4]; + Vector3f[] norm = new Vector3f[4]; + + UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); + + builder.setQuadTint(tintIndex); + builder.setTexture(texture); + builder.setApplyDiffuseLighting(!isFullbright); + + int fakeLight = (int)((ambientColor.x + ambientColor.y + ambientColor.z) * 15 / 3.0f); + Vector2f uv2 = new Vector2f(((float) fakeLight * 0x20) / 0xFFFF, ((float) fakeLight * 0x20) / 0xFFFF); + + boolean hasTransform = !transform.isIdentity(); + TransformationMatrix transformation = hasTransform ? transform : null; + + for(int i=0;i<4;i++) + { + int[] index = indices[Math.min(i,indices.length-1)]; + Vector3f pos0 = positions.get(index[0]); + Vector4f position = new Vector4f(pos0.x, pos0.y, pos0.z, 1); + 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]) : new Vector4f(1, 1, 1, 1); + if (hasTransform) + { + normal = new Vector3f(norm0); + transformation.transformPosition(TransformationHelper.toMojang(position)); + transformation.transformNormal(normal); + }; + Vector4f tintedColor = new Vector4f( + color.getX() * colorTint.getX(), + color.getY() * colorTint.getY(), + color.getZ() * colorTint.getZ(), + color.getW() * colorTint.getW()); + putVertexData(builder, format, position, texCoord, normal, tintedColor, uv2, texture); + pos[i] = position; + norm[i] = normal; + } + + builder.setQuadOrientation(Direction.getFacingFromVector(norm[0].x, norm[0].y,norm[0].z)); + + Direction cull = null; + if (detectCullableFaces) + { + if (MathHelper.epsilonEquals(pos[0].getX(), 0) && // vertex.position.x + MathHelper.epsilonEquals(pos[1].getX(), 0) && + MathHelper.epsilonEquals(pos[2].getX(), 0) && + MathHelper.epsilonEquals(pos[3].getX(), 0) && + norm[0].getX() < 0) // vertex.normal.x + { + cull = Direction.WEST; + } + else if (MathHelper.epsilonEquals(pos[0].getX(), 1) && // vertex.position.x + MathHelper.epsilonEquals(pos[1].getX(), 1) && + MathHelper.epsilonEquals(pos[2].getX(), 1) && + MathHelper.epsilonEquals(pos[3].getX(), 1) && + norm[0].getX() > 0) // vertex.normal.x + { + cull = Direction.EAST; + } + else if (MathHelper.epsilonEquals(pos[0].getZ(), 0) && // vertex.position.z + MathHelper.epsilonEquals(pos[1].getZ(), 0) && + MathHelper.epsilonEquals(pos[2].getZ(), 0) && + MathHelper.epsilonEquals(pos[3].getZ(), 0) && + norm[0].getZ() < 0) // vertex.normal.z + { + cull = Direction.NORTH; // can never remember + } + else if (MathHelper.epsilonEquals(pos[0].getZ(), 1) && // vertex.position.z + MathHelper.epsilonEquals(pos[1].getZ(), 1) && + MathHelper.epsilonEquals(pos[2].getZ(), 1) && + MathHelper.epsilonEquals(pos[3].getZ(), 1) && + norm[0].getZ() > 0) // vertex.normal.z + { + cull = Direction.SOUTH; + } + else if (MathHelper.epsilonEquals(pos[0].getY(), 0) && // vertex.position.y + MathHelper.epsilonEquals(pos[1].getY(), 0) && + MathHelper.epsilonEquals(pos[2].getY(), 0) && + MathHelper.epsilonEquals(pos[3].getY(), 0) && + norm[0].getY() < 0) // vertex.normal.z + { + cull = Direction.DOWN; // can never remember + } + else if (MathHelper.epsilonEquals(pos[0].getY(), 1) && // vertex.position.y + MathHelper.epsilonEquals(pos[1].getY(), 1) && + MathHelper.epsilonEquals(pos[2].getY(), 1) && + MathHelper.epsilonEquals(pos[3].getY(), 1) && + norm[0].getY() > 0) // vertex.normal.y + { + cull = Direction.UP; + } + } + + return Pair.of(builder.build(), cull); + } + + private void putVertexData(IVertexConsumer consumer, VertexFormat format, Vector4f position0, Vector2f texCoord0, Vector3f normal0, Vector4f color0, Vector2f uv2, TextureAtlasSprite texture) + { + ImmutableList elements = format.func_227894_c_(); + for(int j=0;j float[0.0:1.0, 1.0] - //Tr r g b OR Tr spectral map file OR Tr xyz r g b (CIEXYZ colorspace) - String[] splitData = WHITE_SPACE.split(data); - float alpha = Float.parseFloat(splitData[splitData.length - 1]); - material.getColor().setW(alpha); - } - else - { - if (!unknownMaterialCommands.contains(key)) - { - unknownMaterialCommands.add(key); - LOGGER.info("OBJLoader.MaterialLibrary: key '{}' (model: '{}') is not currently supported, skipping", key, new ResourceLocation(domain, path)); - } - } - } - } - } - - public static class Material - { - public static final String WHITE_NAME = "OBJModel.White.Texture.Name"; - public static final String DEFAULT_NAME = "OBJModel.Default.Texture.Name"; - private Vector4f color; - private Texture texture = Texture.WHITE; - private String name = DEFAULT_NAME; - - public Material() - { - this(new Vector4f(1f, 1f, 1f, 1f)); - } - - public Material(Vector4f color) - { - this(color, Texture.WHITE, WHITE_NAME); - } - - public Material(Texture texture) - { - this(new Vector4f(1f, 1f, 1f, 1f), texture, DEFAULT_NAME); - } - - public Material(Vector4f color, Texture texture, String name) - { - this.color = color; - this.texture = texture; - this.name = name != null ? name : DEFAULT_NAME; - } - - public void setName(String name) - { - this.name = name != null ? name : DEFAULT_NAME; - } - - public String getName() - { - return this.name; - } - - public void setColor(Vector4f color) - { - this.color = color; - } - - public Vector4f getColor() - { - return this.color; - } - - public void setTexture(Texture texture) - { - this.texture = texture; - } - - public Texture getTexture() - { - return this.texture; - } - - public boolean isWhite() - { - return this.texture.equals(Texture.WHITE); - } - - @Override - public String toString() - { - StringBuilder builder = new StringBuilder(String.format("%nMaterial:%n")); - builder.append(String.format(" Name: %s%n", this.name)); - builder.append(String.format(" Color: %s%n", this.color.toString())); - builder.append(String.format(" Is White: %b%n", this.isWhite())); - return builder.toString(); - } - } - - public static class Texture - { - public static Texture WHITE = new Texture("builtin/white", new Vector2f(0, 0), new Vector2f(1, 1), 0); - private String path; - private Vector2f position; - private Vector2f scale; - private float rotation; - - public Texture(String path) - { - this(path, new Vector2f(0, 0), new Vector2f(1, 1), 0); - } - - public Texture(String path, Vector2f position, Vector2f scale, float rotation) - { - this.path = path; - this.position = position; - this.scale = scale; - this.rotation = rotation; - } - - public ResourceLocation getTextureLocation() - { - ResourceLocation loc = new ResourceLocation(this.path); - return loc; - } - - public void setPath(String path) - { - this.path = path; - } - - public String getPath() - { - return this.path; - } - - public void setPosition(Vector2f position) - { - this.position = position; - } - - public Vector2f getPosition() - { - return this.position; - } - - public void setScale(Vector2f scale) - { - this.scale = scale; - } - - public Vector2f getScale() - { - return this.scale; - } - - public void setRotation(float rotation) - { - this.rotation = rotation; - } - - public float getRotation() - { - return this.rotation; - } - } - - public static class Face - { - private Vertex[] verts = new Vertex[4]; -// private Normal[] norms = new Normal[4]; -// private TextureCoordinate[] texCoords = new TextureCoordinate[4]; - private String materialName = Material.DEFAULT_NAME; - private boolean isTri = false; - - public Face(Vertex[] verts) - { - this(verts, Material.DEFAULT_NAME); - } - - public Face(Vertex[] verts, String materialName) { - this.verts = verts != null && verts.length > 2 ? verts : null; - setMaterialName(materialName); - checkData(); - } - -// public Face(Vertex[] verts, Normal[] norms) -// { -// this(verts, norms, null); -// } - -// public Face(Vertex[] verts, TextureCoordinate[] texCoords) -// { -// this(verts, null, texCoords); -// } - -// public Face(Vertex[] verts, Normal[] norms, TextureCoordinate[] texCoords) -// { -// this(verts, norms, texCoords, Material.DEFAULT_NAME); -// } - -// public Face(Vertex[] verts, Normal[] norms, TextureCoordinate[] texCoords, String materialName) -// { -// this.verts = verts != null && verts.length > 2 ? verts : null; -// this.norms = norms != null && norms.length > 2 ? norms : null; -// this.texCoords = texCoords != null && texCoords.length > 2 ? texCoords : null; -// setMaterialName(materialName); -// checkData(); -// } - - private void checkData() - { - if (this.verts != null && this.verts.length == 3) - { - this.isTri = true; - this.verts = new Vertex[]{this.verts[0], this.verts[1], this.verts[2], this.verts[2]}; - } - } - - public void setMaterialName(String materialName) - { - this.materialName = materialName != null && !materialName.isEmpty() ? materialName : this.materialName; - } - - public String getMaterialName() - { - return this.materialName; - } - - public boolean isTriangles() - { - return isTri; - } - - public boolean setVertices(Vertex[] verts) - { - if (verts == null) return false; - else this.verts = verts; - checkData(); - return true; - } - - public Vertex[] getVertices() - { - return this.verts; - } - -// public boolean areUVsNormalized() -// { -// for (Vertex v : this.verts) -// if (!v.hasNormalizedUVs()) -// return false; -// return true; -// } - -// public void normalizeUVs(float[] min, float[] max) -// { -// if (!this.areUVsNormalized()) -// { -// for (int i = 0; i < this.verts.length; i++) { -// TextureCoordinate texCoord = this.verts[i].getTextureCoordinate(); -// min[0] = texCoord.u < min[0] ? texCoord.u : min[0]; -// max[0] = texCoord.u > max[0] ? texCoord.u : max[0]; -// min[1] = texCoord.v < min[1] ? texCoord.v : min[1]; -// max[1] = texCoord.v > max[1] ? texCoord.v : max[1]; -// } -// -// for (Vertex v : this.verts) { -// v.texCoord.u = (v.texCoord.u - min[0]) / (max[0] - min[0]); -// v.texCoord.v = (v.texCoord.v - min[1]) / (max[1] - max[1]); -// } -// } -// } - - public Face bake(TRSRTransformation transform) - { - Vertex[] vertices = new Vertex[verts.length]; -// Normal[] normals = norms != null ? new Normal[norms.length] : null; -// TextureCoordinate[] textureCoords = texCoords != null ? new TextureCoordinate[texCoords.length] : null; - - for (int i = 0; i < verts.length; i++) - { - Vertex v = verts[i]; -// Normal n = norms != null ? norms[i] : null; -// TextureCoordinate t = texCoords != null ? texCoords[i] : null; - - Vector4f pos = new Vector4f(v.getPos()); - pos.w = 1; - transform.transformPosition(pos); - vertices[i] = new Vertex(pos, v.getMaterial()); - - if (v.hasNormal()) - { - Vector3f normal = new Vector3f(v.getNormal().getData()); - transform.transformNormal(normal); - vertices[i].setNormal(new Normal(normal)); - } - - if (v.hasTextureCoordinate()) vertices[i].setTextureCoordinate(v.getTextureCoordinate()); - else v.setTextureCoordinate(TextureCoordinate.getDefaultUVs()[i]); - - //texCoords TODO -// if (t != null) textureCoords[i] = t; - } - return new Face(vertices, this.materialName); - } - - public Normal getNormal() - { - Vector3f a = this.verts[2].getPos3(); - a.sub(this.verts[0].getPos3()); - Vector3f b = this.verts[3].getPos3(); - b.sub(this.verts[1].getPos3()); - a.cross(a, b); - a.normalize(); - return new Normal(a); - } - } - - public static class Vertex - { - private Vector4f position; - private Normal normal; - private TextureCoordinate texCoord; - private Material material = new Material(); - - public Vertex(Vector4f position, Material material) - { - this.position = position; - this.material = material; - } - - public void setPos(Vector4f position) - { - this.position = position; - } - - public Vector4f getPos() - { - return this.position; - } - - public Vector3f getPos3() - { - return new Vector3f(this.position.x, this.position.y, this.position.z); - } - - public boolean hasNormal() - { - return this.normal != null; - } - - public void setNormal(Normal normal) - { - this.normal = normal; - } - - public Normal getNormal() - { - return this.normal; - } - - public boolean hasTextureCoordinate() - { - return this.texCoord != null; - } - - public void setTextureCoordinate(TextureCoordinate texCoord) - { - this.texCoord = texCoord; - } - - public TextureCoordinate getTextureCoordinate() - { - return this.texCoord; - } - -// public boolean hasNormalizedUVs() -// { -// return this.texCoord.u >= 0.0f && this.texCoord.u <= 1.0f && this.texCoord.v >= 0.0f && this.texCoord.v <= 1.0f; -// } - - public void setMaterial(Material material) - { - this.material = material; - } - - public Material getMaterial() - { - return this.material; - } - - @Override - public String toString() - { - StringBuilder builder = new StringBuilder(); - builder.append(String.format("v:%n")); - builder.append(String.format(" position: %s %s %s%n", position.x, position.y, position.z)); - builder.append(String.format(" material: %s %s %s %s %s%n", material.getName(), material.getColor().x, material.getColor().y, material.getColor().z, material.getColor().w)); - return builder.toString(); - } - } - - public static class Normal - { - public float x, y, z; - - public Normal() - { - this(0.0f, 0.0f, 0.0f); - } - - public Normal(float[] data) - { - this(data[0], data[1], data[2]); - } - - public Normal(Vector3f vector3f) - { - this(vector3f.x, vector3f.y, vector3f.z); - } - - public Normal(float x, float y, float z) { - this.x = x; - this.y = y; - this.z = z; - } - - public Vector3f getData() - { - return new Vector3f(this.x, this.y, this.z); - } - } - - public static class TextureCoordinate - { - public float u, v, w; - - public TextureCoordinate() - { - this(0.0f, 0.0f, 1.0f); - } - - public TextureCoordinate(float[] data) - { - this(data[0], data[1], data[2]); - } - - public TextureCoordinate(Vector3f data) - { - this(data.x, data.y, data.z); - } - - public TextureCoordinate(float u, float v, float w) - { - this.u = u; - this.v = v; - this.w = w; - } - - public Vector3f getData() - { - return new Vector3f(this.u, this.v, this.w); - } - - public static TextureCoordinate[] getDefaultUVs() - { - TextureCoordinate[] texCoords = new TextureCoordinate[4]; - texCoords[0] = new TextureCoordinate(0.0f, 0.0f, 1.0f); - texCoords[1] = new TextureCoordinate(1.0f, 0.0f, 1.0f); - texCoords[2] = new TextureCoordinate(1.0f, 1.0f, 1.0f); - texCoords[3] = new TextureCoordinate(0.0f, 1.0f, 1.0f); - return texCoords; - } - } - - @Deprecated - public static class Group implements IModelPart - { - public static final String DEFAULT_NAME = "OBJModel.Default.Element.Name"; - public static final String ALL = "OBJModel.Group.All.Key"; - public static final String ALL_EXCEPT = "OBJModel.Group.All.Except.Key"; - private String name = DEFAULT_NAME; - private LinkedHashSet faces = new LinkedHashSet(); - public float[] minUVBounds = new float[] {0.0f, 0.0f}; - public float[] maxUVBounds = new float[] {1.0f, 1.0f}; - -// public float[] minUVBounds = new float[] {0.0f, 0.0f}; -// public float[] maxUVBounds = new float[] {1.0f, 1.0f}; - - public Group(String name, @Nullable LinkedHashSet faces) - { - this.name = name != null ? name : DEFAULT_NAME; - this.faces = faces == null ? new LinkedHashSet() : faces; - } - - public LinkedHashSet applyTransform(Optional transform) - { - LinkedHashSet faceSet = new LinkedHashSet(); - for (Face f : this.faces) - { -// if (minUVBounds != null && maxUVBounds != null) f.normalizeUVs(minUVBounds, maxUVBounds); - faceSet.add(f.bake(transform.orElse(TRSRTransformation.identity()))); - } - return faceSet; - } - - public String getName() - { - return this.name; - } - - public LinkedHashSet getFaces() - { - return this.faces; - } - - public void setFaces(LinkedHashSet faces) - { - this.faces = faces; - } - - public void addFace(Face face) - { - this.faces.add(face); - } - - public void addFaces(List faces) - { - this.faces.addAll(faces); - } - } - - @Deprecated - public static class OBJState implements IModelState - { - protected Map visibilityMap = Maps.newHashMap(); - public IModelState parent; - protected Operation operation = Operation.SET_TRUE; - - public OBJState(List visibleGroups, boolean visibility) - { - this(visibleGroups, visibility, TRSRTransformation.identity()); - } - - public OBJState(List visibleGroups, boolean visibility, IModelState parent) - { - this.parent = parent; - for (String s : visibleGroups) this.visibilityMap.put(s, visibility); - } - - @Nullable - public IModelState getParent(IModelState parent) - { - if (parent == null) return null; - else if (parent instanceof OBJState) return ((OBJState) parent).parent; - return parent; - } - - @Override - public Optional apply(Optional part) - { - if (parent != null) return parent.apply(part); - return Optional.empty(); - } - - public Map getVisibilityMap() - { - return this.visibilityMap; - } - - public List getGroupsWithVisibility(boolean visibility) - { - List ret = Lists.newArrayList(); - for (Map.Entry e : this.visibilityMap.entrySet()) - { - if (e.getValue() == visibility) - { - ret.add(e.getKey()); - } - } - return ret; - } - - public List getGroupNamesFromMap() - { - return Lists.newArrayList(this.visibilityMap.keySet()); - } - - public void changeGroupVisibilities(List names, Operation operation) - { - if (names == null || names.isEmpty()) return; - this.operation = operation; - if (names.get(0).equals(Group.ALL)) - { - for (String s : this.visibilityMap.keySet()) - { - this.visibilityMap.put(s, this.operation.performOperation(this.visibilityMap.get(s))); - } - } - else if (names.get(0).equals(Group.ALL_EXCEPT)) - { - for (String s : this.visibilityMap.keySet()) - { - if (!names.subList(1, names.size()).contains(s)) - { - this.visibilityMap.put(s, this.operation.performOperation(this.visibilityMap.get(s))); - } - } - } - else - { - for (String s : names) - { - this.visibilityMap.put(s, this.operation.performOperation(this.visibilityMap.get(s))); - } - } - } - - @Override - public String toString() - { - StringBuilder builder = new StringBuilder("OBJState: "); - builder.append(String.format("%n parent: %s%n", this.parent.toString())); - builder.append(String.format(" visibility map: %n")); - for (Map.Entry e : this.visibilityMap.entrySet()) - { - builder.append(String.format(" name: %s visible: %b%n", e.getKey(), e.getValue())); - } - return builder.toString(); - } - - @Override - public int hashCode() - { - return Objects.hashCode(visibilityMap, parent, operation); - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - OBJState other = (OBJState) obj; - return Objects.equal(visibilityMap, other.visibilityMap) && - Objects.equal(parent, other.parent) && - operation == other.operation; - } - - public enum Operation - { - SET_TRUE, - SET_FALSE, - TOGGLE; - - Operation(){} - - public boolean performOperation(boolean valueToToggle) - { - switch(this) - { + break; + case NORMAL: + consumer.put(j, normal0.getX(), normal0.getY(), normal0.getZ()); + break; default: - case SET_TRUE: return true; - case SET_FALSE: return false; - case TOGGLE: return !valueToToggle; - } + consumer.put(j); + break; } } } - public class OBJBakedModel implements IDynamicBakedModel + /* + public BakedGeometryRenderable bakeRenderable() { - private final OBJModel model; - private IModelState state; - private final VertexFormat format; - private ImmutableList quads; - private ImmutableMap textures; - private TextureAtlasSprite sprite = ModelLoader.White.INSTANCE; + return bakeRenderable(DummyAtlasSprite.GETTER); + } - public OBJBakedModel(OBJModel model, IModelState state, VertexFormat format, ImmutableMap textures) + public BakedGeometryRenderable bakeRenderable(Function spriteGetter) + { + return BakedGeometryRenderable.of(GL11.GL_QUADS, calculateBestVertexFormat(null), ((bufferBuilder, fmt) -> { + this.addQuads( + new StandaloneModelConfiguration("", true, diffuseLighting), + new VertexBufferModelBuilder(bufferBuilder), + null, spriteGetter, SimpleModelTransform.IDENTITY, fmt); + })); + } + */ + + public class ModelObject implements IModelGeometryPart + { + public final String name; + + List meshes = Lists.newArrayList(); + + ModelObject(String name) { - this.model = model; - this.state = state; - if (this.state instanceof OBJState) this.updateStateVisibilityMap((OBJState) this.state); - this.format = format; - this.textures = textures; + this.name = name; } - public void scheduleRebake() - { - } - - // FIXME: merge with getQuads @Override - public List getQuads(BlockState blockState, Direction side, Random rand, IModelData modelData) + public String name() { - if (side != null) return ImmutableList.of(); - if (quads == null) - { - quads = buildQuads(this.state); - } - IModelState newState = modelData.getData(Properties.AnimationProperty); - if (newState != null) - { - newState = new ModelStateComposition(this.state, newState); - return buildQuads(newState); - } - return quads; + return name; } - private ImmutableList buildQuads(IModelState modelState) + @Override + public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) { - List quads = Lists.newArrayList(); - Collections.synchronizedSet(new LinkedHashSet()); - Set faces = Collections.synchronizedSet(new LinkedHashSet()); - Optional transform = Optional.empty(); - for (Group g : this.model.getMatLib().getGroups().values()) + for(ModelMesh mesh : meshes) { -// g.minUVBounds = this.model.getMatLib().minUVBounds; -// g.maxUVBounds = this.model.getMatLib().maxUVBounds; -// FMLLog.info("Group: %s u: [%f, %f] v: [%f, %f]", g.name, g.minUVBounds[0], g.maxUVBounds[0], g.minUVBounds[1], g.maxUVBounds[1]); - - if(modelState.apply(Optional.of(Models.getHiddenModelPart(ImmutableList.of(g.getName())))).isPresent()) - { + MaterialLibrary.Material mat = mesh.mat; + if (mat == null) continue; - } - if (modelState instanceof OBJState) + TextureAtlasSprite texture = spriteGetter.apply(ModelLoaderRegistry.resolveTexture(mat.diffuseColorMap, owner)); + int tintIndex = mat.diffuseTintIndex; + Vector4f colorTint = mat.diffuseColor; + boolean isFullbright = ambientToFullbright && mesh.isFullbright(); + + for (int[][] face : mesh.faces) { - OBJState state = (OBJState) modelState; - if (state.parent != null) - { - transform = state.parent.apply(Optional.empty()); - } - //TODO: can this be replaced by updateStateVisibilityMap(OBJState)? - if (state.getGroupNamesFromMap().contains(Group.ALL)) - { - state.visibilityMap.clear(); - for (String s : this.model.getMatLib().getGroups().keySet()) - { - state.visibilityMap.put(s, state.operation.performOperation(true)); - } - } - else if (state.getGroupNamesFromMap().contains(Group.ALL_EXCEPT)) - { - List exceptList = state.getGroupNamesFromMap().subList(1, state.getGroupNamesFromMap().size()); - state.visibilityMap.clear(); - for (String s : this.model.getMatLib().getGroups().keySet()) - { - if (!exceptList.contains(s)) - { - state.visibilityMap.put(s, state.operation.performOperation(true)); - } - } - } + Pair quad = makeQuad(face, tintIndex, colorTint, mat.ambientColor, isFullbright, texture, DefaultVertexFormats.BLOCK, sprite.func_225615_b_()); + if (quad.getRight() == null) + modelBuilder.addGeneralQuad(quad.getLeft()); else - { - for (String s : state.visibilityMap.keySet()) - { - state.visibilityMap.put(s, state.operation.performOperation(state.visibilityMap.get(s))); - } - } - if (state.getGroupsWithVisibility(true).contains(g.getName())) - { - faces.addAll(g.applyTransform(transform)); - } - } - else - { - transform = modelState.apply(Optional.empty()); - faces.addAll(g.applyTransform(transform)); - } - } - for (Face f : faces) - { - if (this.model.getMatLib().materials.get(f.getMaterialName()).isWhite()) - { - for (Vertex v : f.getVertices()) - {//update material in each vertex - if (!v.getMaterial().equals(this.model.getMatLib().getMaterial(v.getMaterial().getName()))) - { - v.setMaterial(this.model.getMatLib().getMaterial(v.getMaterial().getName())); - } - } - sprite = ModelLoader.White.INSTANCE; - } - else sprite = this.textures.get(f.getMaterialName()); - UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); - builder.setContractUVs(true); - builder.setQuadOrientation(Direction.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); - builder.setTexture(sprite); - Normal faceNormal = f.getNormal(); - putVertexData(builder, f.verts[0], faceNormal, TextureCoordinate.getDefaultUVs()[0], sprite); - putVertexData(builder, f.verts[1], faceNormal, TextureCoordinate.getDefaultUVs()[1], sprite); - putVertexData(builder, f.verts[2], faceNormal, TextureCoordinate.getDefaultUVs()[2], sprite); - putVertexData(builder, f.verts[3], faceNormal, TextureCoordinate.getDefaultUVs()[3], sprite); - quads.add(builder.build()); - } - return ImmutableList.copyOf(quads); - } - - private final void putVertexData(UnpackedBakedQuad.Builder builder, Vertex v, Normal faceNormal, TextureCoordinate defUV, TextureAtlasSprite sprite) - { - for (int e = 0; e < format.getElementCount(); e++) - { - switch (format.getElement(e).getUsage()) - { - case POSITION: - builder.put(e, v.getPos().x, v.getPos().y, v.getPos().z, v.getPos().w); - break; - case COLOR: - if (v.getMaterial() != null) - builder.put(e, - v.getMaterial().getColor().x, - v.getMaterial().getColor().y, - v.getMaterial().getColor().z, - v.getMaterial().getColor().w); - else - builder.put(e, 1, 1, 1, 1); - break; - case UV: - if (!v.hasTextureCoordinate()) - builder.put(e, - sprite.getInterpolatedU(defUV.u * 16), - sprite.getInterpolatedV((model.customData.flipV ? 1 - defUV.v: defUV.v) * 16), - 0, 1); - else - builder.put(e, - sprite.getInterpolatedU(v.getTextureCoordinate().u * 16), - sprite.getInterpolatedV((model.customData.flipV ? 1 - v.getTextureCoordinate().v : v.getTextureCoordinate().v) * 16), - 0, 1); - break; - case NORMAL: - if (!v.hasNormal()) - builder.put(e, faceNormal.x, faceNormal.y, faceNormal.z, 0); - else - builder.put(e, v.getNormal().x, v.getNormal().y, v.getNormal().z, 0); - break; - default: - builder.put(e); + modelBuilder.addFaceQuad(quad.getRight(), quad.getLeft()); } } } @Override - public boolean isAmbientOcclusion() + public Collection getTextureDependencies(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { - return model != null ? model.customData.ambientOcclusion : true; + return meshes.stream().map(mesh -> ModelLoaderRegistry.resolveTexture(mesh.mat.diffuseColorMap, owner)).collect(Collectors.toSet()); } - @Override - public boolean isGui3d() + public boolean hasAnyFullBright() { - return model != null ? model.customData.gui3d : true; - } - - @Override - public boolean isBuiltInRenderer() - { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() - { - return this.sprite; - } - - // FIXME: merge with getQuads - /* @Override - public OBJBakedModel handleBlockState(IBlockState state) - { - if (state instanceof IExtendedBlockState) - { - IExtendedBlockState exState = (IExtendedBlockState) state; - if (exState.getUnlistedNames().contains(OBJProperty.instance)) - { - OBJState s = exState.getValue(OBJProperty.instance); - if (s != null) - { - if (s.visibilityMap.containsKey(Group.ALL) || s.visibilityMap.containsKey(Group.ALL_EXCEPT)) - { - this.updateStateVisibilityMap(s); - } - return getCachedModel(s); - } - } - } - return this; - }*/ - - private void updateStateVisibilityMap(OBJState state) - { - if (state.visibilityMap.containsKey(Group.ALL)) - { - boolean operation = state.visibilityMap.get(Group.ALL); - state.visibilityMap.clear(); - for (String s : this.model.getMatLib().getGroups().keySet()) - { - state.visibilityMap.put(s, state.operation.performOperation(operation)); - } - } - else if (state.visibilityMap.containsKey(Group.ALL_EXCEPT)) - { - List exceptList = state.getGroupNamesFromMap().subList(1, state.getGroupNamesFromMap().size()); - state.visibilityMap.remove(Group.ALL_EXCEPT); - for (String s : this.model.getMatLib().getGroups().keySet()) - { - if (!exceptList.contains(s)) - { - state.visibilityMap.put(s, state.operation.performOperation(state.visibilityMap.get(s))); - } - } - } - else - { - for (String s : state.visibilityMap.keySet()) - { - state.visibilityMap.put(s, state.operation.performOperation(state.visibilityMap.get(s))); - } - } - } - - private final LoadingCache cache = CacheBuilder.newBuilder().maximumSize(20).build(new CacheLoader() - { - @Override - public OBJBakedModel load(IModelState state) throws Exception - { - return new OBJBakedModel(model, state, format, textures); - } - }); - - public OBJBakedModel getCachedModel(IModelState state) - { - return cache.getUnchecked(state); - } - - public OBJModel getModel() - { - return this.model; - } - - public IModelState getState() - { - return this.state; - } - - public OBJBakedModel getBakedModel() - { - return new OBJBakedModel(this.model, this.state, this.format, this.textures); - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) - { - return PerspectiveMapWrapper.handlePerspective(this, state, cameraTransformType); - } - - @Override - public String toString() - { - return this.model.modelLocation.toString(); - } - - @Override - public ItemOverrideList getOverrides() - { - return ItemOverrideList.EMPTY; + return meshes.stream().anyMatch(ModelMesh::isFullbright); } } - @SuppressWarnings("serial") - public static class UVsOutOfBoundsException extends RuntimeException + public class ModelGroup extends ModelObject { - public ResourceLocation modelLocation; + final Map parts = Maps.newHashMap(); - public UVsOutOfBoundsException(ResourceLocation modelLocation) + ModelGroup(String name) { - super(String.format("Model '%s' has UVs ('vt') out of bounds 0-1! The missing model will be used instead. Support for UV processing will be added to the OBJ loader in the future.", modelLocation)); - this.modelLocation = modelLocation; + super(name); + } + + public Collection getParts() + { + return parts.values(); + } + + @Override + public void addQuads(IModelConfiguration owner, IModelBuilder modelBuilder, ModelBakery bakery, Function spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) + { + super.addQuads(owner, modelBuilder, bakery, spriteGetter, sprite, modelLocation); + + getParts().stream().filter(part -> owner.getPartVisibility(part)) + .forEach(part -> part.addQuads(owner, modelBuilder, bakery, spriteGetter, sprite, modelLocation)); + } + + @Override + public Collection getTextureDependencies(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) + { + Set combined = Sets.newHashSet(); + combined.addAll(super.getTextureDependencies(owner, modelGetter, missingTextureErrors)); + for (IModelGeometryPart part : getParts()) + combined.addAll(part.getTextureDependencies(owner, modelGetter, missingTextureErrors)); + return combined; + } + + @Override + public boolean hasAnyFullBright() + { + return super.hasAnyFullBright() || parts.values().stream().anyMatch(ModelObject::hasAnyFullBright); } } + + private class ModelMesh + { + @Nullable + public MaterialLibrary.Material mat; + @Nullable + public String smoothingGroup; + public final List faces = Lists.newArrayList(); + + public ModelMesh(@Nullable MaterialLibrary.Material currentMat, @Nullable String currentSmoothingGroup) + { + this.mat = currentMat; + this.smoothingGroup = currentSmoothingGroup; + } + + public boolean isFullbright() + { + return mat != null && mat.ambientColor.epsilonEquals(new Vector4f(1,1,1,1), 1/256f); + } + } + + /* + private static class VertexBufferModelBuilder implements IModelBuilder + { + private final BufferBuilder bufferBuilder; + + public VertexBufferModelBuilder(BufferBuilder bufferBuilder) + { + this.bufferBuilder = bufferBuilder; + } + + @Override + public VertexBufferModelBuilder addFaceQuad(Direction facing, BakedQuad quad) + { + LightUtil.renderQuadColor(bufferBuilder, quad, -1); + return this; + } + + @Override + public VertexBufferModelBuilder addGeneralQuad(BakedQuad quad) + { + LightUtil.renderQuadColor(bufferBuilder, quad, -1); + return this; + } + + @Override + public IBakedModel build() + { + return null; + } + } + + private static class StandaloneModelConfiguration implements IModelConfiguration + { + private final String modelName; + private final boolean diffuseLighting; + private final boolean directionalLighting; + + private StandaloneModelConfiguration(String modelName, boolean directionalLighting, boolean diffuseLighting) + { + this.modelName = modelName; + this.directionalLighting = directionalLighting; + this.diffuseLighting = diffuseLighting; + } + + @Override + public String getModelName() + { + return modelName; + } + + @Override + public Material resolveTexture(String name) + { + return ""; + } + + @Override + public boolean isShadedInGui() + { + return directionalLighting; + } + + @Override + public boolean useSmoothLighting() + { + return diffuseLighting; + } + + @Override + public ItemCameraTransforms getCameraTransforms() + { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public IModelTransform getCombinedTransform() + { + return SimpleModelTransform.IDENTITY; + } + } + */ } 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 3f01f5a13..f49605d51 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java @@ -27,14 +27,14 @@ 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.IEnviromentBlockReader; +import net.minecraft.world.ILightReader; public class BlockInfo { private static final Direction[] SIDES = Direction.values(); private final BlockColors colors; - private IEnviromentBlockReader world; + private ILightReader world; private BlockState state; private BlockPos blockPos; @@ -63,7 +63,7 @@ public class BlockInfo { if(cachedTint == tint) return cachedMultiplier; cachedTint = tint; - cachedMultiplier = colors.getColor(state, world, blockPos, tint); + cachedMultiplier = colors.func_228054_a_(state, world, blockPos, tint); return cachedMultiplier; } @@ -75,7 +75,7 @@ public class BlockInfo shz = (float) offset.z; } - public void setWorld(IEnviromentBlockReader world) + public void setWorld(ILightReader world) { this.world = world; cachedTint = -1; @@ -127,7 +127,7 @@ public class BlockInfo BlockPos pos = blockPos.add(x - 1, y - 1, z - 1); BlockState state = world.getBlockState(pos); t[x][y][z] = state.getOpacity(world, pos) < 15; - int brightness = state.getPackedLightmapCoords(world, pos); + int brightness = 0x00FF00FF; // FIXME: state.getPackedLightmapCoords(world, pos); s[x][y][z] = (brightness >> 0x14) & 0xF; b[x][y][z] = (brightness >> 0x04) & 0xF; ao[x][y][z] = state.func_215703_d(world, pos); @@ -195,16 +195,16 @@ public class BlockInfo public void updateFlatLighting() { full = Block.isOpaque(state.getCollisionShape(world, blockPos)); - packed[0] = state.getPackedLightmapCoords(world, blockPos); + packed[0] = 0x00FF00FF; // FIXME: state.getPackedLightmapCoords(world, blockPos); for (Direction side : SIDES) { int i = side.ordinal() + 1; - packed[i] = state.getPackedLightmapCoords(world, blockPos.offset(side)); + packed[i] = 0x00FF00FF; // FIXME: state.getPackedLightmapCoords(world, blockPos.offset(side)); } } - public IEnviromentBlockReader getWorld() + public ILightReader 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 8801d703d..9d336ae08 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java @@ -22,19 +22,21 @@ package net.minecraftforge.client.model.pipeline; import java.util.List; import java.util.Random; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.BlockModelRenderer; -import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.model.BakedQuad; 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.IEnviromentBlockReader; +import net.minecraft.world.ILightReader; import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.common.ForgeConfig; +/* public class ForgeBlockModelRenderer extends BlockModelRenderer { private final ThreadLocal lighterFlat; @@ -50,7 +52,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } @Override - public boolean renderModelFlat(IEnviromentBlockReader world, IBakedModel model, BlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, Random rand, long seed, IModelData modelData) + public boolean renderModelFlat(ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int p_228806_11_, IModelData modelData) { if(ForgeConfig.CLIENT.forgeLightPipelineEnabled.get()) { @@ -61,16 +63,16 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer VertexLighterFlat lighter = lighterFlat.get(); lighter.setParent(consumer); - return render(lighter, world, model, state, pos, buffer, checkSides, rand, seed, modelData); + return render(lighter, world, model, state, pos, checkSides, rand, seed, modelData); } else { - return super.renderModelFlat(world, model, state, pos, buffer, checkSides, rand, seed, modelData); + return super.renderModelFlat(world, model, state, pos, matrixStack, buffer, checkSides, rand, seed, p_228806_11_, modelData); } } @Override - public boolean renderModelSmooth(IEnviromentBlockReader world, IBakedModel model, BlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, Random rand, long seed, IModelData modelData) + public boolean renderModelSmooth(ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int p_228805_11_, IModelData modelData) { if(ForgeConfig.CLIENT.forgeLightPipelineEnabled.get()) { @@ -81,15 +83,15 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer VertexLighterSmoothAo lighter = lighterSmooth.get(); lighter.setParent(consumer); - return render(lighter, world, model, state, pos, buffer, checkSides, rand, seed, modelData); + return render(lighter, world, model, state, pos, checkSides, rand, seed, modelData); } else { - return super.renderModelSmooth(world, model, state, pos, buffer, checkSides, rand, seed, modelData); + return super.renderModelSmooth(world, model, state, pos, matrixStack, buffer, checkSides, rand, seed, p_228805_11_, modelData); } } - public static boolean render(VertexLighterFlat lighter, IEnviromentBlockReader world, IBakedModel model, BlockState state, BlockPos pos, BufferBuilder wr, boolean checkSides, Random rand, long seed, IModelData modelData) + public static boolean render(VertexLighterFlat lighter, ILightReader world, IBakedModel model, BlockState state, BlockPos pos, boolean checkSides, Random rand, long seed, IModelData modelData) { lighter.setWorld(world); lighter.setState(state); @@ -127,3 +129,4 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer return !empty; } } +*/ \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java index 38713917b..9afc30440 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/IVertexConsumer.java @@ -24,8 +24,8 @@ import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.util.Direction; /** - * Assumes that the data length is not less than e.getElementCount(). - * Also assumes that element index passed will increment from 0 to format.getElementCount() - 1. + * Assumes that the data length is not less than e.func_227894_c_().size(). + * Also assumes that element index passed will increment from 0 to format.func_227894_c_().size() - 1. * Normal, Color and UV are assumed to be in 0-1 range. */ public interface IVertexConsumer 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 34a83dad9..c911e91da 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -19,19 +19,23 @@ package net.minecraftforge.client.model.pipeline; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +import org.apache.commons.lang3.tuple.Pair; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.IVertexBuilder; + import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.client.renderer.vertex.VertexFormatElement.Usage; import net.minecraft.util.Direction; import net.minecraftforge.client.ForgeHooksClient; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; public class LightUtil { @@ -100,8 +104,8 @@ public class LightUtil float[] data = new float[4]; VertexFormat formatFrom = consumer.getVertexFormat(); VertexFormat formatTo = quad.getFormat(); - int countFrom = formatFrom.getElementCount(); - int countTo = formatTo.getElementCount(); + int countFrom = formatFrom.func_227894_c_().size(); + int countTo = formatTo.func_227894_c_().size(); int[] eMap = mapFormats(formatFrom, formatTo); for(int v = 0; v < 4; v++) { @@ -120,8 +124,9 @@ public class LightUtil } } + // TODO: probably useless now, remove? private static final VertexFormat DEFAULT_FROM = VertexLighterFlat.withNormal(DefaultVertexFormats.BLOCK); - private static final VertexFormat DEFAULT_TO = DefaultVertexFormats.ITEM; + private static final VertexFormat DEFAULT_TO = DefaultVertexFormats.BLOCK; private static final int[] DEFAULT_MAPPING = generateMapping(DEFAULT_FROM, DEFAULT_TO); public static int[] mapFormats(VertexFormat from, VertexFormat to) { @@ -133,17 +138,17 @@ public class LightUtil private static int[] generateMapping(VertexFormat from, VertexFormat to) { - int fromCount = from.getElementCount(); - int toCount = to.getElementCount(); + int fromCount = from.func_227894_c_().size(); + int toCount = to.func_227894_c_().size(); int[] eMap = new int[fromCount]; for(int e = 0; e < fromCount; e++) { - VertexFormatElement expected = from.getElement(e); + VertexFormatElement expected = from.func_227894_c_().get(e); int e2; for(e2 = 0; e2 < toCount; e2++) { - VertexFormatElement current = to.getElement(e2); + VertexFormatElement current = to.func_227894_c_().get(e2); if(expected.getUsage() == current.getUsage() && expected.getIndex() == current.getIndex()) { break; @@ -157,7 +162,7 @@ public class LightUtil public static void unpack(int[] from, float[] to, VertexFormat formatFrom, int v, int e) { int length = 4 < to.length ? 4 : to.length; - VertexFormatElement element = formatFrom.getElement(e); + VertexFormatElement element = formatFrom.func_227894_c_().get(e); int vertexStart = v * formatFrom.getSize() + formatFrom.getOffset(e); int count = element.getElementCount(); VertexFormatElement.Type type = element.getType(); @@ -211,7 +216,7 @@ public class LightUtil public static void pack(float[] from, int[] to, VertexFormat formatTo, int v, int e) { - VertexFormatElement element = formatTo.getElement(e); + VertexFormatElement element = formatTo.func_227894_c_().get(e); int vertexStart = v * formatTo.getSize() + formatTo.getOffset(e); int count = element.getElementCount(); VertexFormatElement.Type type = element.getType(); @@ -288,36 +293,27 @@ public class LightUtil private static final ThreadLocal itemPipeline = ThreadLocal.withInitial(ItemPipeline::new); // renders quad in any Vertex Format, but is slower - public static void renderQuadColorSlow(BufferBuilder buffer, BakedQuad quad, int auxColor) + /*public static void renderQuadColorSlow(IVertexBuilder buffer, BakedQuad quad, float r, float g, float b, float a) { ItemPipeline pipeline = itemPipeline.get(); pipeline.bufferConsumer.setBuffer(buffer); ItemConsumer cons = pipeline.itemConsumer; - float b = (float)( auxColor & 0xFF) / 0xFF; - float g = (float)((auxColor >>> 8) & 0xFF) / 0xFF; - float r = (float)((auxColor >>> 16) & 0xFF) / 0xFF; - float a = (float)((auxColor >>> 24) & 0xFF) / 0xFF; - cons.setAuxColor(r, g, b, a); quad.pipe(cons); } - public static void renderQuadColor(BufferBuilder buffer, BakedQuad quad, int auxColor) + public static void renderQuadColor(IVertexBuilder builder, MatrixStack.Entry entry, BakedQuad quad, float r, float g, float b, float a, int light, int overlaylight) { - if (quad.getFormat().equals(buffer.getVertexFormat())) + if (quad.getFormat().equals(DefaultVertexFormats.BLOCK)) { - buffer.addVertexData(quad.getVertexData()); - if (buffer.getVertexFormat().hasColor()) - { - ForgeHooksClient.putQuadColor(buffer, quad, auxColor); - } + builder.addVertexData(entry, quad, r, g, b, a, light, overlaylight); } else { - renderQuadColorSlow(buffer, quad, auxColor); + renderQuadColorSlow(builder, quad, r, g, b, a); } - } + }*/ public static class ItemConsumer extends VertexTransformer { @@ -339,7 +335,7 @@ public class LightUtil @Override public void put(int element, float... data) { - if(getVertexFormat().getElement(element).getUsage() == Usage.COLOR) + if(getVertexFormat().func_227894_c_().get(element).getUsage() == Usage.COLOR) { System.arraycopy(auxColor, 0, buf, 0, buf.length); int n = Math.min(4, data.length); @@ -353,7 +349,7 @@ public class LightUtil { super.put(element, data); } - if(element == getVertexFormat().getElementCount() - 1) + if(element == getVertexFormat().func_227894_c_().size() - 1) { vertices++; if(vertices == 4) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/QuadGatheringTransformer.java b/src/main/java/net/minecraftforge/client/model/pipeline/QuadGatheringTransformer.java index f54a71ba9..875bd41f8 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/QuadGatheringTransformer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/QuadGatheringTransformer.java @@ -38,8 +38,8 @@ public abstract class QuadGatheringTransformer implements IVertexConsumer public void setVertexFormat(VertexFormat format) { this.format = format; - dataLength = new byte[format.getElementCount()]; - quadData = new float[format.getElementCount()][4][4]; + dataLength = new byte[format.func_227894_c_().size()]; + quadData = new float[format.func_227894_c_().size()][4][4]; } @Override @@ -56,7 +56,7 @@ public abstract class QuadGatheringTransformer implements IVertexConsumer { dataLength[element] = (byte)data.length; } - if (element == getVertexFormat().getElementCount() - 1) + if (element == getVertexFormat().func_227894_c_().size() - 1) { vertices++; } 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 3a8cd3ec8..30f1a4b73 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/TRSRTransformer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/TRSRTransformer.java @@ -19,16 +19,16 @@ package net.minecraftforge.client.model.pipeline; -import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.client.renderer.Vector4f; import javax.vecmath.Vector3f; -import javax.vecmath.Vector4f; public class TRSRTransformer extends VertexTransformer { - private final TRSRTransformation transform; + private final TransformationMatrix transform; - public TRSRTransformer(IVertexConsumer parent, TRSRTransformation transform) + public TRSRTransformer(IVertexConsumer parent, TransformationMatrix transform) { super(parent); this.transform = transform; @@ -37,12 +37,12 @@ public class TRSRTransformer extends VertexTransformer @Override public void put(int element, float... data) { - switch (getVertexFormat().getElement(element).getUsage()) + switch (getVertexFormat().func_227894_c_().get(element).getUsage()) { case POSITION: Vector4f pos = new Vector4f(data); transform.transformPosition(pos); - pos.get(data); + pos.write(data); break; case NORMAL: Vector3f normal = new Vector3f(data); diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java index d71f603ae..c3725fdbd 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java @@ -19,6 +19,7 @@ package net.minecraftforge.client.model.pipeline; +import com.google.common.collect.ImmutableList; import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; @@ -48,7 +49,7 @@ public class UnpackedBakedQuad extends BakedQuad packed = true; for(int v = 0; v < 4; v++) { - for(int e = 0; e < format.getElementCount(); e++) + for(int e = 0; e < format.func_227894_c_().size(); e++) { LightUtil.pack(unpackedData[v][e], vertexData, format, v, e); } @@ -57,7 +58,7 @@ public class UnpackedBakedQuad extends BakedQuad return vertexData; } - @Override + //@Override public void pipe(IVertexConsumer consumer) { int[] eMap = LightUtil.mapFormats(consumer.getVertexFormat(), format); @@ -71,9 +72,9 @@ public class UnpackedBakedQuad extends BakedQuad consumer.setQuadOrientation(getFace()); for(int v = 0; v < 4; v++) { - for(int e = 0; e < consumer.getVertexFormat().getElementCount(); e++) + for(int e = 0; e < consumer.getVertexFormat().func_227894_c_().size(); e++) { - if(eMap[e] != format.getElementCount()) + if(eMap[e] != format.func_227894_c_().size()) { consumer.put(e, unpackedData[v][eMap[e]]); } @@ -102,7 +103,7 @@ public class UnpackedBakedQuad extends BakedQuad public Builder(VertexFormat format) { this.format = format; - unpackedData = new float[4][format.getElementCount()][4]; + unpackedData = new float[4][format.func_227894_c_().size()][4]; } @Override @@ -155,7 +156,7 @@ public class UnpackedBakedQuad extends BakedQuad } } elements++; - if(elements == format.getElementCount()) + if(elements == format.func_227894_c_().size()) { vertices++; elements = 0; @@ -185,16 +186,17 @@ public class UnpackedBakedQuad extends BakedQuad float tS = tX > tY ? tX : tY; float ep = 1f / (tS * 0x100); int uve = 0; - while(uve < format.getElementCount()) + ImmutableList elements = format.func_227894_c_(); + while(uve < elements.size()) { - VertexFormatElement e = format.getElement(uve); + VertexFormatElement e = elements.get(uve); if(e.getUsage() == VertexFormatElement.Usage.UV && e.getIndex() == 0) { break; } uve++; } - if(uve == format.getElementCount()) + if(uve == elements.size()) { throw new IllegalStateException("Can't contract UVs: format doesn't contain UVs"); } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java index a5b6bfac1..db90b402e 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java @@ -19,8 +19,10 @@ package net.minecraftforge.client.model.pipeline; +import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement.Usage; import net.minecraft.util.math.BlockPos; @@ -33,14 +35,14 @@ public class VertexBufferConsumer implements IVertexConsumer { private static final float[] dummyColor = new float[]{ 1, 1, 1, 1 }; - private BufferBuilder renderer; + private IVertexBuilder renderer; private int[] quadData; private int v = 0; private BlockPos offset = BlockPos.ZERO; public VertexBufferConsumer() {} - public VertexBufferConsumer(BufferBuilder buffer) + public VertexBufferConsumer(IVertexBuilder buffer) { setBuffer(buffer); } @@ -48,19 +50,21 @@ public class VertexBufferConsumer implements IVertexConsumer @Override public VertexFormat getVertexFormat() { - return renderer.getVertexFormat(); + return DefaultVertexFormats.BLOCK; // renderer.getVertexFormat(); } @Override public void put(int e, float... data) { + // TODO + /* VertexFormat format = getVertexFormat(); - if(renderer.isColorDisabled() && format.getElement(e).getUsage() == Usage.COLOR) + if(renderer.isColorDisabled() && format.func_227894_c_().get(e).getUsage() == Usage.COLOR) { data = dummyColor; } LightUtil.pack(data, quadData, format, v, e); - if(e == format.getElementCount() - 1) + if(e == format.func_227894_c_().size() - 1) { v++; if(v == 4) @@ -71,17 +75,18 @@ public class VertexBufferConsumer implements IVertexConsumer v = 0; } } + */ } private void checkVertexFormat() { - if (quadData == null || renderer.getVertexFormat().getSize() != quadData.length) + if (quadData == null || getVertexFormat().getSize() != quadData.length) { - quadData = new int[renderer.getVertexFormat().getSize()]; + quadData = new int[getVertexFormat().getSize()]; } } - public void setBuffer(BufferBuilder buffer) + public void setBuffer(IVertexBuilder buffer) { this.renderer = buffer; checkVertexFormat(); 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 334d1b83a..fd7217d11 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -21,6 +21,8 @@ package net.minecraftforge.client.model.pipeline; import javax.vecmath.Vector3f; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.color.BlockColors; @@ -30,9 +32,10 @@ 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.IEnviromentBlockReader; +import net.minecraft.world.ILightReader; import net.minecraft.world.IWorldReader; +import java.util.List; import java.util.Objects; public class VertexLighterFlat extends QuadGatheringTransformer @@ -64,9 +67,9 @@ public class VertexLighterFlat extends QuadGatheringTransformer private void updateIndices() { - for(int i = 0; i < getVertexFormat().getElementCount(); i++) + for(int i = 0; i < getVertexFormat().func_227894_c_().size(); i++) { - switch(getVertexFormat().getElement(i).getUsage()) + switch(getVertexFormat().func_227894_c_().get(i).getUsage()) { case POSITION: posIndex = i; @@ -78,7 +81,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer colorIndex = i; break; case UV: - if(getVertexFormat().getElement(i).getIndex() == 1) + if(getVertexFormat().func_227894_c_().get(i).getIndex() == 2) { lightmapIndex = i; } @@ -109,19 +112,21 @@ public class VertexLighterFlat extends QuadGatheringTransformer updateIndices(); } - private static final VertexFormat BLOCK_WITH_NORMAL = withNormalUncached(DefaultVertexFormats.BLOCK); static VertexFormat withNormal(VertexFormat format) { //This is the case in 99.99%. Cache the value, so we don't have to redo it every time, and the speed up the equals check in LightUtil if (format == DefaultVertexFormats.BLOCK) - return BLOCK_WITH_NORMAL; + return DefaultVertexFormats.BLOCK; return withNormalUncached(format); } private static VertexFormat withNormalUncached(VertexFormat format) { - if (format == null || format.hasNormal()) return format; - return new VertexFormat(format).addElement(NORMAL_4F); + if (format == null || format.hasNormal()) + return format; + List l = Lists.newArrayList(format.func_227894_c_()); + l.add(NORMAL_4F); + return new VertexFormat(ImmutableList.copyOf(l)); } @Override @@ -166,7 +171,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer } VertexFormat format = parent.getVertexFormat(); - int count = format.getElementCount(); + int count = format.func_227894_c_().size(); for(int v = 0; v < 4; v++) { @@ -205,7 +210,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer // no need for remapping cause all we could've done is add 1 element to the end for(int e = 0; e < count; e++) { - VertexFormatElement element = format.getElement(e); + VertexFormatElement element = format.func_227894_c_().get(e); switch(element.getUsage()) { case POSITION: @@ -286,7 +291,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer this.diffuse = diffuse; } - public void setWorld(IEnviromentBlockReader world) + public void setWorld(ILightReader world) { blockInfo.setWorld(world); } diff --git a/src/main/java/net/minecraftforge/common/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index 3e3b3dc12..d6c7e06d8 100644 --- a/src/main/java/net/minecraftforge/common/DimensionManager.java +++ b/src/main/java/net/minecraftforge/common/DimensionManager.java @@ -52,10 +52,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.registry.MutableRegistry; import net.minecraft.world.World; +import net.minecraft.world.biome.IBiomeMagnifier; import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.chunk.listener.IChunkStatusListener; +import net.minecraft.world.server.ServerMultiWorld; import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.ServerMultiWorld; import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.event.world.RegisterDimensionsEvent; import net.minecraftforge.event.world.WorldEvent; @@ -96,6 +97,7 @@ public class DimensionManager * @param type ModDimension type data * @param data Extra data for the ModDimension * @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) { @@ -111,6 +113,7 @@ public class DimensionManager * @param type Dimension Type. * @param data Configuration data for this dimension, passed into * @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) @@ -129,7 +132,7 @@ public class DimensionManager savedEntries.remove(name); } @SuppressWarnings("deprecation") - DimensionType instance = new DimensionType(id, "", name.getNamespace() + "/" + name.getPath(), type.getFactory(), hasSkyLight, type, data); + DimensionType instance = new DimensionType(id, "", name.getNamespace() + "/" + name.getPath(), type.getFactory(), hasSkyLight, type.getMagnifier(), type, data); REGISTRY.register(id, name, instance); LOGGER.info(DIMMGR, "Registered dimension {} of type {} and id {}", name.toString(), type.getRegistryName().toString(), id); return instance; @@ -214,7 +217,7 @@ public class DimensionManager Validate.isTrue(REGISTRY.getByValue(id) == null, "Dimension with id " + id + " already registered as name " + REGISTRY.getKey(REGISTRY.getByValue(id))); @SuppressWarnings("deprecation") - DimensionType instance = new DimensionType(id, "", name.getNamespace() + "/" + name.getPath(), type.getFactory(), hasSkyLight, type, data); + DimensionType instance = new DimensionType(id, "", name.getNamespace() + "/" + name.getPath(), type.getFactory(), hasSkyLight, type.getMagnifier(), type, data); REGISTRY.register(id, name, instance); LOGGER.info(DIMMGR, "Registered dimension {} of type {} and id {}", name.toString(), type.getRegistryName().toString(), id); return instance; diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index e09b3903b..bcff28a1c 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -46,6 +46,8 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.minecraft.advancements.Advancement; import net.minecraft.block.Block; +import net.minecraft.client.renderer.model.Material; +import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.fluid.*; import net.minecraft.util.CachedBlockInfo; import net.minecraft.block.BlockState; @@ -744,7 +746,7 @@ public class ForgeHooks public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, RayTraceResult ray, Hand hand) { - Vec3d vec3d = new Vec3d(ray.getHitVec().x - entity.posX, ray.getHitVec().y - entity.posY, ray.getHitVec().z - entity.posZ); + Vec3d vec3d = ray.getHitVec().subtract(entity.getPositionVec()); return onInteractEntityAt(player, entity, vec3d, hand); } @@ -844,15 +846,15 @@ public class ForgeHooks .color(0).density(0).temperature(0).luminosity(0).viscosity(0).build(fluid); if (fluid instanceof WaterFluid) return net.minecraftforge.fluids.FluidAttributes.Water.builder( - new net.minecraft.util.ResourceLocation("block/water_still"), - new net.minecraft.util.ResourceLocation("block/water_flow")) - .overlay(new net.minecraft.util.ResourceLocation("block/water_overlay")) + new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("block/water_still")), + new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("block/water_flow"))) + .overlay(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("block/water_overlay"))) .translationKey("block.minecraft.water") .color(0xFF3F76E4).build(fluid); if (fluid instanceof LavaFluid) return net.minecraftforge.fluids.FluidAttributes.builder( - new net.minecraft.util.ResourceLocation("block/lava_still"), - new net.minecraft.util.ResourceLocation("block/lava_flow")) + new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("block/lava_still")), + new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("block/lava_flow"))) .translationKey("block.minecraft.lava") .luminosity(15).density(3000).viscosity(6000).temperature(1300).build(fluid); throw new RuntimeException("Mod fluids must override createAttributes."); diff --git a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java index e4bd7a393..a46634565 100644 --- a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java +++ b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java @@ -25,7 +25,6 @@ import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.server.ServerWorld; -import net.minecraftforge.client.CloudRenderer; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.player.PlayerEvent; @@ -79,8 +78,8 @@ public class ForgeInternalHandler @SubscribeEvent public void checkSettings(ClientTickEvent event) { - if (event.phase == Phase.END) - CloudRenderer.updateCloudSettings(); + //if (event.phase == Phase.END) + // CloudRenderer.updateCloudSettings(); } @SubscribeEvent diff --git a/src/main/java/net/minecraftforge/common/ModDimension.java b/src/main/java/net/minecraftforge/common/ModDimension.java index 323fa68c6..519fbe7dd 100644 --- a/src/main/java/net/minecraftforge/common/ModDimension.java +++ b/src/main/java/net/minecraftforge/common/ModDimension.java @@ -23,6 +23,8 @@ import java.util.function.BiFunction; import net.minecraft.network.PacketBuffer; import net.minecraft.world.World; +import net.minecraft.world.biome.ColumnFuzzedBiomeMagnifier; +import net.minecraft.world.biome.IBiomeMagnifier; import net.minecraft.world.dimension.Dimension; import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.registries.ForgeRegistryEntry; @@ -55,6 +57,10 @@ public abstract class ModDimension extends ForgeRegistryEntry */ public void read(PacketBuffer buffer, boolean network){} + public IBiomeMagnifier getMagnifier() { + return ColumnFuzzedBiomeMagnifier.INSTANCE; + } + /** * Convenience method for generating a ModDimension with a specific factory but no extra * data handling behaviour. Extend ModDimension to override other methods. diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java index 51cfddb2a..6c7fdbcfd 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java @@ -57,7 +57,7 @@ public class ForgeBlockTagsProvider extends BlockTagsProvider 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.COARSE_DIRT, Blocks.PODZOL); + 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); diff --git a/src/main/java/net/minecraftforge/common/data/LanguageProvider.java b/src/main/java/net/minecraftforge/common/data/LanguageProvider.java index 18a4778e3..cbd098c5a 100644 --- a/src/main/java/net/minecraftforge/common/data/LanguageProvider.java +++ b/src/main/java/net/minecraftforge/common/data/LanguageProvider.java @@ -16,6 +16,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + package net.minecraftforge.common.data; import java.io.BufferedWriter; diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java index 110e5ac75..e759f92ce 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java @@ -61,7 +61,6 @@ import net.minecraft.state.IProperty; import net.minecraft.state.properties.BedPart; import net.minecraft.tags.BlockTags; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.ResourceLocation; @@ -71,7 +70,7 @@ 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.IEnviromentBlockReader; +import net.minecraft.world.ILightReader; import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldWriter; @@ -118,7 +117,7 @@ public interface IForgeBlock * @param pos * @return The light value */ - default int getLightValue(BlockState state, IEnviromentBlockReader world, BlockPos pos) + default int getLightValue(BlockState state, ILightReader world, BlockPos pos) { return state.getLightValue(); } @@ -152,7 +151,7 @@ public interface IForgeBlock * @deprecated This is no longer used for rendering logic. */ @Deprecated - default boolean doesSideBlockRendering(BlockState state, IEnviromentBlockReader world, BlockPos pos, Direction face) + default boolean doesSideBlockRendering(BlockState state, ILightReader world, BlockPos pos, Direction face) { return state.isOpaqueCube(world, pos); } @@ -383,7 +382,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 || Block.isDirt(getBlock()) + return (isAir(state, world, pos) || state.isIn(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT) || getBlock().isIn(BlockTags.LOGS) || getBlock().isIn(BlockTags.SAPLINGS) || this == Blocks.VINE; } @@ -559,7 +558,7 @@ public interface IForgeBlock */ default void onPlantGrow(BlockState state, IWorld world, BlockPos pos, BlockPos source) { - if (Block.isDirt(getBlock())) + if (state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT)) world.setBlockState(pos, Blocks.DIRT.getDefaultState(), 2); } @@ -751,15 +750,6 @@ public interface IForgeBlock return state; } - /** - * Queries if this block should render in a given layer. - * A custom {@link IBakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer. - */ - default boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) - { - return this.getBlock().getRenderLayer() == layer; - } - /** * Sensitive version of getSoundType * @param state The state @@ -881,7 +871,16 @@ public interface IForgeBlock @Nullable default PathNodeType getAiPathNodeType(BlockState state, IBlockReader world, BlockPos pos, @Nullable MobEntity entity) { - return state.isBurning(world, pos) ? PathNodeType.DAMAGE_FIRE : null; + return state.isBurning(world, pos) ? PathNodeType.DANGER_FIRE : null; + } + + /** + * @param state The state + * @return true if the block is sticky block which used for pull or push adjacent blocks (use by piston) + */ + default boolean isSlimeBlock(BlockState state) + { + return state.getBlock() == Blocks.SLIME_BLOCK; } /** @@ -890,7 +889,20 @@ public interface IForgeBlock */ default boolean isStickyBlock(BlockState state) { - return state.getBlock() == Blocks.SLIME_BLOCK; + return state.getBlock() == Blocks.SLIME_BLOCK || state.getBlock() == Blocks.field_226907_mc_; + } + + /** + * Determines if this block can stick to another block when pushed by a piston. + * @param state My state + * @param other Other block + * @return True to link blocks + */ + default boolean canStickTo(BlockState state, BlockState other) + { + if (state.getBlock() == Blocks.field_226907_mc_ && other.getBlock() == Blocks.SLIME_BLOCK) return false; + if (state.getBlock() == Blocks.SLIME_BLOCK && other.getBlock() == Blocks.field_226907_mc_) return false; + return state.isStickyBlock() || other.isStickyBlock(); } /** diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java index 56ab58eeb..399cd05f3 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java @@ -45,7 +45,7 @@ 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.IEnviromentBlockReader; +import net.minecraft.world.ILightReader; import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; @@ -84,7 +84,7 @@ public interface IForgeBlockState /** * Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15 */ - default int getLightValue(IEnviromentBlockReader world, BlockPos pos) + default int getLightValue(ILightReader world, BlockPos pos) { return getBlockState().getBlock().getLightValue(getBlockState(), world, pos); } @@ -116,7 +116,7 @@ public interface IForgeBlockState * @deprecated This is no longer used for rendering logic. */ @Deprecated - default boolean doesSideBlockRendering(IEnviromentBlockReader world, BlockPos pos, Direction face) + default boolean doesSideBlockRendering(ILightReader world, BlockPos pos, Direction face) { return getBlockState().getBlock().doesSideBlockRendering(getBlockState(), world, pos, face); } @@ -632,23 +632,6 @@ public interface IForgeBlockState return getBlockState().getBlock().isToolEffective(getBlockState(), tool); } - /** - * Can return IExtendedBlockState - */ - default BlockState getExtendedState(IBlockReader world, BlockPos pos) - { - return getBlockState().getBlock().getExtendedState(getBlockState(), world, pos); - } - - /** - * Queries if this blockstate should render in a given layer. - * A custom {@link IBakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer. - */ - default boolean canRenderInLayer(BlockRenderLayer layer) - { - return getBlockState().getBlock().canRenderInLayer(getBlockState(), layer); - } - /** * Sensitive version of getSoundType * @param world The world @@ -735,6 +718,15 @@ public interface IForgeBlockState return getBlockState().getBlock().canBeConnectedTo(getBlockState(), world, pos, facing); } + /** + * @param state The state + * @return true if the block is sticky block which used for pull or push adjacent blocks (use by piston) + */ + default boolean isSlimeBlock() + { + return getBlockState().getBlock().isSlimeBlock(getBlockState()); + } + /** * @param state The state * @return true if the block is sticky block which used for pull or push adjacent blocks (use by piston) @@ -744,6 +736,16 @@ public interface IForgeBlockState return getBlockState().getBlock().isStickyBlock(getBlockState()); } + /** + * Determines if this block can stick to another block when pushed by a piston. + * @param other Other block + * @return True to link blocks + */ + default boolean canStickTo(BlockState other) + { + return getBlockState().getBlock().canStickTo(getBlockState(), other); + } + /** * Chance that fire will spread and consume this block. * 300 being a 100% chance, 0, being a 0% chance. @@ -851,6 +853,17 @@ public interface IForgeBlockState return getBlockState().getBlock().isBurning(getBlockState(), world, pos); } + /** + * Get the {@code PathNodeType} for this block. Return {@code null} for vanilla behavior. + * + * @return the PathNodeType + */ + @Nullable + default PathNodeType getAiPathNodeType(IBlockReader world, BlockPos pos) + { + return getAiPathNodeType(world, pos, null); + } + /** * Get the {@code PathNodeType} for this block. Return {@code null} for vanilla behavior. * diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java b/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java index 26c8e6582..88bc65890 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java @@ -22,12 +22,14 @@ package net.minecraftforge.common.extensions; import javax.annotation.Nullable; import net.minecraft.client.audio.MusicTicker; +import net.minecraft.client.renderer.Vector3f; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.Biomes; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.dimension.Dimension; import net.minecraft.world.dimension.DimensionType; @@ -114,7 +116,7 @@ public interface IForgeDimension * * @see net.minecraft.client.renderer.GameRenderer#updateLightmap(float) */ - default void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, float[] colors) {} + default void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, Vector3f colors) {} void resetRainAndThunder(); @@ -149,7 +151,7 @@ public interface IForgeDimension */ default SleepResult canSleepAt(net.minecraft.entity.player.PlayerEntity player, BlockPos pos) { - return (getDimension().canRespawnHere() && getWorld().getBiome(pos) != net.minecraft.world.biome.Biomes.NETHER) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES; + return (getDimension().canRespawnHere() && getWorld().func_226691_t_(pos) != Biomes.NETHER) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES; } enum SleepResult @@ -159,39 +161,9 @@ public interface IForgeDimension BED_EXPLODES; } - default Biome getBiome(BlockPos pos) - { - return getWorld().getBiomeBody(pos); - } - default boolean isDaytime() { - return getWorld().getSkylightSubtracted() < 4; - } - - /** - * The current sun brightness factor for this dimension. - * 0.0f means no light at all, and 1.0f means maximum sunlight. - * This will be used for the "calculateSkylightSubtracted" - * which is for Sky light value calculation. - * - * @return The current brightness factor - **/ - default float getSunBrightness(float partialTicks) - { - return getWorld().getSunBrightnessBody(partialTicks); - } - - @OnlyIn(Dist.CLIENT) - default Vec3d getSkyColor(BlockPos cameraPos, float partialTicks) - { - return getWorld().getSkyColorBody(cameraPos, partialTicks); - } - - @OnlyIn(Dist.CLIENT) - default Vec3d getCloudColor(float partialTicks) - { - return getWorld().getCloudColorBody(partialTicks); + return getDimension().getType() == DimensionType.OVERWORLD && getWorld().getSkylightSubtracted() < 4; } /** @@ -204,15 +176,6 @@ public interface IForgeDimension return Dimension.MOON_PHASE_FACTORS[this.getDimension().getMoonPhase(time)]; } - /** - * Gets the Star Brightness for rendering sky. - * */ - @OnlyIn(Dist.CLIENT) - default float getStarBrightness(float partialTicks) - { - return getWorld().getStarBrightnessBody(partialTicks); - } - default void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) { } default void calculateInitialWeather() @@ -258,7 +221,7 @@ public interface IForgeDimension default boolean isHighHumidity(BlockPos pos) { - return getWorld().getBiome(pos).isHighHumidity(); + return getWorld().func_226691_t_(pos).isHighHumidity(); } default int getHeight() @@ -271,11 +234,6 @@ public interface IForgeDimension return getDimension().isNether() ? 128 : 256; } - default double getHorizon() - { - return getWorld().getWorldInfo().getGenerator().getHorizon(getWorld()); - } - default int getSeaLevel() { return 63; diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeEffectInstance.java b/src/main/java/net/minecraftforge/common/extensions/IForgeEffectInstance.java index 210dd5987..b680673ea 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeEffectInstance.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeEffectInstance.java @@ -21,11 +21,15 @@ package net.minecraftforge.common.extensions; import java.util.List; +import net.minecraft.client.gui.AbstractGui; +import net.minecraft.client.gui.DisplayEffectsScreen; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Potion; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public interface IForgeEffectInstance { @@ -33,6 +37,59 @@ public interface IForgeEffectInstance { return (EffectInstance)this; } + /** + * If the Potion effect should be displayed in the players inventory + * @return true to display it (default), false to hide it. + */ + default boolean shouldRender() { + return getEffectInstance().getPotion().shouldRender(getEffectInstance()); + } + + /** + * If the standard PotionEffect text (name and duration) should be drawn when this potion is active. + * @return true to draw the standard text + */ + default boolean shouldRenderInvText() { + return getEffectInstance().getPotion().shouldRenderInvText(getEffectInstance()); + } + + /** + * If the Potion effect should be displayed in the player's ingame HUD + * @return true to display it (default), false to hide it. + */ + default boolean shouldRenderHUD() { + return getEffectInstance().getPotion().shouldRenderHUD(getEffectInstance()); + } + + /** + * Called to draw the this Potion onto the player's inventory when it's active. + * This can be used to e.g. render Potion icons from your own texture. + * + * @param gui the gui instance + * @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); + } + + /** + * 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 gui the gui instance + * @param x the x coordinate + * @param y the y coordinate + * @param z the z level + * @param alpha the alpha value, blinks when the potion is about to run out + */ + @OnlyIn(Dist.CLIENT) + default void renderHUDEffect(AbstractGui gui, int x, int y, float z, float alpha) { + getEffectInstance().getPotion().renderHUDEffect(getEffectInstance(), gui, x, y, z, alpha); + } + /*** * Returns a list of curative items for the potion effect * By default, this list is initialized using {@link Potion#getCurativeItems} diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeEntityMinecart.java b/src/main/java/net/minecraftforge/common/extensions/IForgeEntityMinecart.java index 72b6a08a7..98913eb07 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeEntityMinecart.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeEntityMinecart.java @@ -19,14 +19,12 @@ package net.minecraftforge.common.extensions; -import net.minecraft.entity.MoverType; import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.item.Items; import net.minecraft.item.ItemStack; import net.minecraft.tags.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; import net.minecraftforge.common.IMinecartCollisionHandler; public interface IForgeEntityMinecart @@ -54,9 +52,9 @@ public interface IForgeEntityMinecart */ default BlockPos getCurrentRailPosition() { - int x = MathHelper.floor(getMinecart().posX); - int y = MathHelper.floor(getMinecart().posY); - int z = MathHelper.floor(getMinecart().posZ); + int x = MathHelper.floor(getMinecart().func_226277_ct_()); + int y = MathHelper.floor(getMinecart().func_226278_cu_()); + int z = MathHelper.floor(getMinecart().func_226281_cx_()); BlockPos pos = new BlockPos(x, y - 1, z); if (getMinecart().world.getBlockState(pos).isIn(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 c1e964e00..ed917a257 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java @@ -27,10 +27,8 @@ 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.Fluids; import net.minecraft.fluid.IFluidState; import net.minecraft.tags.Tag; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -109,10 +107,11 @@ public interface IForgeFluid * Queries if this fluid should render in a given layer. * A custom {@link IBakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer. */ + /* TODO: reimplement default boolean canRenderInLayer(IFluidState state, BlockRenderLayer layer) { return this.getFluid().getRenderLayer() == layer; - } + }*/ /** * Retrieves a list of tags names this is known to be associated with. diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java index ea950ea8c..08daf5426 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java @@ -26,7 +26,6 @@ import net.minecraft.entity.Entity; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.IFluidState; import net.minecraft.tags.Tag; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; import net.minecraft.world.IWorldReader; @@ -75,8 +74,9 @@ public interface IForgeFluidState * Queries if this fluidstate should render in a given layer. * A custom {@link IBakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer. */ + /* TODO: reimplement default boolean canRenderInLayer(BlockRenderLayer layer) { return getFluidState().getFluid().canRenderInLayer(getFluidState(), layer); - } + }*/ } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java index b1616b1ec..10d52d99a 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java @@ -660,7 +660,7 @@ public interface IForgeItem */ default boolean canContinueUsing(ItemStack oldStack, ItemStack newStack) { - return oldStack.equals(newStack); + return ItemStack.areItemsEqualIgnoreDurability(oldStack, newStack); } /** diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java index a63625dab..8913a6599 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java @@ -350,6 +350,19 @@ public interface IForgeItemStack extends ICapabilitySerializable return getStack().getItem().onDroppedByPlayer(getStack(), player); } + /** + * Allow the item one last chance to modify its name used for the tool highlight + * useful for adding something extra that can't be removed by a user in the + * displayed name, such as a mode of operation. + * + * @param displayName the name that will be displayed unless it is changed in + * this method. + */ + default String getHighlightTip(String displayName) + { + return getStack().getItem().getHighlightTip(getStack(), displayName); + } + /** * Get the NBT data to be sent to the client. The Item can control what data is kept in the tag. * diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeWorldType.java b/src/main/java/net/minecraftforge/common/extensions/IForgeWorldType.java index 1f573ec3c..c6cb13c43 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeWorldType.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeWorldType.java @@ -119,7 +119,7 @@ public interface IForgeWorldType default > IAreaFactory getBiomeLayer(IAreaFactory parentLayer, OverworldGenSettings chunkSettings, LongFunction contextFactory) { - parentLayer = (new BiomeLayer(getWorldType(), chunkSettings)).apply(contextFactory.apply(200L), parentLayer); + parentLayer = (new BiomeLayer(getWorldType(), chunkSettings.getBiomeId())).apply(contextFactory.apply(200L), parentLayer); parentLayer = AddBambooForestLayer.INSTANCE.apply(contextFactory.apply(1001L), parentLayer); parentLayer = LayerUtil.repeat(1000L, ZoomLayer.NORMAL, parentLayer, 2, contextFactory); parentLayer = EdgeBiomeLayer.INSTANCE.apply(contextFactory.apply(1000L), parentLayer); diff --git a/src/main/java/net/minecraftforge/common/model/HiddenModelPart.java b/src/main/java/net/minecraftforge/common/model/HiddenModelPart.java index a96fcf75b..ce166edc7 100644 --- a/src/main/java/net/minecraftforge/common/model/HiddenModelPart.java +++ b/src/main/java/net/minecraftforge/common/model/HiddenModelPart.java @@ -21,7 +21,7 @@ package net.minecraftforge.common.model; import com.google.common.collect.ImmutableList; -final class HiddenModelPart implements IModelPart +final class HiddenModelPart { private final ImmutableList path; diff --git a/src/main/java/net/minecraftforge/common/model/Models.java b/src/main/java/net/minecraftforge/common/model/Models.java index 1ded4e815..7b3c91e71 100644 --- a/src/main/java/net/minecraftforge/common/model/Models.java +++ b/src/main/java/net/minecraftforge/common/model/Models.java @@ -28,12 +28,12 @@ public enum Models { ; - public static IModelPart getHiddenModelPart(ImmutableList path) + public static Object getHiddenModelPart(ImmutableList path) { return new HiddenModelPart(path); } - public static UnmodifiableIterator getParts(IModelPart part) + public static UnmodifiableIterator getParts(Object part) { if(part instanceof HiddenModelPart) { diff --git a/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java deleted file mode 100644 index 82499aeca..000000000 --- a/src/main/java/net/minecraftforge/common/model/TRSRTransformation.java +++ /dev/null @@ -1,865 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.common.model; - -import java.util.EnumMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -import javax.annotation.Nullable; -import javax.vecmath.AxisAngle4f; -import javax.vecmath.Matrix3f; -import javax.vecmath.Matrix4f; -import javax.vecmath.Quat4f; -import javax.vecmath.SingularMatrixException; -import javax.vecmath.Tuple3f; -import javax.vecmath.Tuple4f; -import javax.vecmath.Vector3f; -import javax.vecmath.Vector4f; - -import net.minecraft.client.renderer.model.ItemTransformVec3f; -import net.minecraft.client.renderer.model.ModelRotation; -import net.minecraft.util.Direction; -import net.minecraft.util.math.Vec3i; -import net.minecraftforge.api.distmarker.Dist; - -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.ForgeHooksClient; - -import org.apache.commons.lang3.tuple.Pair; -import org.apache.commons.lang3.tuple.Triple; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.Maps; - -/* - * Interpolation-friendly affine transformation. - * If created with matrix, should successfully decompose it to a composition - * of easily interpolatable transformations (translation, first rotation, scale - * (with generally speaking different factors for each axis) and second rotation. - * If the input matrix is a composition of translation, rotation and scale (in - * any order), then the interpolation of the derived primitive transformations - * should result in the same transformation as the interpolation of the originals. - * Decomposition happens lazily (and is hopefully fast enough), so performance - * should be comparable to using Matrix4f directly. - * Immutable. - */ -public final class TRSRTransformation implements IModelState, ITransformation -{ - private final Matrix4f matrix; - - private boolean full; - private Vector3f translation; - private Quat4f leftRot; - private Vector3f scale; - private Quat4f rightRot; - - private Matrix3f normalTransform; - - public TRSRTransformation(@Nullable Matrix4f matrix) - { - if(matrix == null) - { - this.matrix = identity.matrix; - } - else - { - this.matrix = matrix; - } - } - - public TRSRTransformation(@Nullable Vector3f translation, @Nullable Quat4f leftRot, @Nullable Vector3f scale, @Nullable Quat4f rightRot) - { - this.matrix = mul(translation, leftRot, scale, rightRot); - this.translation = translation != null ? translation : new Vector3f(); - this.leftRot = leftRot != null ? leftRot : new Quat4f(0, 0, 0, 1); - this.scale = scale != null ? scale : new Vector3f(1, 1, 1); - this.rightRot = rightRot!= null ? rightRot : new Quat4f(0, 0, 0, 1); - full = true; - } - - @Deprecated - @OnlyIn(Dist.CLIENT) - public static TRSRTransformation from(ItemTransformVec3f transform) - { - return transform.equals(ItemTransformVec3f.DEFAULT) ? identity : new TRSRTransformation(toVecmath(transform.translation), quatFromXYZDegrees(toVecmath(transform.rotation)), toVecmath(transform.scale), null); - } - - @OnlyIn(Dist.CLIENT) - public static TRSRTransformation from(ModelRotation rotation) - { - return Cache.get(rotation); - } - - @OnlyIn(Dist.CLIENT) - public static TRSRTransformation from(Direction facing) - { - return Cache.get(getRotation(facing)); - } - - @OnlyIn(Dist.CLIENT) - public static Matrix4f getMatrix(Direction facing) - { - return getRotation(facing).getMatrixVec(); - } - - @OnlyIn(Dist.CLIENT) - public static ModelRotation getRotation(Direction facing) - { - switch (facing) - { - case DOWN: return ModelRotation.X90_Y0; - case UP: return ModelRotation.X270_Y0; - case NORTH: return ModelRotation.X0_Y0; - case SOUTH: return ModelRotation.X0_Y180; - case WEST: return ModelRotation.X0_Y270; - case EAST: return ModelRotation.X0_Y90; - } - throw new IllegalArgumentException(String.valueOf(facing)); - } - - private static final TRSRTransformation identity; - - static - { - Matrix4f m = new Matrix4f(); - m.setIdentity(); - identity = new TRSRTransformation(m); - identity.getLeftRot(); - } - - public static TRSRTransformation identity() - { - return identity; - } - - public TRSRTransformation compose(TRSRTransformation b) - { - if (this.isIdentity()) return b; - if (b.isIdentity()) return this; - Matrix4f m = getMatrixVec(); - m.mul(b.getMatrixVec()); - return new TRSRTransformation(m); - } - - public TRSRTransformation inverse() - { - if (this.isIdentity()) return this; - Matrix4f m = getMatrixVec(); - m.invert(); - return new TRSRTransformation(m); - } - - private void genCheck() - { - if(!full) - { - Pair pair = toAffine(matrix); - Triple triple = svdDecompose(pair.getLeft()); - this.translation = pair.getRight(); - this.leftRot = triple.getLeft(); - this.scale = triple.getMiddle(); - this.rightRot = triple.getRight(); - full = true; - } - } - - public static Quat4f quatFromYXZ(float y, float x, float z) - { - Quat4f ret = new Quat4f(0, 0, 0, 1), t = new Quat4f(); - t.set(0, (float)Math.sin(y/2), 0, (float)Math.cos(y/2)); - ret.mul(t); - t.set((float)Math.sin(x/2), 0, 0, (float)Math.cos(x/2)); - ret.mul(t); - t.set(0, 0, (float)Math.sin(z/2), (float)Math.cos(z/2)); - ret.mul(t); - return ret; - } - - public static Quat4f quatFromXYZDegrees(Vector3f xyz) - { - return quatFromXYZ((float)Math.toRadians(xyz.x), (float)Math.toRadians(xyz.y), (float)Math.toRadians(xyz.z)); - } - - public static Quat4f quatFromXYZ(Vector3f xyz) - { - return quatFromXYZ(xyz.x, xyz.y, xyz.z); - } - - public static Quat4f quatFromXYZ(float x, float y, float z) - { - Quat4f ret = new Quat4f(0, 0, 0, 1), t = new Quat4f(); - t.set((float)Math.sin(x/2), 0, 0, (float)Math.cos(x/2)); - ret.mul(t); - t.set(0, (float)Math.sin(y/2), 0, (float)Math.cos(y/2)); - ret.mul(t); - t.set(0, 0, (float)Math.sin(z/2), (float)Math.cos(z/2)); - ret.mul(t); - return ret; - } - - public static Vector3f toYXZDegrees(Quat4f q) - { - Vector3f yxz = toYXZ(q); - return new Vector3f((float)Math.toDegrees(yxz.x), (float)Math.toDegrees(yxz.y), (float)Math.toDegrees(yxz.z)); - } - - public static Vector3f toYXZ(Quat4f q) - { - float w2 = q.w * q.w; - float x2 = q.x * q.x; - float y2 = q.y * q.y; - float z2 = q.z * q.z; - float l = w2 + x2 + y2 + z2; - float sx = 2 * q.w * q.x - 2 * q.y * q.z; - float x = (float)Math.asin(sx / l); - if(Math.abs(sx) > .999f * l) - { - return new Vector3f( - x, - 2 * (float)Math.atan2(q.y, q.w), - 0 - ); - } - return new Vector3f( - x, - (float)Math.atan2(2 * q.x * q.z + 2 * q.y * q.w, w2 - x2 - y2 + z2), - (float)Math.atan2(2 * q.x * q.y + 2 * q.w * q.z, w2 - x2 + y2 - z2) - ); - } - - public static Vector3f toXYZDegrees(Quat4f q) - { - Vector3f xyz = toXYZ(q); - return new Vector3f((float)Math.toDegrees(xyz.x), (float)Math.toDegrees(xyz.y), (float)Math.toDegrees(xyz.z)); - } - - public static Vector3f toXYZ(Quat4f q) - { - float w2 = q.w * q.w; - float x2 = q.x * q.x; - float y2 = q.y * q.y; - float z2 = q.z * q.z; - float l = w2 + x2 + y2 + z2; - float sy = 2 * q.w * q.x - 2 * q.y * q.z; - float y = (float)Math.asin(sy / l); - if(Math.abs(sy) > .999f * l) - { - return new Vector3f( - 2 * (float)Math.atan2(q.x, q.w), - y, - 0 - ); - } - return new Vector3f( - (float)Math.atan2(2 * q.y * q.z + 2 * q.x * q.w, w2 - x2 - y2 + z2), - y, - (float)Math.atan2(2 * q.x * q.y + 2 * q.w * q.z, w2 + x2 - y2 - z2) - ); - } - - public static Matrix4f mul(@Nullable Vector3f translation, @Nullable Quat4f leftRot, @Nullable Vector3f scale, @Nullable Quat4f rightRot) - { - Matrix4f res = new Matrix4f(), t = new Matrix4f(); - res.setIdentity(); - if(leftRot != null) - { - t.set(leftRot); - res.mul(t); - } - if(scale != null) - { - t.setIdentity(); - t.m00 = scale.x; - t.m11 = scale.y; - t.m22 = scale.z; - res.mul(t); - } - if(rightRot != null) - { - t.set(rightRot); - res.mul(t); - } - if(translation != null) res.setTranslation(translation); - return res; - } - - /* - * Performs SVD decomposition of m, accumulating reflection in the scale (U and V are pure rotations). - */ - public static Triple svdDecompose(Matrix3f m) - { - // determine V by doing 5 steps of Jacobi iteration on MT * M - Quat4f u = new Quat4f(0, 0, 0, 1), v = new Quat4f(0, 0, 0, 1), qt = new Quat4f(); - Matrix3f b = new Matrix3f(m), t = new Matrix3f(); - t.transpose(m); - b.mul(t, b); - - for(int i = 0; i < 5; i++) v.mul(stepJacobi(b)); - - v.normalize(); - t.set(v); - b.set(m); - b.mul(t); - - // FIXME: this doesn't work correctly for some reason; not crucial, so disabling for now; investigate in the future. - //sortSingularValues(b, v); - - Pair p; - - float ul = 1f; - - p = qrGivensQuat(b.m00, b.m10); - qt.set(0, 0, p.getLeft(), p.getRight()); - u.mul(qt); - t.setIdentity(); - t.m00 = qt.w * qt.w - qt.z * qt.z; - t.m11 = t.m00; - t.m10 = -2 * qt.z * qt.w; - t.m01 = -t.m10; - t.m22 = qt.w * qt.w + qt.z * qt.z; - ul *= t.m22; - b.mul(t, b); - - p = qrGivensQuat(b.m00, b.m20); - qt.set(0, -p.getLeft(), 0, p.getRight()); - u.mul(qt); - t.setIdentity(); - t.m00 = qt.w * qt.w - qt.y * qt.y; - t.m22 = t.m00; - t.m20 = 2 * qt.y * qt.w; - t.m02 = -t.m20; - t.m11 = qt.w * qt.w + qt.y * qt.y; - ul *= t.m11; - b.mul(t, b); - - p = qrGivensQuat(b.m11, b.m21); - qt.set(p.getLeft(), 0, 0, p.getRight()); - u.mul(qt); - t.setIdentity(); - t.m11 = qt.w * qt.w - qt.x * qt.x; - t.m22 = t.m11; - t.m21 = -2 * qt.x * qt.w; - t.m12 = -t.m21; - t.m00 = qt.w * qt.w + qt.x * qt.x; - ul *= t.m00; - b.mul(t, b); - - ul = 1f / ul; - u.scale((float)Math.sqrt(ul)); - - Vector3f s = new Vector3f(b.m00 * ul, b.m11 * ul, b.m22 * ul); - - return Triple.of(u, s, v); - } - - private static float rsqrt(float f) - { - float f2 = .5f * f; - int i = Float.floatToIntBits(f); - i = 0x5f3759df - (i >> 1); - f = Float.intBitsToFloat(i); - f *= 1.5f - f2 * f * f; - return f; - } - - private static final float eps = 1e-6f; - private static final float g = 3f + 2f * (float)Math.sqrt(2); - private static final float cs = (float)Math.cos(Math.PI / 8); - private static final float ss = (float)Math.sin(Math.PI / 8); - private static final float sq2 = 1f / (float)Math.sqrt(2); - - private static Pair approxGivensQuat(float a11, float a12, float a22) - { - float ch = 2f * (a11 - a22); - float sh = a12; - boolean b = g * sh * sh < ch * ch; - float w = rsqrt(sh * sh + ch * ch); - ch = b ? w * ch : cs; - sh = b ? w * sh : ss; - return Pair.of(sh, ch); - } - - private static final void swapNeg(Matrix3f m, int i, int j) - { - float[] t = new float[3]; - m.getColumn(j, t); - for(int k = 0; k < 3; k++) - { - m.setElement(k, j, -m.getElement(k, i)); - } - m.setColumn(i, t); - } - - @SuppressWarnings("unused") - private static void sortSingularValues(Matrix3f b, Quat4f v) - { - float p0 = b.m00 * b.m00 + b.m10 * b.m10 + b.m20 * b.m20; - float p1 = b.m01 * b.m01 + b.m11 * b.m11 + b.m21 * b.m21; - float p2 = b.m02 * b.m02 + b.m12 * b.m12 + b.m22 * b.m22; - Quat4f t = new Quat4f(); - if(p0 < p1) - { - swapNeg(b, 0, 1); - t.set(0, 0, sq2, sq2); - v.mul(t); - float f = p0; - p0 = p1; - p1 = f; - } - if(p0 < p2) - { - swapNeg(b, 0, 2); - t.set(0, sq2, 0, sq2); - v.mul(t); - float f = p0; - p0 = p2; - p2 = f; - } - if(p1 < p2) - { - swapNeg(b, 1, 2); - t.set(sq2, 0, 0, sq2); - v.mul(t); - } - } - - private static Pair qrGivensQuat(float a1, float a2) - { - float p = (float)Math.sqrt(a1 * a1 + a2 * a2); - float sh = p > eps ? a2 : 0; - float ch = Math.abs(a1) + Math.max(p, eps); - if(a1 < 0) - { - float f = sh; - sh = ch; - ch = f; - } - //float w = 1.f / (float)Math.sqrt(ch * ch + sh * sh); - float w = rsqrt(ch * ch + sh * sh); - ch *= w; - sh *= w; - return Pair.of(sh, ch); - } - - private static Quat4f stepJacobi(Matrix3f m) - { - Matrix3f t = new Matrix3f(); - Quat4f qt = new Quat4f(), ret = new Quat4f(0, 0, 0, 1); - Pair p; - // 01 - if(m.m01 * m.m01 + m.m10 * m.m10 > eps) - { - p = approxGivensQuat(m.m00, .5f * (m.m01 + m.m10), m.m11); - qt.set(0, 0, p.getLeft(), p.getRight()); - //qt.normalize(); - ret.mul(qt); - //t.set(qt); - t.setIdentity(); - t.m00 = qt.w * qt.w - qt.z * qt.z; - t.m11 = t.m00; - t.m10 = 2 * qt.z * qt.w; - t.m01 = -t.m10; - t.m22 = qt.w * qt.w + qt.z * qt.z; - m.mul(m, t); - t.transpose(); - m.mul(t, m); - } - // 02 - if(m.m02 * m.m02 + m.m20 * m.m20 > eps) - { - p = approxGivensQuat(m.m00, .5f * (m.m02 + m.m20), m.m22); - qt.set(0, -p.getLeft(), 0, p.getRight()); - //qt.normalize(); - ret.mul(qt); - //t.set(qt); - t.setIdentity(); - t.m00 = qt.w * qt.w - qt.y * qt.y; - t.m22 = t.m00; - t.m20 = -2 * qt.y * qt.w; - t.m02 = -t.m20; - t.m11 = qt.w * qt.w + qt.y * qt.y; - m.mul(m, t); - t.transpose(); - m.mul(t, m); - } - // 12 - if(m.m12 * m.m12 + m.m21 * m.m21 > eps) - { - p = approxGivensQuat(m.m11, .5f * (m.m12 + m.m21), m.m22); - qt.set(p.getLeft(), 0, 0, p.getRight()); - //qt.normalize(); - ret.mul(qt); - //t.set(qt); - t.setIdentity(); - t.m11 = qt.w * qt.w - qt.x * qt.x; - t.m22 = t.m11; - t.m21 = 2 * qt.x * qt.w; - t.m12 = -t.m21; - t.m00 = qt.w * qt.w + qt.x * qt.x; - m.mul(m, t); - t.transpose(); - m.mul(t, m); - } - return ret; - } - - /* - * Divides m by m33, sets last row to (0, 0, 0, 1), extracts linear and translation parts - */ - public static Pair toAffine(Matrix4f m) - { - m.mul(1.f / m.m33); - Vector3f trans = new Vector3f(m.m03, m.m13, m.m23); - Matrix3f linear = new Matrix3f(m.m00, m.m01, m.m02, m.m10, m.m11, m.m12, m.m20, m.m21, m.m22); - return Pair.of(linear, trans); - } - - /* - * Don't use this if you don't need to, conversion is lossy (second rotation component is lost). - */ - @Deprecated - @OnlyIn(Dist.CLIENT) - public net.minecraft.client.renderer.model.ItemTransformVec3f toItemTransform() - { - return new ItemTransformVec3f(toMojang(toXYZDegrees(getLeftRot())), toMojang(getTranslation()), toMojang(getScale())); - } - - public boolean isIdentity() - { - return this.equals(identity); - } - - @Override - public Matrix4f getMatrixVec() - { - return (Matrix4f)matrix.clone(); - } - - public Vector3f getTranslation() - { - genCheck(); - return (Vector3f)translation.clone(); - } - - public Quat4f getLeftRot() - { - genCheck(); - return (Quat4f)leftRot.clone(); - } - - public Vector3f getScale() - { - genCheck(); - return (Vector3f)scale.clone(); - } - - public Quat4f getRightRot() - { - genCheck(); - return (Quat4f)rightRot.clone(); - } - - @Override - public Optional apply(Optional part) - { - if(part.isPresent()) - { - return Optional.empty(); - } - return Optional.of(this); - } - - @Override - public Direction rotateTransform(Direction facing) - { - return rotate(matrix, facing); - } - - public static Direction rotate(Matrix4f matrix, Direction facing) - { - Vec3i dir = facing.getDirectionVec(); - Vector4f vec = new Vector4f(dir.getX(), dir.getY(), dir.getZ(), 0); - matrix.transform(vec); - return Direction.getFacingFromVector(vec.x, vec.y, vec.z); - } - - public static boolean isInteger(Matrix4f matrix) - { - Matrix4f m = new Matrix4f(); - m.setIdentity(); - m.m30 = m.m31 = m.m32 = 1; - m.m33 = 0; - m.mul(matrix, m); - for(int i = 0; i < 3; i++) - { - for(int j = 0; j < 3; j++) - { - float v = m.getElement(i, j) / m.getElement(3, j); - if(Math.abs(v - Math.round(v)) > 1e-5) return false; - } - } - return true; - } - - @Override - public int rotate(Direction facing, int vertexIndex) - { - // FIXME check if this is good enough - return vertexIndex; - } - - public void transformPosition(Vector4f position) - { - matrix.transform(position); - } - - public void transformNormal(Vector3f normal) - { - checkNormalTransform(); - normalTransform.transform(normal); - normal.normalize(); - } - - private void checkNormalTransform() - { - if (normalTransform == null) - { - normalTransform = new Matrix3f(); - matrix.getRotationScale(normalTransform); - normalTransform.invert(); - normalTransform.transpose(); - } - } - - @Override - public String toString() - { - genCheck(); - return MoreObjects.toStringHelper(this.getClass()) - .add("matrix", matrix) - .add("translation", translation) - .add("leftRot", leftRot) - .add("scale", scale) - .add("rightRot", rightRot) - .toString(); - } - - /** - * convert transformation from assuming center-block system to corner-block system - */ - public static TRSRTransformation blockCenterToCorner(TRSRTransformation transform) - { - if (transform.isIdentity()) return transform; - - Matrix4f ret = new Matrix4f(transform.getMatrixVec()), tmp = new Matrix4f(); - tmp.setIdentity(); - tmp.m03 = tmp.m13 = tmp.m23 = .5f; - ret.mul(tmp, ret); - tmp.m03 = tmp.m13 = tmp.m23 = -.5f; - ret.mul(tmp); - return new TRSRTransformation(ret); - } - - /** - * convert transformation from assuming corner-block system to center-block system - */ - public static TRSRTransformation blockCornerToCenter(TRSRTransformation transform) - { - if (transform.isIdentity()) return transform; - - Matrix4f ret = new Matrix4f(transform.getMatrixVec()), tmp = new Matrix4f(); - tmp.setIdentity(); - tmp.m03 = tmp.m13 = tmp.m23 = -.5f; - ret.mul(tmp, ret); - tmp.m03 = tmp.m13 = tmp.m23 = .5f; - ret.mul(tmp); - return new TRSRTransformation(ret); - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + Objects.hashCode(matrix); - return result; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - TRSRTransformation other = (TRSRTransformation) obj; - return Objects.equals(matrix, other.matrix); - } - - @OnlyIn(Dist.CLIENT) - public static Vector3f toVecmath(net.minecraft.client.renderer.Vector3f vec) - { - return new Vector3f(vec.getX(), vec.getY(), vec.getZ()); - } - - @OnlyIn(Dist.CLIENT) - public static Vector4f toVecmath(net.minecraft.client.renderer.Vector4f vec) - { - return new Vector4f(vec.getX(), vec.getY(), vec.getZ(), vec.getW()); - } - - @OnlyIn(Dist.CLIENT) - public static Matrix4f toVecmath(net.minecraft.client.renderer.Matrix4f m) - { - return new Matrix4f( - m.get(0, 0), m.get(1, 0), m.get(2, 0), m.get(3, 0), - m.get(0, 1), m.get(1, 1), m.get(2, 1), m.get(3, 1), - m.get(0, 2), m.get(1, 2), m.get(2, 2), m.get(3, 2), - m.get(0, 3), m.get(1, 3), m.get(2, 3), m.get(3, 3)); - } - - public static Quat4f toVecmath(net.minecraft.client.renderer.Quaternion q) - { - return new Quat4f(q.getX(), q.getY(), q.getZ(), q.getW()); - } - - @OnlyIn(Dist.CLIENT) - public static net.minecraft.client.renderer.Vector3f toMojang(Vector3f vec) - { - return new net.minecraft.client.renderer.Vector3f(vec.x, vec.y, vec.z); - } - - @OnlyIn(Dist.CLIENT) - public static net.minecraft.client.renderer.Vector4f toMojang(Vector4f vec) - { - return new net.minecraft.client.renderer.Vector4f(vec.x, vec.y, vec.z, vec.w); - } - - @OnlyIn(Dist.CLIENT) - public static net.minecraft.client.renderer.Matrix4f toMojang(Matrix4f m) - { - net.minecraft.client.renderer.Matrix4f r = new net.minecraft.client.renderer.Matrix4f(); - float[] row = new float[4]; - for (int x = 0; x < 4; x++) - { - m.getRow(x, row); - for (int y = 0; y < 4; y++) - { - r.set(x, y, row[y]); - } - } - return r; - } - - public static Vector3f lerp(Tuple3f from, Tuple3f to, float progress) - { - Vector3f res = new Vector3f(from); - res.interpolate(from, to, progress); - return res; - } - - public static Vector4f lerp(Tuple4f from, Tuple4f to, float progress) - { - Vector4f res = new Vector4f(from); - res.interpolate(from, to, progress); - return res; - } - - public static Quat4f slerp(Quat4f from, Quat4f to, float progress) - { - Quat4f res = new Quat4f(); - res.interpolate(from, to, progress); - return res; - } - - public TRSRTransformation slerp(TRSRTransformation that, float progress) - { - return new TRSRTransformation( - lerp(this.getTranslation(), that.getTranslation(), progress), - slerp(this.getLeftRot(), that.getLeftRot(), progress), - lerp(this.getScale(), that.getScale(), progress), - slerp(this.getRightRot(), that.getRightRot(), progress) - ); - } - - private static final EnumMap vanillaUvTransformLocalToGlobal = Maps.newEnumMap(Direction.class); - private static final EnumMap vanillaUvTransformGlobalToLocal = Maps.newEnumMap(Direction.class); - - static - { - vanillaUvTransformLocalToGlobal.put(Direction.SOUTH, identity); - Quat4f tmp = new Quat4f(); - tmp.set(new AxisAngle4f(0, 1, 0, (float)Math.toRadians(90))); - vanillaUvTransformLocalToGlobal.put(Direction.EAST, new TRSRTransformation(null, new Quat4f(tmp), null, null)); - tmp.set(new AxisAngle4f(0, 1, 0, (float)Math.toRadians(-90))); - vanillaUvTransformLocalToGlobal.put(Direction.WEST, new TRSRTransformation(null, new Quat4f(tmp), null, null)); - tmp.set(new AxisAngle4f(0, 1, 0, (float)Math.toRadians(180))); - vanillaUvTransformLocalToGlobal.put(Direction.NORTH, new TRSRTransformation(null, new Quat4f(tmp), null, null)); - tmp.set(new AxisAngle4f(1, 0, 0, (float)Math.toRadians(-90))); - vanillaUvTransformLocalToGlobal.put(Direction.UP, new TRSRTransformation(null, new Quat4f(tmp), null, null)); - tmp.set(new AxisAngle4f(1, 0, 0, (float)Math.toRadians(90))); - vanillaUvTransformLocalToGlobal.put(Direction.DOWN, new TRSRTransformation(null, new Quat4f(tmp), null, null)); - - for(Direction side : Direction.values()) - { - vanillaUvTransformGlobalToLocal.put(side, vanillaUvTransformLocalToGlobal.get(side).inverse()); - } - } - - public static TRSRTransformation getVanillaUvTransformLocalToGlobal(Direction side) - { - return vanillaUvTransformLocalToGlobal.get(side); - } - - public static TRSRTransformation getVanillaUvTransformGlobalToLocal(Direction side) - { - return vanillaUvTransformGlobalToLocal.get(side); - } - - public TRSRTransformation getUVLockTransform(Direction originalSide) - { - Direction newSide = rotateTransform(originalSide); - try - { - return blockCenterToCorner(vanillaUvTransformGlobalToLocal.get(originalSide).compose(blockCornerToCenter(this.inverse())).compose(vanillaUvTransformLocalToGlobal.get(newSide))); - } - catch(SingularMatrixException e) - { - return new TRSRTransformation(null, null, new Vector3f(0, 0, 0), null); - } - } - - @OnlyIn(Dist.CLIENT) - private static final class Cache - { - private static final Map rotations = new EnumMap<>(ModelRotation.class); - - static - { - rotations.put(ModelRotation.X0_Y0, identity()); - } - - static TRSRTransformation get(ModelRotation rotation) - { - return rotations.computeIfAbsent(rotation, r -> new TRSRTransformation(ForgeHooksClient.getMatrix(r))); - } - } -} diff --git a/src/main/java/net/minecraftforge/common/model/TransformationHelper.java b/src/main/java/net/minecraftforge/common/model/TransformationHelper.java new file mode 100644 index 000000000..47cae893f --- /dev/null +++ b/src/main/java/net/minecraftforge/common/model/TransformationHelper.java @@ -0,0 +1,436 @@ +/* + * Minecraft Forge + * Copyright (c) 2016-2019. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.minecraftforge.common.model; + +import java.lang.reflect.Type; +import java.util.EnumMap; +import java.util.Map; + +import javax.annotation.Nullable; + +import com.google.gson.*; +import net.minecraft.client.renderer.*; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.commons.lang3.tuple.Triple; + +import com.google.common.collect.Maps; + +import net.minecraft.client.renderer.model.ItemTransformVec3f; +import net.minecraft.client.renderer.model.ModelRotation; +import net.minecraft.util.Direction; +import net.minecraft.util.math.Vec3i; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.ForgeHooksClient; + +public final class TransformationHelper +{ + @Deprecated + @OnlyIn(Dist.CLIENT) + public static TransformationMatrix toTransformation(ItemTransformVec3f transform) + { + if (transform.equals(ItemTransformVec3f.DEFAULT)) return TransformationMatrix.func_227983_a_(); + + return new TransformationMatrix(transform.translation, quatFromXYZ(transform.rotation, true), transform.scale, null); + } + + public static void transform(Matrix4f matrix, Vector4f vector) + { + javax.vecmath.Vector4f copy = toVecmath(vector); + toVecmath(matrix).transform(copy); + vector.set(copy.x, copy.y, copy.z, copy.w); + } + + public static Quaternion quatFromXYZ(Vector3f xyz, boolean degrees) + { + return new Quaternion(xyz.getX(), xyz.getY(), xyz.getZ(), degrees); + } + + public static Direction rotate(Matrix4f matrix, Direction facing) + { + Vec3i dir = facing.getDirectionVec(); + javax.vecmath.Vector4f vec = new javax.vecmath.Vector4f(dir.getX(), dir.getY(), dir.getZ(), 0); + toVecmath(matrix).transform(vec); + return Direction.getFacingFromVector(vec.x, vec.y, vec.z); + } + + /** + * convert transformation from assuming center-block system to corner-block system + */ + public static TransformationMatrix blockCenterToCorner(TransformationMatrix transform) + { + if (transform.isIdentity()) return TransformationMatrix.func_227983_a_(); + + javax.vecmath.Matrix4f ret = toVecmath(transform.func_227988_c_()), tmp = new javax.vecmath.Matrix4f(); + tmp.setIdentity(); + tmp.m03 = tmp.m13 = tmp.m23 = .5f; + ret.mul(tmp, ret); + tmp.m03 = tmp.m13 = tmp.m23 = -.5f; + ret.mul(tmp); + return new TransformationMatrix(toMojang(ret)); + } + + /** + * convert transformation from assuming corner-block system to center-block system + */ + public static TransformationMatrix blockCornerToCenter(TransformationMatrix transform) + { + if (transform.isIdentity()) return TransformationMatrix.func_227983_a_(); + + javax.vecmath.Matrix4f ret = toVecmath(transform.func_227988_c_()), tmp = new javax.vecmath.Matrix4f(); + tmp.setIdentity(); + tmp.m03 = tmp.m13 = tmp.m23 = -.5f; + ret.mul(tmp, ret); + tmp.m03 = tmp.m13 = tmp.m23 = .5f; + ret.mul(tmp); + return new TransformationMatrix(toMojang(ret)); + } + + @OnlyIn(Dist.CLIENT) + public static javax.vecmath.Vector3f toVecmath(Vector3f vec) + { + return new javax.vecmath.Vector3f(vec.getX(), vec.getY(), vec.getZ()); + } + + @OnlyIn(Dist.CLIENT) + public static javax.vecmath.Vector4f toVecmath(Vector4f vec) + { + return new javax.vecmath.Vector4f(vec.getX(), vec.getY(), vec.getZ(), vec.getW()); + } + + @OnlyIn(Dist.CLIENT) + public static javax.vecmath.Matrix4f toVecmath(Matrix4f m) + { + float[] all = new float[16]; + m.write(all); + return new javax.vecmath.Matrix4f(all); + } + + public static javax.vecmath.Quat4f toVecmath(Quaternion q) + { + return new javax.vecmath.Quat4f(q.getX(), q.getY(), q.getZ(), q.getW()); + } + + public static Quaternion toMojang(javax.vecmath.Quat4f q) + { + return new Quaternion(q.getX(), q.getY(), q.getZ(), q.getW()); + } + + @OnlyIn(Dist.CLIENT) + public static Vector3f toMojang(javax.vecmath.Vector3f vec) + { + return new Vector3f(vec.x, vec.y, vec.z); + } + + @OnlyIn(Dist.CLIENT) + public static Vector4f toMojang(javax.vecmath.Vector4f vec) + { + return new Vector4f(vec.x, vec.y, vec.z, vec.w); + } + + @OnlyIn(Dist.CLIENT) + public static Matrix4f toMojang(javax.vecmath.Matrix4f m) + { + Matrix4f r = new Matrix4f(); + float[] row = new float[4]; + float[] all = new float[16]; + for (int x = 0; x < 4; x++) + { + m.getRow(x, row); + for (int y = 0; y < 4; y++) + { + all[y*4+x] = row[y]; + } + } + r.set(all); + return r; + } + + public static javax.vecmath.Vector3f lerp(javax.vecmath.Tuple3f from, javax.vecmath.Tuple3f to, float progress) + { + javax.vecmath.Vector3f res = new javax.vecmath.Vector3f(from); + res.interpolate(from, to, progress); + return res; + } + + public static javax.vecmath.Vector4f lerp(javax.vecmath.Tuple4f from, javax.vecmath.Tuple4f to, float progress) + { + javax.vecmath.Vector4f res = new javax.vecmath.Vector4f(from); + res.interpolate(from, to, progress); + return res; + } + + public static Vector3f lerp(Vector3f from, Vector3f to, float progress) + { + Vector3f res = from.func_229195_e_(); + res.func_229190_a_(to, progress); + return res; + } + + public static Quaternion slerp(Quaternion from, Quaternion to, float progress) + { + javax.vecmath.Quat4f res = new javax.vecmath.Quat4f(); + res.interpolate(toVecmath(from), toVecmath(to), progress); + return toMojang(res); + } + + public static TransformationMatrix slerp(TransformationMatrix one, TransformationMatrix that, float progress) + { + return new TransformationMatrix( + lerp(one.getTranslation(), that.getTranslation(), progress), + slerp(one.func_227989_d_(), that.func_227989_d_(), progress), + lerp(one.getScale(), that.getScale(), progress), + slerp(one.getRightRot(), that.getRightRot(), progress) + ); + } + + private static final EnumMap vanillaUvTransformLocalToGlobal = Maps.newEnumMap(Direction.class); + private static final EnumMap vanillaUvTransformGlobalToLocal = Maps.newEnumMap(Direction.class); + + static + { + vanillaUvTransformLocalToGlobal.put(Direction.SOUTH, TransformationMatrix.func_227983_a_()); + javax.vecmath.Quat4f tmp = new javax.vecmath.Quat4f(); + tmp.set(new javax.vecmath.AxisAngle4f(0, 1, 0, (float)Math.toRadians(90))); + vanillaUvTransformLocalToGlobal.put(Direction.EAST, new TransformationMatrix(null, toMojang(tmp), null, null)); + tmp.set(new javax.vecmath.AxisAngle4f(0, 1, 0, (float)Math.toRadians(-90))); + vanillaUvTransformLocalToGlobal.put(Direction.WEST, new TransformationMatrix(null, toMojang(tmp), null, null)); + tmp.set(new javax.vecmath.AxisAngle4f(0, 1, 0, (float)Math.toRadians(180))); + vanillaUvTransformLocalToGlobal.put(Direction.NORTH, new TransformationMatrix(null, toMojang(tmp), null, null)); + tmp.set(new javax.vecmath.AxisAngle4f(1, 0, 0, (float)Math.toRadians(-90))); + vanillaUvTransformLocalToGlobal.put(Direction.UP, new TransformationMatrix(null, toMojang(tmp), null, null)); + tmp.set(new javax.vecmath.AxisAngle4f(1, 0, 0, (float)Math.toRadians(90))); + vanillaUvTransformLocalToGlobal.put(Direction.DOWN, new TransformationMatrix(null, toMojang(tmp), null, null)); + + for(Direction side : Direction.values()) + { + vanillaUvTransformGlobalToLocal.put(side, vanillaUvTransformLocalToGlobal.get(side).inverse()); + } + } + + public static TransformationMatrix getVanillaUvTransformLocalToGlobal(Direction side) + { + return vanillaUvTransformLocalToGlobal.get(side); + } + + public static TransformationMatrix getVanillaUvTransformGlobalToLocal(Direction side) + { + return vanillaUvTransformGlobalToLocal.get(side); + } + + public static TransformationMatrix getUVLockTransform(TransformationMatrix matrix, Direction originalSide) + { + Direction newSide = matrix.rotateTransform(originalSide); + try + { + return blockCenterToCorner(vanillaUvTransformGlobalToLocal.get(originalSide).compose(blockCornerToCenter(matrix.inverse())).compose(vanillaUvTransformLocalToGlobal.get(newSide))); + } + catch(javax.vecmath.SingularMatrixException e) + { + return new TransformationMatrix(null, null, new Vector3f(0, 0, 0), null); + } + } + + public static class Deserializer implements JsonDeserializer + { + @Override + public TransformationMatrix deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException + { + if (json.isJsonPrimitive() && json.getAsJsonPrimitive().isString()) + { + String transform = json.getAsString(); + if(transform.equals("identity")) + { + return TransformationMatrix.func_227983_a_(); + } + else + { + throw new JsonParseException("TRSR: unknown default string: " + transform); + } + } + if (json.isJsonArray()) + { + // direct matrix array + return new TransformationMatrix(parseMatrix(json)); + } + if (!json.isJsonObject()) throw new JsonParseException("TRSR: expected array or object, got: " + json); + JsonObject obj = json.getAsJsonObject(); + TransformationMatrix ret; + if (obj.has("matrix")) + { + // matrix as a sole key + ret = new TransformationMatrix(parseMatrix(obj.get("matrix"))); + obj.remove("matrix"); + if (obj.entrySet().size() != 0) + { + throw new JsonParseException("TRSR: can't combine matrix and other keys"); + } + return ret; + } + Vector3f translation = null; + Quaternion leftRot = null; + Vector3f scale = null; + Quaternion rightRot = null; + if (obj.has("translation")) + { + translation = new Vector3f(parseFloatArray(obj.get("translation"), 3, "Translation")); + obj.remove("translation"); + } + if (obj.has("rotation")) + { + leftRot = parseRotation(obj.get("rotation")); + obj.remove("rotation"); + } + if (obj.has("scale")) + { + if(!obj.get("scale").isJsonArray()) + { + try + { + float s = obj.get("scale").getAsNumber().floatValue(); + scale = new Vector3f(s, s, s); + } + catch (ClassCastException ex) + { + throw new JsonParseException("TRSR scale: expected number or array, got: " + obj.get("scale")); + } + } + else + { + scale = new Vector3f(parseFloatArray(obj.get("scale"), 3, "Scale")); + } + obj.remove("scale"); + } + if (obj.has("post-rotation")) + { + rightRot = parseRotation(obj.get("post-rotation")); + obj.remove("post-rotation"); + } + if (!obj.entrySet().isEmpty()) throw new JsonParseException("TRSR: can either have single 'matrix' key, or a combination of 'translation', 'rotation', 'scale', 'post-rotation'"); + return new TransformationMatrix(translation, leftRot, scale, rightRot); + } + + public static Matrix4f parseMatrix(JsonElement e) + { + if (!e.isJsonArray()) throw new JsonParseException("Matrix: expected an array, got: " + e); + JsonArray m = e.getAsJsonArray(); + if (m.size() != 3) throw new JsonParseException("Matrix: expected an array of length 3, got: " + m.size()); + javax.vecmath.Matrix4f ret = new javax.vecmath.Matrix4f(); + for (int i = 0; i < 3; i++) + { + if (!m.get(i).isJsonArray()) throw new JsonParseException("Matrix row: expected an array, got: " + m.get(i)); + JsonArray r = m.get(i).getAsJsonArray(); + if (r.size() != 4) throw new JsonParseException("Matrix row: expected an array of length 4, got: " + r.size()); + for (int j = 0; j < 4; j++) + { + try + { + ret.setElement(i, j, r.get(j).getAsNumber().floatValue()); + } + catch (ClassCastException ex) + { + throw new JsonParseException("Matrix element: expected number, got: " + r.get(j)); + } + } + } + return toMojang(ret); + } + + public static float[] parseFloatArray(JsonElement e, int length, String prefix) + { + if (!e.isJsonArray()) throw new JsonParseException(prefix + ": expected an array, got: " + e); + JsonArray t = e.getAsJsonArray(); + if (t.size() != length) throw new JsonParseException(prefix + ": expected an array of length " + length + ", got: " + t.size()); + float[] ret = new float[length]; + for (int i = 0; i < length; i++) + { + try + { + ret[i] = t.get(i).getAsNumber().floatValue(); + } + catch (ClassCastException ex) + { + throw new JsonParseException(prefix + " element: expected number, got: " + t.get(i)); + } + } + return ret; + } + + public static Quaternion parseAxisRotation(JsonElement e) + { + if (!e.isJsonObject()) throw new JsonParseException("Axis rotation: object expected, got: " + e); + JsonObject obj = e.getAsJsonObject(); + if (obj.entrySet().size() != 1) throw new JsonParseException("Axis rotation: expected single axis object, got: " + e); + Map.Entry entry = obj.entrySet().iterator().next(); + Quaternion ret; + try + { + if (entry.getKey().equals("x")) + { + ret = new Quaternion(new Vector3f(1, 0, 0), entry.getValue().getAsNumber().floatValue(), true); + } + else if (entry.getKey().equals("y")) + { + ret = new Quaternion(new Vector3f(0, 1, 0), entry.getValue().getAsNumber().floatValue(), true); + } + else if (entry.getKey().equals("z")) + { + ret = new Quaternion(new Vector3f(0, 0, 1), entry.getValue().getAsNumber().floatValue(), true); + } + else throw new JsonParseException("Axis rotation: expected single axis key, got: " + entry.getKey()); + } + catch(ClassCastException ex) + { + throw new JsonParseException("Axis rotation value: expected number, got: " + entry.getValue()); + } + return ret; + } + + public static Quaternion parseRotation(JsonElement e) + { + if (e.isJsonArray()) + { + if (e.getAsJsonArray().get(0).isJsonObject()) + { + Quaternion ret = new Quaternion(0, 0, 0, 1); + for (JsonElement a : e.getAsJsonArray()) + { + ret.multiply(parseAxisRotation(a)); + } + return ret; + } + else if (e.isJsonArray()) + { + JsonArray array = e.getAsJsonArray(); + if (array.size() == 3) //Vanilla rotation + return quatFromXYZ(new Vector3f(parseFloatArray(e, 3, "Rotation")), true); + else // quaternion + return new Quaternion(parseFloatArray(e, 4, "Rotation")); + } + else throw new JsonParseException("Rotation: expected array or object, got: " + e); + } + else if (e.isJsonObject()) + { + return parseAxisRotation(e); + } + else throw new JsonParseException("Rotation: expected array or object, got: " + e); + } + } +} diff --git a/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java b/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java index 90e41f5d3..de0bd2907 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java +++ b/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java @@ -26,11 +26,7 @@ import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; -import com.google.common.collect.Maps; -import com.google.common.collect.Multimaps; -import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; @@ -40,6 +36,7 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import net.minecraft.client.renderer.model.IModelTransform; import net.minecraft.resources.IResource; import net.minecraft.resources.IResourceManager; import net.minecraft.util.ResourceLocation; @@ -48,7 +45,6 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.animation.Event; import net.minecraftforge.common.animation.ITimeValue; import net.minecraftforge.common.animation.TimeValues; -import net.minecraftforge.common.model.IModelState; import net.minecraftforge.common.util.JsonUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; @@ -81,13 +77,13 @@ public final class AnimationStateMachine implements IAnimationStateMachine private transient IClip currentState; private transient float lastPollTime; - private static final LoadingCache, Pair>> clipCache = CacheBuilder.newBuilder() + private static final LoadingCache, Pair>> clipCache = CacheBuilder.newBuilder() .maximumSize(100) .expireAfterWrite(100, TimeUnit.MILLISECONDS) - .build(new CacheLoader, Pair>>() + .build(new CacheLoader, Pair>>() { @Override - public Pair> load(Triple key) throws Exception + public Pair> load(Triple key) throws Exception { return Clips.apply(key.getLeft(), key.getMiddle(), key.getRight()); } @@ -136,13 +132,13 @@ public final class AnimationStateMachine implements IAnimationStateMachine } @Override - public Pair> apply(float time) + public Pair> apply(float time) { if(lastPollTime == Float.NEGATIVE_INFINITY) { lastPollTime = time; } - Pair> pair = clipCache.getUnchecked(Triple.of(currentState, lastPollTime, time)); + Pair> pair = clipCache.getUnchecked(Triple.of(currentState, lastPollTime, time)); lastPollTime = time; boolean shouldFilter = false; if(shouldHandleSpecialEvents) 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 be28b3fa1..8966009df 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/common/model/animation/Clips.java @@ -21,21 +21,20 @@ package net.minecraftforge.common.model.animation; import java.io.IOException; +import net.minecraft.client.renderer.TransformationMatrix; +import net.minecraft.client.renderer.model.IModelTransform; import net.minecraft.client.renderer.model.IUnbakedModel; import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.model.IModel; -import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.animation.Event; import net.minecraftforge.common.animation.ITimeValue; -import net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.common.model.TransformationHelper; import org.apache.commons.lang3.NotImplementedException; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; @@ -95,7 +94,7 @@ public final class Clips @OnlyIn(Dist.CLIENT) public static IClip getModelClipNode(ResourceLocation modelLocation, String clipName) { - IUnbakedModel model = ModelLoaderRegistry.getModelOrMissing(modelLocation); + IUnbakedModel model = ModelLoader.defaultModelGetter().apply(modelLocation); Optional clip = model.getClip(clipName); if (clip.isPresent()) { @@ -175,7 +174,7 @@ public final class Clips { private final IJointClip parent = childClip.apply(joint); @Override - public TRSRTransformation apply(float time) + public TransformationMatrix apply(float time) { return parent.apply(TimeClip.this.time.apply(time)); } @@ -292,10 +291,10 @@ public final class Clips return new IJointClip() { @Override - public TRSRTransformation apply(float time) + public TransformationMatrix apply(float time) { float clipTime = input.apply(time); - return fromClip.apply(clipTime).slerp(toClip.apply(clipTime), MathHelper.clamp(progress.apply(time), 0, 1)); + return TransformationHelper.slerp(fromClip.apply(clipTime), toClip.apply(clipTime), MathHelper.clamp(progress.apply(time), 0, 1)); } }; } @@ -303,28 +302,34 @@ public final class Clips /** * IModelState wrapper for a Clip, sampled at specified time. */ - public static Pair> apply(final IClip clip, final float lastPollTime, final float time) + public static Pair> apply(final IClip clip, final float lastPollTime, final float time) { - return Pair.>of(new IModelState() + return Pair.of(new IModelTransform() { @Override - public Optional apply(Optional part) + public TransformationMatrix func_225615_b_() { - if(!part.isPresent() || !(part.get() instanceof IJoint)) + return TransformationMatrix.func_227983_a_(); + } + + @Override + public TransformationMatrix getPartTransformation(Object part) + { + if(!(part instanceof IJoint)) { - return Optional.empty(); + return TransformationMatrix.func_227983_a_(); } - IJoint joint = (IJoint)part.get(); + IJoint joint = (IJoint)part; // TODO: Cache clip application? - TRSRTransformation jointTransform = clip.apply(joint).apply(time).compose(joint.getInvBindPose()); + TransformationMatrix jointTransform = clip.apply(joint).apply(time).compose(joint.getInvBindPose()); Optional parent = joint.getParent(); while(parent.isPresent()) { - TRSRTransformation parentTransform = clip.apply(parent.get()).apply(time); + TransformationMatrix parentTransform = clip.apply(parent.get()).apply(time); jointTransform = parentTransform.compose(jointTransform); parent = parent.get().getParent(); } - return Optional.of(jointTransform); + return jointTransform; } }, clip.pastEvents(lastPollTime, time)); } diff --git a/src/main/java/net/minecraftforge/common/model/animation/IAnimationStateMachine.java b/src/main/java/net/minecraftforge/common/model/animation/IAnimationStateMachine.java index 51f80cbd6..b417792b1 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/IAnimationStateMachine.java +++ b/src/main/java/net/minecraftforge/common/model/animation/IAnimationStateMachine.java @@ -19,8 +19,8 @@ package net.minecraftforge.common.model.animation; +import net.minecraft.client.renderer.model.IModelTransform; import net.minecraftforge.common.animation.Event; -import net.minecraftforge.common.model.IModelState; import org.apache.commons.lang3.tuple.Pair; @@ -34,7 +34,7 @@ public interface IAnimationStateMachine * Event iterable will contain all events that happened from the last invocation of this method, from most to least recent. * Event offset is relative to the previous event, and for the first event it's relative to the current time. */ - Pair> apply(float time); + Pair> apply(float time); /** * Transition to a new state. 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 942337d3e..766ada924 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/IJoint.java +++ b/src/main/java/net/minecraftforge/common/model/animation/IJoint.java @@ -21,15 +21,14 @@ package net.minecraftforge.common.model.animation; import java.util.Optional; -import net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraft.client.renderer.TransformationMatrix; /** * Model part that's a part of the hierarchical skeleton. */ -public interface IJoint extends IModelPart +public interface IJoint { - TRSRTransformation getInvBindPose(); + TransformationMatrix getInvBindPose(); Optional getParent(); } 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 f02f20f08..7bc8e7a35 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/IJointClip.java +++ b/src/main/java/net/minecraftforge/common/model/animation/IJointClip.java @@ -19,12 +19,12 @@ package net.minecraftforge.common.model.animation; -import net.minecraftforge.common.model.TRSRTransformation; +import net.minecraft.client.renderer.TransformationMatrix; /** * Returns Local joint pose; animation clip for specific model part. */ public interface IJointClip { - TRSRTransformation apply(float time); + TransformationMatrix apply(float time); } 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 010080cb4..ce1a77acc 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.minecraftforge.common.model.TRSRTransformation; +import net.minecraft.client.renderer.TransformationMatrix; /** * Various implementations of IJointClip. @@ -31,9 +31,9 @@ public final class JointClips INSTANCE; @Override - public TRSRTransformation apply(float time) + public TransformationMatrix apply(float time) { - return TRSRTransformation.identity(); + return TransformationMatrix.func_227983_a_(); } } @@ -49,7 +49,7 @@ public final class JointClips } @Override - public TRSRTransformation apply(float time) + public TransformationMatrix apply(float time) { return clip.apply(child).apply(time); } diff --git a/src/main/java/net/minecraftforge/common/property/Properties.java b/src/main/java/net/minecraftforge/common/property/Properties.java index 025747d39..7175dd91e 100644 --- a/src/main/java/net/minecraftforge/common/property/Properties.java +++ b/src/main/java/net/minecraftforge/common/property/Properties.java @@ -19,9 +19,9 @@ package net.minecraftforge.common.property; +import net.minecraft.client.renderer.model.IModelTransform; import net.minecraft.state.BooleanProperty; import net.minecraftforge.client.model.data.ModelProperty; -import net.minecraftforge.common.model.IModelState; public class Properties { @@ -33,5 +33,5 @@ public class Properties /** * Property holding the IModelState used for animating the model in the TESR. */ - public static final ModelProperty AnimationProperty = new ModelProperty(); + public static final ModelProperty AnimationProperty = new ModelProperty(); } diff --git a/src/main/java/net/minecraftforge/common/util/ChunkCoordComparator.java b/src/main/java/net/minecraftforge/common/util/ChunkCoordComparator.java index c6618225c..d02705301 100644 --- a/src/main/java/net/minecraftforge/common/util/ChunkCoordComparator.java +++ b/src/main/java/net/minecraftforge/common/util/ChunkCoordComparator.java @@ -30,8 +30,8 @@ public class ChunkCoordComparator implements java.util.Comparator public ChunkCoordComparator(ServerPlayerEntity entityplayer) { - x = (int) entityplayer.posX >> 4; - z = (int) entityplayer.posZ >> 4; + x = (int) entityplayer.func_226277_ct_() >> 4; + z = (int) entityplayer.func_226281_cx_() >> 4; } @Override diff --git a/src/main/java/net/minecraftforge/common/util/Lazy.java b/src/main/java/net/minecraftforge/common/util/Lazy.java new file mode 100644 index 000000000..b6aa3da33 --- /dev/null +++ b/src/main/java/net/minecraftforge/common/util/Lazy.java @@ -0,0 +1,108 @@ +/* + * Minecraft Forge + * Copyright (c) 2016-2019. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.minecraftforge.common.util; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.function.Supplier; + +/** + * Proxy object for a value that is calculated on first access + * @param The type of the value + */ +public interface Lazy extends Supplier +{ + /** + * Constructs a lazy-initialized object + * @param supplier The supplier for the value, to be called the first time the value is needed. + */ + static Lazy of(@Nonnull Supplier supplier) + { + return new Lazy.Fast<>(supplier); + } + + /** + * Constructs a thread-safe lazy-initialized object + * @param supplier The supplier for the value, to be called the first time the value is needed. + */ + static Lazy concurrentOf(@Nonnull Supplier supplier) + { + return new Lazy.Concurrent<>(supplier); + } + + /** + * Non-thread-safe implementation. + */ + final class Fast implements Lazy + { + private Supplier supplier; + private T instance; + + private Fast(Supplier supplier) + { + this.supplier = supplier; + } + + @Nullable + @Override + public final T get() + { + if (supplier != null) + { + instance = supplier.get(); + supplier = null; + } + return instance; + } + } + + /** + * Thread-safe implementation. + */ + final class Concurrent implements Lazy + { + private static final Object lock = new Object(); + private volatile Supplier supplier; + private volatile T instance; + + private Concurrent(Supplier supplier) + { + this.supplier = supplier; + } + + @Nullable + @Override + public final T get() + { + if (supplier != null) + { + synchronized (lock) + { + if (supplier != null) + { + instance = supplier.get(); + supplier = null; + } + } + } + return instance; + } + } +} diff --git a/src/main/java/net/minecraftforge/common/util/NonNullLazy.java b/src/main/java/net/minecraftforge/common/util/NonNullLazy.java new file mode 100644 index 000000000..1a5437ee6 --- /dev/null +++ b/src/main/java/net/minecraftforge/common/util/NonNullLazy.java @@ -0,0 +1,109 @@ +/* + * Minecraft Forge + * Copyright (c) 2016-2019. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.minecraftforge.common.util; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.function.Supplier; + +/** + * Proxy object for a value that is calculated on first access. + * Same as {@link Lazy}, but with a nonnull contract. + * @param The type of the value + */ +public interface NonNullLazy extends NonNullSupplier +{ + /** + * Constructs a lazy-initialized object + * @param supplier The supplier for the value, to be called the first time the value is needed. + */ + static NonNullLazy of(@Nonnull NonNullSupplier supplier) + { + return new NonNullLazy.Fast<>(supplier); + } + + /** + * Constructs a thread-safe lazy-initialized object + * @param supplier The supplier for the value, to be called the first time the value is needed. + */ + static NonNullLazy concurrentOf(@Nonnull NonNullSupplier supplier) + { + return new NonNullLazy.Concurrent<>(supplier); + } + + /** + * Non-thread-safe implementation. + */ + final class Fast implements NonNullLazy + { + private NonNullSupplier supplier; + private T instance; + + private Fast(NonNullSupplier supplier) + { + this.supplier = supplier; + } + + @Nonnull + @Override + public final T get() + { + if (supplier != null) + { + instance = supplier.get(); + supplier = null; + } + return instance; + } + } + + /** + * Thread-safe implementation. + */ + final class Concurrent implements NonNullLazy + { + private static final Object lock = new Object(); + private volatile NonNullSupplier supplier; + private volatile T instance; + + private Concurrent(NonNullSupplier supplier) + { + this.supplier = supplier; + } + + @Nonnull + @Override + public final T get() + { + if (supplier != null) + { + synchronized (lock) + { + if (supplier != null) + { + instance = supplier.get(); + supplier = null; + } + } + } + return instance; + } + } +} diff --git a/src/main/java/net/minecraftforge/energy/CapabilityEnergy.java b/src/main/java/net/minecraftforge/energy/CapabilityEnergy.java index 470d45bb6..6a1128ca1 100644 --- a/src/main/java/net/minecraftforge/energy/CapabilityEnergy.java +++ b/src/main/java/net/minecraftforge/energy/CapabilityEnergy.java @@ -37,7 +37,7 @@ public class CapabilityEnergy @Override public INBT writeNBT(Capability capability, IEnergyStorage instance, Direction side) { - return new IntNBT(instance.getEnergyStored()); + return IntNBT.func_229692_a_(instance.getEnergyStored()); } @Override diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 325633807..eab14211a 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -25,6 +25,8 @@ import java.util.*; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.block.NetherPortalBlock; import net.minecraft.block.BlockState; import net.minecraft.client.util.ITooltipFlag; @@ -72,6 +74,8 @@ 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.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.ClientChatEvent; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderBlockOverlayEvent; @@ -421,7 +425,7 @@ public class ForgeEventFactory if(isCanceled) { - entityMounting.setPositionAndRotation(entityMounting.posX, entityMounting.posY, entityMounting.posZ, entityMounting.prevRotationYaw, entityMounting.prevRotationPitch); + entityMounting.setPositionAndRotation(entityMounting.func_226277_ct_(), entityMounting.func_226278_cu_(), entityMounting.func_226281_cx_(), entityMounting.prevRotationYaw, entityMounting.prevRotationPitch); return false; } else @@ -440,9 +444,9 @@ public class ForgeEventFactory return event.getResultStatus(); } - public static void onPlayerWakeup(PlayerEntity player, boolean wakeImmediately, boolean updateWorldFlag, boolean setSpawn) + public static void onPlayerWakeup(PlayerEntity player, boolean wakeImmediately, boolean updateWorldFlag) { - MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediately, updateWorldFlag, setSpawn)); + MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediately, updateWorldFlag)); } public static void onPlayerFall(PlayerEntity player, float distance, float multiplier) @@ -523,19 +527,22 @@ public class ForgeEventFactory MinecraftForge.EVENT_BUS.post(new PlayerBrewedPotionEvent(player, stack)); } - public static boolean renderFireOverlay(PlayerEntity player, float renderPartialTicks) + @OnlyIn(Dist.CLIENT) + public static boolean renderFireOverlay(PlayerEntity player, MatrixStack mat) { - return renderBlockOverlay(player, renderPartialTicks, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), new BlockPos(player)); + return renderBlockOverlay(player, mat, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), new BlockPos(player)); } - public static boolean renderWaterOverlay(PlayerEntity player, float renderPartialTicks) + @OnlyIn(Dist.CLIENT) + public static boolean renderWaterOverlay(PlayerEntity player, MatrixStack mat) { - return renderBlockOverlay(player, renderPartialTicks, OverlayType.WATER, Blocks.WATER.getDefaultState(), new BlockPos(player)); + return renderBlockOverlay(player, mat, OverlayType.WATER, Blocks.WATER.getDefaultState(), new BlockPos(player)); } - public static boolean renderBlockOverlay(PlayerEntity player, float renderPartialTicks, OverlayType type, BlockState block, BlockPos pos) + @OnlyIn(Dist.CLIENT) + public static boolean renderBlockOverlay(PlayerEntity player, MatrixStack mat, OverlayType type, BlockState block, BlockPos pos) { - return MinecraftForge.EVENT_BUS.post(new RenderBlockOverlayEvent(player, renderPartialTicks, type, block, pos)); + return MinecraftForge.EVENT_BUS.post(new RenderBlockOverlayEvent(player, mat, type, block, pos)); } @Nullable diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java index c3a56c0e0..c67747f3b 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java @@ -173,7 +173,7 @@ public class LivingSpawnEvent extends LivingEvent { public AllowDespawn(MobEntity entity) { - super(entity, entity.world, entity.posX, entity.posY, entity.posZ); + super(entity, entity.world, entity.func_226277_ct_(), entity.func_226278_cu_(), entity.func_226281_cx_()); } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java deleted file mode 100644 index eb3777c9c..000000000 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java +++ /dev/null @@ -1,39 +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.entity.player; - -import net.minecraft.entity.item.ExperienceOrbEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraftforge.eventbus.api.Cancelable; - -/** - * Use {@link PlayerXpEvent.PickupXp} - */ -@Cancelable -@Deprecated -public class PlayerPickupXpEvent extends PlayerXpEvent.PickupXp -{ - - public PlayerPickupXpEvent(PlayerEntity player, ExperienceOrbEntity orb) - { - super(player, orb); - } - -} diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java index b026f2b91..6046d679e 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java @@ -32,14 +32,11 @@ public class PlayerWakeUpEvent extends PlayerEvent private final boolean updateWorld; - private final boolean setSpawn; - - public PlayerWakeUpEvent(PlayerEntity player, boolean wakeImmediately, boolean updateWorld, boolean setSpawn) + public PlayerWakeUpEvent(PlayerEntity player, boolean wakeImmediately, boolean updateWorld) { super(player); this.wakeImmediately = wakeImmediately; this.updateWorld = updateWorld; - this.setSpawn = setSpawn; } /** @@ -53,10 +50,4 @@ public class PlayerWakeUpEvent extends PlayerEvent * This will only be false if the server is considered 'up to date' already, because, for example, it initiated the call. */ public boolean updateWorld() { return updateWorld; } - - /** - * Indicates if the player's sleep was considered successful. - * In vanilla, this is used to determine if the spawn chunk is to be set to the bed's position. - */ - public boolean shouldSetSpawn() { return setSpawn; } } diff --git a/src/main/java/net/minecraftforge/event/world/PistonEvent.java b/src/main/java/net/minecraftforge/event/world/PistonEvent.java index 1fd171fb0..bfdb11ffe 100644 --- a/src/main/java/net/minecraftforge/event/world/PistonEvent.java +++ b/src/main/java/net/minecraftforge/event/world/PistonEvent.java @@ -21,7 +21,7 @@ package net.minecraftforge.event.world; import javax.annotation.Nullable; -import net.minecraft.block.state.PistonBlockStructureHelper; +import net.minecraft.block.PistonBlockStructureHelper; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -125,4 +125,4 @@ public abstract class PistonEvent extends BlockEvent } } -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraftforge/fluids/FluidAttributes.java b/src/main/java/net/minecraftforge/fluids/FluidAttributes.java index 8c5b265ce..760d03ce7 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidAttributes.java +++ b/src/main/java/net/minecraftforge/fluids/FluidAttributes.java @@ -22,6 +22,7 @@ package net.minecraftforge.fluids; import javax.annotation.Nullable; import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.model.Material; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.IFluidState; import net.minecraft.item.ItemStack; @@ -29,13 +30,11 @@ 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.IEnviromentBlockReader; +import net.minecraft.world.ILightReader; import java.util.function.BiFunction; -import java.util.function.Function; import java.util.stream.Stream; -import net.minecraft.block.material.Material; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -64,11 +63,11 @@ public class FluidAttributes private String translationKey; - private final ResourceLocation stillTexture; - private final ResourceLocation flowingTexture; + private final Material stillTexture; + private final Material flowingTexture; @Nullable - private final ResourceLocation overlayTexture; + private final Material overlayTexture; private final SoundEvent fillSound; private final SoundEvent emptySound; @@ -154,22 +153,22 @@ public class FluidAttributes return new ItemStack(stack.getFluid().getFilledBucket()); } - public BlockState getBlock(IEnviromentBlockReader reader, BlockPos pos, IFluidState state) + public BlockState getBlock(ILightReader reader, BlockPos pos, IFluidState state) { return state.getBlockState(); } - public IFluidState getStateForPlacement(IEnviromentBlockReader reader, BlockPos pos, FluidStack state) + public IFluidState getStateForPlacement(ILightReader reader, BlockPos pos, FluidStack state) { return state.getFluid().getDefaultState(); } - public final boolean canBePlacedInWorld(IEnviromentBlockReader reader, BlockPos pos, IFluidState state) + public final boolean canBePlacedInWorld(ILightReader reader, BlockPos pos, IFluidState state) { return !getBlock(reader, pos, state).isAir(reader, pos); } - public final boolean canBePlacedInWorld(IEnviromentBlockReader reader, BlockPos pos, FluidStack state) + public final boolean canBePlacedInWorld(ILightReader reader, BlockPos pos, FluidStack state) { return !getBlock(reader, pos, getStateForPlacement(reader, pos, state)).isAir(reader, pos); } @@ -188,12 +187,12 @@ 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(IEnviromentBlockReader reader, BlockPos pos, FluidStack fluidStack) + public boolean doesVaporize(ILightReader reader, BlockPos pos, FluidStack fluidStack) { BlockState blockstate = getBlock(reader, pos, getStateForPlacement(reader, pos, fluidStack)); if (blockstate == null) return false; - return blockstate.getMaterial() == Material.WATER; + return blockstate.getMaterial() == net.minecraft.block.material.Material.WATER; } /** @@ -276,18 +275,18 @@ public class FluidAttributes return color; } - public ResourceLocation getStillTexture() + public Material getStillMaterial() { return stillTexture; } - public ResourceLocation getFlowingTexture() + public Material getFlowingMaterial() { return flowingTexture; } @Nullable - public ResourceLocation getOverlayTexture() + public Material getOverlayMaterial() { return overlayTexture; } @@ -310,29 +309,29 @@ public class FluidAttributes public boolean isGaseous(FluidStack stack){ return isGaseous(); } public Rarity getRarity(FluidStack stack){ return getRarity(); } public int getColor(FluidStack stack){ return getColor(); } - public ResourceLocation getStill(FluidStack stack) { return getStillTexture(); } - public ResourceLocation getFlowing(FluidStack stack) { return getFlowingTexture(); } + public Material getStillMaterial(FluidStack stack) { return getStillMaterial(); } + public Material getFlowingMaterial(FluidStack stack) { return getFlowingMaterial(); } public SoundEvent getFillSound(FluidStack stack) { return getFillSound(); } public SoundEvent getEmptySound(FluidStack stack) { return getEmptySound(); } /* World-based Accessors */ - public int getLuminosity(IEnviromentBlockReader world, BlockPos pos){ return getLuminosity(); } - public int getDensity(IEnviromentBlockReader world, BlockPos pos){ return getDensity(); } - public int getTemperature(IEnviromentBlockReader world, BlockPos pos){ return getTemperature(); } - public int getViscosity(IEnviromentBlockReader world, BlockPos pos){ return getViscosity(); } - public boolean isGaseous(IEnviromentBlockReader world, BlockPos pos){ return isGaseous(); } - public Rarity getRarity(IEnviromentBlockReader world, BlockPos pos){ return getRarity(); } - public int getColor(IEnviromentBlockReader world, BlockPos pos){ return getColor(); } - public ResourceLocation getStill(IEnviromentBlockReader world, BlockPos pos) { return getStillTexture(); } - public ResourceLocation getFlowing(IEnviromentBlockReader world, BlockPos pos) { return getFlowingTexture(); } - public SoundEvent getFillSound(IEnviromentBlockReader world, BlockPos pos) { return getFillSound(); } - public SoundEvent getEmptySound(IEnviromentBlockReader world, BlockPos pos) { return getEmptySound(); } + 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 Material getStillMaterial(ILightReader world, BlockPos pos) { return getStillMaterial(); } + public Material getFlowingMaterial(ILightReader world, BlockPos pos) { return getFlowingMaterial(); } + public SoundEvent getFillSound(ILightReader world, BlockPos pos) { return getFillSound(); } + public SoundEvent getEmptySound(ILightReader world, BlockPos pos) { return getEmptySound(); } - public static Builder builder(ResourceLocation stillTexture, ResourceLocation flowingTexture) { + public static Builder builder(Material stillTexture, Material flowingTexture) { return new Builder(stillTexture, flowingTexture, FluidAttributes::new); } - public Stream getTextures() + public Stream getTextures() { if (overlayTexture != null) return Stream.of(stillTexture, flowingTexture, overlayTexture); @@ -341,9 +340,9 @@ public class FluidAttributes public static class Builder { - private final ResourceLocation stillTexture; - private final ResourceLocation flowingTexture; - private ResourceLocation overlayTexture; + private final Material stillTexture; + private final Material flowingTexture; + private Material overlayTexture; private int color = 0xFFFFFFFF; private String translationKey; private SoundEvent fillSound; @@ -356,7 +355,7 @@ public class FluidAttributes private Rarity rarity = Rarity.COMMON; private BiFunction factory; - protected Builder(ResourceLocation stillTexture, ResourceLocation flowingTexture, BiFunction factory) { + protected Builder(Material stillTexture, Material flowingTexture, BiFunction factory) { this.factory = factory; this.stillTexture = stillTexture; this.flowingTexture = flowingTexture; @@ -374,7 +373,7 @@ public class FluidAttributes return this; } - public final Builder overlay(ResourceLocation texture) + public final Builder overlay(Material texture) { overlayTexture = texture; return this; @@ -443,12 +442,12 @@ public class FluidAttributes } @Override - public int getColor(IEnviromentBlockReader world, BlockPos pos) + public int getColor(ILightReader world, BlockPos pos) { - return BiomeColors.getWaterColor(world, pos) | 0xFF000000; + return BiomeColors.func_228363_c_(world, pos) | 0xFF000000; } - public static Builder builder(ResourceLocation stillTexture, ResourceLocation flowingTexture) { + public static Builder builder(Material stillTexture, Material flowingTexture) { return new Builder(stillTexture, flowingTexture, Water::new); } } diff --git a/src/main/java/net/minecraftforge/fluids/FluidUtil.java b/src/main/java/net/minecraftforge/fluids/FluidUtil.java index 6fb01f182..d953fd910 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidUtil.java +++ b/src/main/java/net/minecraftforge/fluids/FluidUtil.java @@ -143,7 +143,7 @@ public class FluidUtil if (player != null) { SoundEvent soundevent = simulatedTransfer.getFluid().getAttributes().getFillSound(simulatedTransfer); - player.world.playSound(null, player.posX, player.posY + 0.5, player.posZ, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F); + player.world.playSound(null, player.func_226277_ct_(), player.func_226278_cu_() + 0.5, player.func_226281_cx_(), soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F); } } else @@ -187,7 +187,7 @@ public class FluidUtil if (doDrain && player != null) { SoundEvent soundevent = transfer.getFluid().getAttributes().getEmptySound(transfer); - player.world.playSound(null, player.posX, player.posY + 0.5, player.posZ, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F); + player.world.playSound(null, player.func_226277_ct_(), player.func_226278_cu_() + 0.5, player.func_226281_cx_(), soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F); } ItemStack resultContainer = containerFluidHandler.getContainer(); @@ -497,7 +497,7 @@ public class FluidUtil * * @param player Player who places the fluid. May be null for blocks like dispensers. * @param world World to place the fluid in - * @param hand + * @param hand * @param pos The position in the world to place the fluid block * @param container The fluid container holding the fluidStack to place * @param resource The fluidStack to place @@ -524,7 +524,7 @@ public class FluidUtil * * @param player Player who places the fluid. May be null for blocks like dispensers. * @param world World to place the fluid in - * @param hand + * @param hand * @param pos The position in the world to place the fluid block * @param fluidSource The fluid source holding the fluidStack to place * @param resource The fluidStack to place. diff --git a/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java b/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java index b2d82d220..5b52cd8ca 100644 --- a/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java +++ b/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java @@ -31,7 +31,6 @@ import net.minecraft.item.Items; import net.minecraft.state.StateContainer; import net.minecraft.tags.FluidTags; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; @@ -54,7 +53,7 @@ public abstract class ForgeFlowingFluid extends FlowingFluid private final int slopeFindDistance; private final int levelDecreasePerBlock; private final float explosionResistance; - private final BlockRenderLayer renderLayer; + //private final BlockRenderLayer renderLayer; // TODO: reimplement private final int tickRate; protected ForgeFlowingFluid(Properties properties) @@ -68,7 +67,7 @@ public abstract class ForgeFlowingFluid extends FlowingFluid this.slopeFindDistance = properties.slopeFindDistance; this.levelDecreasePerBlock = properties.levelDecreasePerBlock; this.explosionResistance = properties.explosionResistance; - this.renderLayer = properties.renderLayer; + //this.renderLayer = properties.renderLayer; this.tickRate = properties.tickRate; } @@ -109,11 +108,11 @@ public abstract class ForgeFlowingFluid extends FlowingFluid return levelDecreasePerBlock; } - @Override + /*@Override public BlockRenderLayer getRenderLayer() { return renderLayer; - } + }*/ @Override public Item getFilledBucket() @@ -208,7 +207,7 @@ public abstract class ForgeFlowingFluid extends FlowingFluid private int slopeFindDistance = 4; private int levelDecreasePerBlock = 1; private float explosionResistance = 1; - private BlockRenderLayer renderLayer = BlockRenderLayer.TRANSLUCENT; + //private BlockRenderLayer renderLayer = BlockRenderLayer.TRANSLUCENT; private int tickRate = 5; public Properties(Supplier still, Supplier flowing, FluidAttributes.Builder attributes) @@ -254,10 +253,10 @@ public abstract class ForgeFlowingFluid extends FlowingFluid return this; } - public Properties renderLayer(BlockRenderLayer layer) + /*public Properties renderLayer(BlockRenderLayer layer) { this.renderLayer = layer; return this; - } + }*/ } } diff --git a/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java b/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java index a932b5771..7067541ea 100644 --- a/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java +++ b/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java @@ -38,6 +38,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.ClientResourcePackInfo; @@ -93,7 +94,7 @@ public class ClientModLoader SidedProvider.setClient(()->minecraft); LogicalSidedProvider.setClient(()->minecraft); LanguageHook.loadForgeAndMCLangs(); - earlyLoaderGUI = new EarlyLoaderGUI(minecraft.mainWindow); + earlyLoaderGUI = new EarlyLoaderGUI(minecraft.func_228018_at_()); createRunnableWithCatch(() -> ModLoader.get().gatherAndInitializeMods(earlyLoaderGUI::renderTick)).run(); ResourcePackLoader.loadResourcePacks(defaultResourcePacks, ClientModLoader::buildPackFinder); mcResourceManager.addReloadListener(ClientModLoader::onreload); @@ -152,8 +153,8 @@ public class ClientModLoader public static boolean completeModLoading() { - GlStateManager.disableTexture(); - GlStateManager.enableTexture(); + RenderSystem.disableTexture(); + RenderSystem.enableTexture(); List warnings = ModLoader.get().getWarnings(); boolean showWarnings = true; try { @@ -215,7 +216,7 @@ public class ClientModLoader hiddenPacks.add(e.getValue()); } } - final T packInfo = ResourcePackInfo.createResourcePack("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources", + final T packInfo = ResourcePackInfo.createResourcePack("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources", new PackMetadataSection(new TranslationTextComponent("fml.resources.modresources", hiddenPacks.size()), 4), hiddenPacks), factory, ResourcePackInfo.Priority.BOTTOM); packList.put("mod_resources", packInfo); diff --git a/src/main/java/net/minecraftforge/fml/client/EarlyLoaderGUI.java b/src/main/java/net/minecraftforge/fml/client/EarlyLoaderGUI.java index 43fa83158..45cbcb310 100644 --- a/src/main/java/net/minecraftforge/fml/client/EarlyLoaderGUI.java +++ b/src/main/java/net/minecraftforge/fml/client/EarlyLoaderGUI.java @@ -20,6 +20,8 @@ package net.minecraftforge.fml.client; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.util.math.MathHelper; @@ -41,9 +43,9 @@ public class EarlyLoaderGUI { public EarlyLoaderGUI(final MainWindow window) { this.window = window; - GlStateManager.clearColor(1.0f, 1.0f, 1.0f, 1.0f); - GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC); - window.update(false); + RenderSystem.clearColor(1.0f, 1.0f, 1.0f, 1.0f); + RenderSystem.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC); + window.update(); } public void handleElsewhere() { @@ -59,11 +61,10 @@ public class EarlyLoaderGUI { int guiScale = window.calcGuiScale(0, false); window.setGuiScale(guiScale); - GlStateManager.clearColor(1.0f, 1.0f, 1.0f, 1.0f); - GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC); - window.loadGUIRenderMatrix(Minecraft.IS_RUNNING_ON_MAC); + RenderSystem.clearColor(1.0f, 1.0f, 1.0f, 1.0f); + RenderSystem.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC); renderMessages(); - window.update(false); + window.update(); } private void renderMessages() { @@ -94,20 +95,20 @@ public class EarlyLoaderGUI { } void renderMessage(final String message, final float[] colour, int line, float alpha) { - GlStateManager.enableClientState(GL11.GL_VERTEX_ARRAY); + GlStateManager.func_227770_y_(GL11.GL_VERTEX_ARRAY); ByteBuffer charBuffer = MemoryUtil.memAlloc(message.length() * 270); int quads = STBEasyFont.stb_easy_font_print(0, 0, message, null, charBuffer); - GlStateManager.vertexPointer(2, GL11.GL_FLOAT, 16, charBuffer); + GL14.glVertexPointer(2, GL11.GL_FLOAT, 16, charBuffer); - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); GL14.glBlendColor(0,0,0, alpha); - GlStateManager.blendFunc(GlStateManager.SourceFactor.CONSTANT_ALPHA, GlStateManager.DestFactor.ONE_MINUS_CONSTANT_ALPHA); - GlStateManager.color3f(colour[0],colour[1],colour[2]); - GlStateManager.pushMatrix(); - GlStateManager.translatef(10, line * 10, 0); - GlStateManager.scalef(1, 1, 0); - GlStateManager.drawArrays(GL11.GL_QUADS, 0, quads * 4); - GlStateManager.popMatrix(); + RenderSystem.blendFunc(GlStateManager.SourceFactor.CONSTANT_ALPHA, GlStateManager.DestFactor.ONE_MINUS_CONSTANT_ALPHA); + RenderSystem.color3f(colour[0],colour[1],colour[2]); + RenderSystem.pushMatrix(); + RenderSystem.translatef(10, line * 10, 0); + RenderSystem.scalef(1, 1, 0); + RenderSystem.drawArrays(GL11.GL_QUADS, 0, quads * 4); + RenderSystem.popMatrix(); MemoryUtil.memFree(charBuffer); } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java b/src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java index c293bdf68..666f432ba 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java @@ -20,11 +20,8 @@ package net.minecraftforge.fml.client.config; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.client.gui.widget.button.Button.IPressable; - /** * This class provides a button that fixes several bugs present in the vanilla GuiButton drawing code. * The gist of it is that it allows buttons of any size without gaps in the graphics and with the @@ -53,7 +50,7 @@ public class GuiButtonExt extends Button 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.blitOffset); + 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); int color = 14737632; diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java b/src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java index 0b126647b..5d7d87cd1 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java @@ -23,8 +23,6 @@ import net.minecraft.client.Minecraft; import javax.annotation.Nullable; -import net.minecraft.client.gui.widget.button.Button.IPressable; - /** * This class is blatantly stolen from iChunUtils with permission. * @@ -116,7 +114,7 @@ public class GuiSlider extends GuiButtonExt 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.blitOffset); + 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()); } } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java b/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java index 0dacc75b9..cdf255238 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java @@ -19,13 +19,11 @@ package net.minecraftforge.fml.client.config; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.client.gui.widget.button.Button.IPressable; - /** * This class provides a button that shows a string glyph at the beginning. The glyph can be scaled using the glyphScale parameter. * @@ -51,7 +49,7 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt 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.blitOffset); + 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); String buttonText = this.getMessage(); @@ -66,12 +64,12 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt strWidth = mc.fontRenderer.getStringWidth(buttonText); totalWidth = glyphWidth + strWidth; - GlStateManager.pushMatrix(); - GlStateManager.scalef(glyphScale, glyphScale, 1.0F); + 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()); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); 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/client/config/GuiUtils.java b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java index 78c443a63..808d91ea6 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java @@ -22,9 +22,10 @@ package net.minecraftforge.fml.client.config; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.AbstractGui; -import net.minecraft.client.renderer.RenderHelper; 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; @@ -33,7 +34,8 @@ import net.minecraftforge.common.MinecraftForge; import org.lwjgl.opengl.GL11; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; import java.util.ArrayList; import java.util.List; @@ -153,9 +155,9 @@ public class GuiUtils public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel) { - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.enableBlend(); - GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.enableBlend(); + RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); int fillerWidth = textureWidth - leftBorder - rightBorder; int fillerHeight = textureHeight - topBorder - bottomBorder; @@ -206,10 +208,10 @@ public class GuiUtils Tessellator tessellator = Tessellator.getInstance(); BufferBuilder wr = tessellator.getBuffer(); wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); - wr.pos(x , y + height, zLevel).tex( u * uScale, ((v + height) * vScale)).endVertex(); - wr.pos(x + width, y + height, zLevel).tex((u + width) * uScale, ((v + height) * vScale)).endVertex(); - wr.pos(x + width, y , zLevel).tex((u + width) * uScale, ( v * vScale)).endVertex(); - wr.pos(x , y , zLevel).tex( u * uScale, ( v * vScale)).endVertex(); + wr.func_225582_a_(x , y + height, zLevel).func_225583_a_( u * uScale, ((v + height) * vScale)).endVertex(); + wr.func_225582_a_(x + width, y + height, zLevel).func_225583_a_((u + width) * uScale, ((v + height) * vScale)).endVertex(); + wr.func_225582_a_(x + width, y , zLevel).func_225583_a_((u + width) * uScale, ( v * vScale)).endVertex(); + wr.func_225582_a_(x , y , zLevel).func_225583_a_( u * uScale, ( v * vScale)).endVertex(); tessellator.draw(); } @@ -264,9 +266,8 @@ public class GuiUtils if (!textLines.isEmpty()) { RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font); - if (MinecraftForge.EVENT_BUS.post(event)) { + if (MinecraftForge.EVENT_BUS.post(event)) return; - } mouseX = event.getX(); mouseY = event.getY(); screenWidth = event.getScreenWidth(); @@ -274,20 +275,15 @@ public class GuiUtils maxTextWidth = event.getMaxWidth(); font = event.getFontRenderer(); - GlStateManager.disableRescaleNormal(); - RenderHelper.disableStandardItemLighting(); - GlStateManager.disableLighting(); - GlStateManager.disableDepthTest(); + RenderSystem.disableRescaleNormal(); + RenderSystem.disableDepthTest(); int tooltipTextWidth = 0; for (String textLine : textLines) { int textLineWidth = font.getStringWidth(textLine); - if (textLineWidth > tooltipTextWidth) - { tooltipTextWidth = textLineWidth; - } } boolean needsWrap = false; @@ -300,13 +296,9 @@ public class GuiUtils if (tooltipX < 4) // if the tooltip doesn't fit on the screen { if (mouseX > screenWidth / 2) - { tooltipTextWidth = mouseX - 12 - 8; - } else - { tooltipTextWidth = screenWidth - 16 - mouseX; - } needsWrap = true; } } @@ -326,17 +318,13 @@ public class GuiUtils String textLine = textLines.get(i); List wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth); if (i == 0) - { titleLinesCount = wrappedLine.size(); - } for (String line : wrappedLine) { int lineWidth = font.getStringWidth(line); if (lineWidth > wrappedTooltipWidth) - { wrappedTooltipWidth = lineWidth; - } wrappedTextLines.add(line); } } @@ -344,13 +332,9 @@ public class GuiUtils textLines = wrappedTextLines; if (mouseX > screenWidth / 2) - { tooltipX = mouseX - 16 - tooltipTextWidth; - } else - { tooltipX = mouseX + 12; - } } int tooltipY = mouseY - 12; @@ -359,19 +343,14 @@ public class GuiUtils if (textLines.size() > 1) { tooltipHeight += (textLines.size() - 1) * 10; - if (textLines.size() > titleLinesCount) { + if (textLines.size() > titleLinesCount) tooltipHeight += 2; // gap between title lines and next lines - } } if (tooltipY < 4) - { tooltipY = 4; - } else if (tooltipY + tooltipHeight + 4 > screenHeight) - { tooltipY = screenHeight - tooltipHeight - 4; - } final int zLevel = 300; int backgroundColor = 0xF0100010; @@ -382,6 +361,7 @@ public class GuiUtils backgroundColor = colorEvent.getBackground(); 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); @@ -393,27 +373,32 @@ public class GuiUtils drawGradientRect(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.func_228455_a_(Tessellator.getInstance().getBuffer()); + MatrixStack textStack = new MatrixStack(); + textStack.func_227861_a_(0.0D, 0.0D, (double)zLevel); + Matrix4f textLocation = textStack.func_227866_c_().func_227870_a_(); + int tooltipTop = tooltipY; for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) { String line = textLines.get(lineNumber); - font.drawStringWithShadow(line, (float)tooltipX, (float)tooltipY, -1); + if (line != null) + font.func_228079_a_(line, (float)tooltipX, (float)tooltipY, -1, true, textLocation, renderType, false, 0, 15728880); if (lineNumber + 1 == titleLinesCount) - { tooltipY += 2; - } tooltipY += 10; } + renderType.func_228461_a_(); + MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, textLines, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight)); - GlStateManager.enableLighting(); - GlStateManager.enableDepthTest(); - RenderHelper.enableStandardItemLighting(); - GlStateManager.enableRescaleNormal(); + RenderSystem.enableDepthTest(); + RenderSystem.enableRescaleNormal(); } } @@ -428,25 +413,25 @@ public class GuiUtils float endGreen = (float)(endColor >> 8 & 255) / 255.0F; float endBlue = (float)(endColor & 255) / 255.0F; - GlStateManager.disableTexture(); - GlStateManager.enableBlend(); - GlStateManager.disableAlphaTest(); - GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.shadeModel(GL11.GL_SMOOTH); + 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.func_225582_a_(right, top, zLevel).func_227885_a_(startRed, startGreen, startBlue, startAlpha).endVertex(); + buffer.func_225582_a_( left, top, zLevel).func_227885_a_(startRed, startGreen, startBlue, startAlpha).endVertex(); + buffer.func_225582_a_( left, bottom, zLevel).func_227885_a_( endRed, endGreen, endBlue, endAlpha).endVertex(); + buffer.func_225582_a_(right, bottom, zLevel).func_227885_a_( endRed, endGreen, endBlue, endAlpha).endVertex(); tessellator.draw(); - GlStateManager.shadeModel(GL11.GL_FLAT); - GlStateManager.disableBlend(); - GlStateManager.enableAlphaTest(); - GlStateManager.enableTexture(); + 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) diff --git a/src/main/java/net/minecraftforge/fml/client/gui/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/gui/GuiModList.java index 9b6ed459a..eac47df2f 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/GuiModList.java @@ -37,7 +37,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.maven.artifact.versioning.ComparableVersion; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -191,8 +191,8 @@ public class GuiModList extends Screen { if (logoPath != null) { Minecraft.getInstance().getTextureManager().bindTexture(logoPath); - GlStateManager.enableBlend(); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.enableBlend(); + 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, relativeY, width - 5, headerHeight, logoDims.width, logoDims.height, false, true); @@ -203,10 +203,10 @@ public class GuiModList extends Screen { if (line != null) { - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); GuiModList.this.font.drawStringWithShadow(line.getFormattedText(), left + 4, relativeY, 0xFFFFFF); - GlStateManager.disableAlphaTest(); - GlStateManager.disableBlend(); + RenderSystem.disableAlphaTest(); + RenderSystem.disableBlend(); } relativeY += font.FONT_HEIGHT; } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/GuiSlotModList.java b/src/main/java/net/minecraftforge/fml/client/gui/GuiSlotModList.java index bff28410e..cac95935b 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/GuiSlotModList.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/GuiSlotModList.java @@ -29,7 +29,7 @@ import net.minecraftforge.fml.MavenVersionStringHelper; import net.minecraftforge.fml.VersionChecker; import net.minecraftforge.fml.loading.moddiscovery.ModInfo; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; public class GuiSlotModList extends ExtendedList { @@ -92,10 +92,10 @@ public class GuiSlotModList extends ExtendedList { //TODO: Consider adding more icons for visualization Minecraft.getInstance().getTextureManager().bindTexture(VERSION_CHECK_ICONS); - GlStateManager.color4f(1, 1, 1, 1); - GlStateManager.pushMatrix(); + RenderSystem.color4f(1, 1, 1, 1); + RenderSystem.pushMatrix(); AbstractGui.blit(getRight() - (height / 2 + 4), GuiSlotModList.this.getTop() + (height / 2 - 4), vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); } } diff --git a/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java b/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java index 8c099a8d8..3f43349dc 100644 --- a/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java +++ b/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java @@ -21,6 +21,7 @@ package net.minecraftforge.fml.client.registry; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.ArrayUtils; @@ -41,10 +42,9 @@ public class ClientRegistry * Call this during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent}. * This method is safe to call during parallel mod loading. */ - public static synchronized void bindTileEntitySpecialRenderer(Class tileEntityClass, TileEntityRenderer specialRenderer) + public static synchronized void bindTileEntityRenderer(TileEntityType tileEntityType, TileEntityRenderer specialRenderer) { - TileEntityRendererDispatcher.instance.setSpecialRenderer(tileEntityClass, specialRenderer); - specialRenderer.setRendererDispatcher(TileEntityRendererDispatcher.instance); + TileEntityRendererDispatcher.instance.setSpecialRendererInternal(tileEntityType, specialRenderer); } /** diff --git a/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java b/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java index 19b97ebcc..3655e20bf 100644 --- a/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java +++ b/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java @@ -25,12 +25,13 @@ import java.util.concurrent.ConcurrentHashMap; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; public class RenderingRegistry { private static final RenderingRegistry INSTANCE = new RenderingRegistry(); - private final Map, IRenderFactory> entityRenderers = new ConcurrentHashMap<>(); + private final Map, IRenderFactory> entityRenderers = new ConcurrentHashMap<>(); /** * Register an entity rendering handler. This will, after mod initialization, be inserted into the main @@ -38,7 +39,7 @@ public class RenderingRegistry * Call this during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent}. * This method is safe to call during parallel mod loading. */ - public static void registerEntityRenderingHandler(Class entityClass, IRenderFactory renderFactory) + public static void registerEntityRenderingHandler(EntityType entityClass, IRenderFactory renderFactory) { INSTANCE.entityRenderers.put(entityClass, renderFactory); } @@ -49,8 +50,8 @@ public class RenderingRegistry } @SuppressWarnings("unchecked") - private static void register(EntityRendererManager manager, Class entityClass, IRenderFactory renderFactory) + private static void register(EntityRendererManager manager, EntityType entityType, IRenderFactory renderFactory) { - manager.register(entityClass, ((IRenderFactory)renderFactory).createRenderFor(manager)); + manager.func_229087_a_(entityType, ((IRenderFactory)renderFactory).createRenderFor(manager)); } } diff --git a/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java b/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java index 209ec8730..fd7e3faa3 100644 --- a/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java +++ b/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java @@ -34,6 +34,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; 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; @@ -72,9 +73,9 @@ public class FMLPlayMessages this.typeId = Registry.ENTITY_TYPE.getId(e.getType()); this.entityId = e.getEntityId(); this.uuid = e.getUniqueID(); - this.posX = e.posX; - this.posY = e.posY; - this.posZ = e.posZ; + this.posX = e.func_226277_ct_(); + this.posY = e.func_226278_cu_(); + this.posZ = e.func_226281_cx_(); 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); @@ -357,7 +358,7 @@ public class FMLPlayMessages // default to overworld if no moddim found if (modDim == null) return DimensionType.OVERWORLD; modDim.read(extraData, true); - return new DimensionType(id, "dummy", "dummy", modDim.getFactory(), skylight, modDim, extraData); + return new DimensionType(id, "dummy", "dummy", modDim.getFactory(), skylight, FuzzedBiomeMagnifier.INSTANCE, modDim, extraData); } public static boolean handle(final DimensionInfoMessage message, final Supplier contextSupplier) { diff --git a/src/main/java/net/minecraftforge/fml/packs/DelegatableResourcePack.java b/src/main/java/net/minecraftforge/fml/packs/DelegatableResourcePack.java index 9afa8fbbf..61c37784a 100644 --- a/src/main/java/net/minecraftforge/fml/packs/DelegatableResourcePack.java +++ b/src/main/java/net/minecraftforge/fml/packs/DelegatableResourcePack.java @@ -1,3 +1,22 @@ +/* + * 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.packs; import java.io.File; diff --git a/src/main/java/net/minecraftforge/fml/packs/DelegatingResourcePack.java b/src/main/java/net/minecraftforge/fml/packs/DelegatingResourcePack.java index 04cfbdb4c..0852a4578 100644 --- a/src/main/java/net/minecraftforge/fml/packs/DelegatingResourcePack.java +++ b/src/main/java/net/minecraftforge/fml/packs/DelegatingResourcePack.java @@ -1,3 +1,22 @@ +/* + * 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.packs; import java.io.File; @@ -63,12 +82,12 @@ public class DelegatingResourcePack extends ResourcePack } @Override - public Collection getAllResourceLocations(ResourcePackType type, String pathIn, int maxDepth, Predicate filter) + public Collection func_225637_a_(ResourcePackType type, String pathIn, String pathIn2, int maxDepth, Predicate filter) { synchronized(delegates) { return delegates.stream() - .flatMap(r -> r.getAllResourceLocations(type, pathIn, maxDepth, filter).stream()) + .flatMap(r -> r.func_225637_a_(type, pathIn, pathIn2, maxDepth, filter).stream()) .collect(Collectors.toList()); } } diff --git a/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java b/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java index 785d93a1f..b1720c6a2 100644 --- a/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java +++ b/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java @@ -86,8 +86,9 @@ public class ModFileResourcePack extends DelegatableResourcePack return Files.exists(modFile.getLocator().findPath(modFile, name)); } + @Override - public Collection getAllResourceLocations(ResourcePackType type, String pathIn, int maxDepth, Predicate filter) + public Collection func_225637_a_(ResourcePackType type, String resourceNamespace, String pathIn, int maxDepth, Predicate filter) { try { diff --git a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java index 75ef1a466..dadebf4e5 100644 --- a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java +++ b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java @@ -25,7 +25,6 @@ import net.minecraft.util.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.items.wrapper.PlayerMainInvWrapper; @@ -184,14 +183,14 @@ public class ItemHandlerHelper // play sound if something got picked up if (remainder.isEmpty() || remainder.getCount() != stack.getCount()) { - world.playSound(null, player.posX, player.posY + 0.5, player.posZ, + world.playSound(null, player.func_226277_ct_(), player.func_226278_cu_() + 0.5, player.func_226281_cx_(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); } // drop remaining itemstack into the world if (!remainder.isEmpty() && !world.isRemote) { - ItemEntity entityitem = new ItemEntity(world, player.posX, player.posY + 0.5, player.posZ, remainder); + ItemEntity entityitem = new ItemEntity(world, player.func_226277_ct_(), player.func_226278_cu_() + 0.5, player.func_226281_cx_(), remainder); entityitem.setPickupDelay(40); entityitem.setMotion(entityitem.getMotion().mul(0, 1, 0)); diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java index 7ca1f0aab..5b1399a96 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java @@ -855,7 +855,7 @@ public class ForgeRegistry> implements IForgeRe data.putIntArray("blocked", blocked); ListNBT dummied = new ListNBT(); - this.dummied.stream().sorted().forEach(e -> dummied.add(new StringNBT(e.toString()))); + this.dummied.stream().sorted().forEach(e -> dummied.add(StringNBT.func_229705_a_(e.toString()))); data.put("dummied", dummied); return data; diff --git a/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java b/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java index 5a65db500..6042c81e5 100644 --- a/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java +++ b/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java @@ -22,10 +22,10 @@ package net.minecraftforge.server.command; import net.minecraft.command.ICommandSource; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.network.play.ServerPlayNetHandler; +import net.minecraft.util.text.LanguageMap; import net.minecraft.util.text.TextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.util.text.translation.LanguageMap; import net.minecraftforge.fml.network.ConnectionType; import net.minecraftforge.fml.network.NetworkHooks; diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 176b8ede7..d02cfbd9e 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -6,6 +6,7 @@ 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-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 @@ -24,29 +25,30 @@ protected net.minecraft.client.gui.widget.list.AbstractList$AbstractListEntry li public net.minecraft.client.particle.ParticleManager func_199283_a(Lnet/minecraft/particles/ParticleType;Lnet/minecraft/client/particle/IParticleFactory;)V # registerFactory public net.minecraft.client.particle.ParticleManager func_215234_a(Lnet/minecraft/particles/ParticleType;Lnet/minecraft/client/particle/ParticleManager$IParticleMetaFactory;)V # registerFactory public net.minecraft.client.particle.ParticleManager$IParticleMetaFactory -public net.minecraft.client.renderer.BufferBuilder func_178972_a(IIII)V # putColorRGB -- Add A? -public net.minecraft.client.renderer.BufferBuilder func_78909_a(I)I # getColorIndex public net.minecraft.client.renderer.GameRenderer func_175069_a(Lnet/minecraft/util/ResourceLocation;)V #loadShader private net.minecraft.client.renderer.ItemModelMesher field_199313_a -public net.minecraft.client.renderer.ItemRenderer func_191970_a(Lnet/minecraft/client/renderer/BufferBuilder;Ljava/util/List;ILnet/minecraft/item/ItemStack;)V # renderQuads +public net.minecraft.client.renderer.ItemRenderer func_229112_a_(Lcom/mojang/blaze3d/matrix/MatrixStack;Lcom/mojang/blaze3d/vertex/IVertexBuilder;Ljava/util/List;Lnet/minecraft/item/ItemStack;II)V # renderQuads public net.minecraft.client.renderer.entity.EntityRendererManager field_78729_o #renderers -public net.minecraft.client.renderer.entity.EntityRendererManager func_217782_a(Ljava/lang/Class;Lnet/minecraft/client/renderer/entity/EntityRenderer;)V # addRenderer +public net.minecraft.client.renderer.entity.EntityRendererManager func_229087_a_(Lnet/minecraft/entity/EntityType;Lnet/minecraft/client/renderer/entity/EntityRenderer;)V # addRenderer protected net.minecraft.client.renderer.entity.ItemRenderer func_177078_a(Lnet/minecraft/item/ItemStack;)I # getMiniItemCount public net.minecraft.client.renderer.entity.LivingRenderer func_177094_a(Lnet/minecraft/client/renderer/entity/layers/LayerRenderer;)Z # addLayer +public net.minecraft.client.renderer.model.BlockFaceUV$Deserializer ()V public net.minecraft.client.renderer.model.BlockModel field_178315_d # parent public net.minecraft.client.renderer.model.BlockModel field_178318_c # textures public net.minecraft.client.renderer.model.BlockModel field_178322_i # ambientOcclusion public net.minecraft.client.renderer.model.BlockModel func_187966_f()Ljava/util/List; # getOverrides public net.minecraft.client.renderer.model.BlockPart func_178236_a(Lnet/minecraft/util/Direction;)[F # getFaceUvs +public net.minecraft.client.renderer.model.BlockPart$Deserializer ()V +public net.minecraft.client.renderer.model.BlockPartFace$Deserializer ()V +public net.minecraft.client.renderer.model.ItemOverride$Deserializer ()V protected net.minecraft.client.renderer.model.ItemOverrideList ()V -public net.minecraft.client.renderer.model.ItemTransformVec3f$Deserializer field_178362_a # ROTATION_DEFAULT public net.minecraft.client.renderer.model.ItemTransformVec3f$Deserializer field_178360_b # TRANSLATION_DEFAULT public net.minecraft.client.renderer.model.ItemTransformVec3f$Deserializer field_178361_c # SCALE_DEFAULT +public net.minecraft.client.renderer.model.ItemTransformVec3f$Deserializer field_178362_a # ROTATION_DEFAULT protected net.minecraft.client.renderer.model.ModelBakery field_177598_f # resourceManager protected net.minecraft.client.renderer.model.ModelBakery field_177602_b # LOCATIONS_BUILTIN_TEXTURES public net.minecraft.client.renderer.model.ModelBakery field_177604_a # MODEL_MISSING protected net.minecraft.client.renderer.model.ModelBakery field_177606_o # MODEL_GENERATED -protected net.minecraft.client.renderer.model.ModelBakery field_177609_j # textureMap protected net.minecraft.client.renderer.model.ModelBakery field_177616_r # MODEL_ENTITY private-f net.minecraft.client.renderer.model.ModelBakery field_217853_J # field_217853_J - need to un-finalize so that we can delay initialization to after calling super() in ModelLoader protected net.minecraft.client.renderer.model.ModelBakery func_177594_c(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/model/BlockModel; # loadModel @@ -60,37 +62,36 @@ protected net.minecraft.data.RecipeProvider func_200403_a(Lnet/minecraft/util/II protected net.minecraft.data.RecipeProvider func_200404_a(Ljava/util/function/Consumer;)V # registerRecipes protected net.minecraft.data.RecipeProvider func_200405_a([Lnet/minecraft/advancements/criterion/ItemPredicate;)Lnet/minecraft/advancements/criterion/InventoryChangeTrigger$Instance; # hasItem protected net.minecraft.data.RecipeProvider func_200407_a(Lnet/minecraft/block/Block;)Lnet/minecraft/advancements/criterion/EnterBlockTrigger$Instance; # enteredBlock -protected net.minecraft.data.RecipeProvider func_200408_a(Lnet/minecraft/advancements/criterion/MinMaxBounds$IntBound;Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/advancements/criterion/InventoryChangeTrigger$Instance; # hasItem protected net.minecraft.data.RecipeProvider func_200409_a(Lnet/minecraft/tags/Tag;)Lnet/minecraft/advancements/criterion/InventoryChangeTrigger$Instance; # hasItem protected net.minecraft.data.RecipeProvider func_208310_b(Lnet/minecraft/data/DirectoryCache;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V # saveRecipeAdvancement public net.minecraft.data.ShapedRecipeBuilder$Result -protected net.minecraft.data.loot.BlockLootTables func_218552_a(Lnet/minecraft/util/IItemProvider;Lnet/minecraft/world/storage/loot/ILootFunctionConsumer;)Ljava/lang/Object; # withExplosionDecay -protected net.minecraft.data.loot.BlockLootTables func_218560_a(Lnet/minecraft/util/IItemProvider;Lnet/minecraft/world/storage/loot/ILootConditionConsumer;)Ljava/lang/Object; # withSurvivesExplosion -protected net.minecraft.data.loot.BlockLootTables func_218494_a(Lnet/minecraft/block/Block;Lnet/minecraft/world/storage/loot/conditions/ILootCondition$IBuilder;Lnet/minecraft/world/storage/loot/LootEntry$Builder;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # dropping -protected net.minecraft.data.loot.BlockLootTables func_218546_a(Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # dropping -protected net.minecraft.data.loot.BlockLootTables func_218519_a(Lnet/minecraft/block/Block;Lnet/minecraft/world/storage/loot/LootEntry$Builder;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithSilkTouch -protected net.minecraft.data.loot.BlockLootTables func_218511_b(Lnet/minecraft/block/Block;Lnet/minecraft/world/storage/loot/LootEntry$Builder;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithShears -protected net.minecraft.data.loot.BlockLootTables func_218535_c(Lnet/minecraft/block/Block;Lnet/minecraft/world/storage/loot/LootEntry$Builder;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithSilkTouchOrShears -protected net.minecraft.data.loot.BlockLootTables func_218515_b(Lnet/minecraft/block/Block;Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithSilkTouch protected net.minecraft.data.loot.BlockLootTables func_218463_a(Lnet/minecraft/util/IItemProvider;Lnet/minecraft/world/storage/loot/IRandomRange;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingRandomly -protected net.minecraft.data.loot.BlockLootTables func_218530_a(Lnet/minecraft/block/Block;Lnet/minecraft/util/IItemProvider;Lnet/minecraft/world/storage/loot/IRandomRange;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithSilkTouchOrRandomly -protected net.minecraft.data.loot.BlockLootTables func_218561_b(Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # onlyWithSilkTouch -protected net.minecraft.data.loot.BlockLootTables func_218523_c(Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingAndFlowerPot -protected net.minecraft.data.loot.BlockLootTables func_218513_d(Lnet/minecraft/block/Block;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingSlab -protected net.minecraft.data.loot.BlockLootTables func_218562_a(Lnet/minecraft/block/Block;Lnet/minecraft/state/IProperty;Ljava/lang/Comparable;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWhen -protected net.minecraft.data.loot.BlockLootTables func_218481_e(Lnet/minecraft/block/Block;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithName -protected net.minecraft.data.loot.BlockLootTables func_218544_f(Lnet/minecraft/block/Block;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithContents -protected net.minecraft.data.loot.BlockLootTables func_218559_g(Lnet/minecraft/block/Block;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithPatterns -protected net.minecraft.data.loot.BlockLootTables func_218476_a(Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingItemWithFortune -protected net.minecraft.data.loot.BlockLootTables func_218491_c(Lnet/minecraft/block/Block;Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingItemRarely -protected net.minecraft.data.loot.BlockLootTables func_218570_h(Lnet/minecraft/block/Block;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingSeeds protected net.minecraft.data.loot.BlockLootTables func_218475_b(Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingByAge +protected net.minecraft.data.loot.BlockLootTables func_218476_a(Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingItemWithFortune +protected net.minecraft.data.loot.BlockLootTables func_218481_e(Lnet/minecraft/block/Block;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithName protected net.minecraft.data.loot.BlockLootTables func_218486_d(Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # onlyWithShears -protected net.minecraft.data.loot.BlockLootTables func_218540_a(Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithChancesAndSticks -protected net.minecraft.data.loot.BlockLootTables func_218526_b(Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithChancesSticksAndApples -protected net.minecraft.data.loot.BlockLootTables func_218541_a(Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/world/storage/loot/conditions/ILootCondition$IBuilder;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingAndBonusWhen -protected net.minecraft.data.loot.BlockLootTables func_218522_a(Lnet/minecraft/block/Block;Ljava/util/function/Function;)V # registerLootTable +protected net.minecraft.data.loot.BlockLootTables func_218491_c(Lnet/minecraft/block/Block;Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingItemRarely +protected net.minecraft.data.loot.BlockLootTables func_218494_a(Lnet/minecraft/block/Block;Lnet/minecraft/world/storage/loot/conditions/ILootCondition$IBuilder;Lnet/minecraft/world/storage/loot/LootEntry$Builder;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # dropping protected net.minecraft.data.loot.BlockLootTables func_218507_a(Lnet/minecraft/block/Block;Lnet/minecraft/world/storage/loot/LootTable$Builder;)V # registerLootTable +protected net.minecraft.data.loot.BlockLootTables func_218511_b(Lnet/minecraft/block/Block;Lnet/minecraft/world/storage/loot/LootEntry$Builder;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithShears +protected net.minecraft.data.loot.BlockLootTables func_218513_d(Lnet/minecraft/block/Block;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingSlab +protected net.minecraft.data.loot.BlockLootTables func_218515_b(Lnet/minecraft/block/Block;Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithSilkTouch +protected net.minecraft.data.loot.BlockLootTables func_218519_a(Lnet/minecraft/block/Block;Lnet/minecraft/world/storage/loot/LootEntry$Builder;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithSilkTouch +protected net.minecraft.data.loot.BlockLootTables func_218522_a(Lnet/minecraft/block/Block;Ljava/util/function/Function;)V # registerLootTable +protected net.minecraft.data.loot.BlockLootTables func_218523_c(Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingAndFlowerPot +protected net.minecraft.data.loot.BlockLootTables func_218526_b(Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithChancesSticksAndApples +protected net.minecraft.data.loot.BlockLootTables func_218530_a(Lnet/minecraft/block/Block;Lnet/minecraft/util/IItemProvider;Lnet/minecraft/world/storage/loot/IRandomRange;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithSilkTouchOrRandomly +protected net.minecraft.data.loot.BlockLootTables func_218535_c(Lnet/minecraft/block/Block;Lnet/minecraft/world/storage/loot/LootEntry$Builder;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithSilkTouchOrShears +protected net.minecraft.data.loot.BlockLootTables func_218540_a(Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithChancesAndSticks +protected net.minecraft.data.loot.BlockLootTables func_218541_a(Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/world/storage/loot/conditions/ILootCondition$IBuilder;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingAndBonusWhen +protected net.minecraft.data.loot.BlockLootTables func_218544_f(Lnet/minecraft/block/Block;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithContents +protected net.minecraft.data.loot.BlockLootTables func_218546_a(Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # dropping +protected net.minecraft.data.loot.BlockLootTables func_218552_a(Lnet/minecraft/util/IItemProvider;Lnet/minecraft/world/storage/loot/ILootFunctionConsumer;)Ljava/lang/Object; # withExplosionDecay +protected net.minecraft.data.loot.BlockLootTables func_218559_g(Lnet/minecraft/block/Block;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWithPatterns +protected net.minecraft.data.loot.BlockLootTables func_218560_a(Lnet/minecraft/util/IItemProvider;Lnet/minecraft/world/storage/loot/ILootConditionConsumer;)Ljava/lang/Object; # withSurvivesExplosion +protected net.minecraft.data.loot.BlockLootTables func_218561_b(Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # onlyWithSilkTouch +protected net.minecraft.data.loot.BlockLootTables func_218562_a(Lnet/minecraft/block/Block;Lnet/minecraft/state/IProperty;Ljava/lang/Comparable;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingWhen +protected net.minecraft.data.loot.BlockLootTables func_218570_h(Lnet/minecraft/block/Block;)Lnet/minecraft/world/storage/loot/LootTable$Builder; # droppingSeeds protected net.minecraft.data.loot.EntityLootTables field_218586_a # ON_FIRE protected net.minecraft.data.loot.EntityLootTables func_218582_a(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/storage/loot/LootTable$Builder;)V # registerLootTable protected net.minecraft.data.loot.EntityLootTables func_218585_a(Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/world/storage/loot/LootTable$Builder;)V # @@ -103,7 +104,6 @@ public net.minecraft.entity.ai.brain.schedule.Activity (Ljava/lang/String; public net.minecraft.entity.ai.brain.sensor.SensorType (Ljava/util/function/Supplier;)V public net.minecraft.entity.item.ExperienceOrbEntity field_70530_e # xpValue protected net.minecraft.entity.item.TNTEntity func_70515_d()V # explode - make it easier to extend TNTEntity with custom explosion logic -public net.minecraft.entity.merchant.villager.VillagerProfession (Ljava/lang/String;Lnet/minecraft/village/PointOfInterestType;Lcom/google/common/collect/ImmutableSet;Lcom/google/common/collect/ImmutableSet;)V protected net.minecraft.entity.monster.AbstractSkeletonEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable protected net.minecraft.entity.monster.SkeletonEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable protected net.minecraft.entity.monster.StrayEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable @@ -113,7 +113,6 @@ protected net.minecraft.entity.player.PlayerEntity field_82248_d # spawnForced public net.minecraft.entity.player.PlayerEntity func_71053_j()V #closeScreen public net.minecraft.entity.player.ServerPlayerEntity field_71139_cq public net.minecraft.entity.player.ServerPlayerEntity func_71117_bO()V -public net.minecraft.fluid.Fluid func_180664_k()Lnet/minecraft/util/BlockRenderLayer; # getRenderLayer public net.minecraft.inventory.container.ContainerType (Lnet/minecraft/inventory/container/ContainerType$IFactory;)V public net.minecraft.inventory.container.ContainerType$IFactory public net.minecraft.inventory.container.RepairContainer field_82856_l #RepairContainer/stackSizeToBeUsedInRepair @@ -148,11 +147,8 @@ protected net.minecraft.util.ObjectIntIdentityMap field_148749_a # internal map protected net.minecraft.util.ObjectIntIdentityMap field_195868_a # nextId public net.minecraft.util.WeightedRandom$Item field_76292_a #probability public net.minecraft.util.concurrent.ThreadTaskExecutor func_213165_a(Ljava/lang/Runnable;)Ljava/util/concurrent/CompletableFuture; # func_213165_a -public net.minecraft.village.PointOfInterestType (Ljava/lang/String;Ljava/util/Set;ILnet/minecraft/util/SoundEvent;I)V -public net.minecraft.village.PointOfInterestType (Ljava/lang/String;Ljava/util/Set;ILnet/minecraft/util/SoundEvent;Ljava/util/function/Predicate;I)V public net.minecraft.world.GameRules func_223595_a(Ljava/lang/String;Lnet/minecraft/world/GameRules$RuleType;)Lnet/minecraft/world/GameRules$RuleKey; # register protected net.minecraft.world.Teleporter field_77187_a # random -protected net.minecraft.world.Teleporter field_85191_c # destinationCoordinateCache protected net.minecraft.world.Teleporter field_85192_a # world public net.minecraft.world.World field_73003_n #prevRainingStrength public net.minecraft.world.World field_73004_o #rainingStrength diff --git a/src/main/resources/assets/forge/models/block/default.json b/src/main/resources/assets/forge/models/block/default.json new file mode 100644 index 000000000..cfe7c7ca2 --- /dev/null +++ b/src/main/resources/assets/forge/models/block/default.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/block" +} diff --git a/src/main/resources/assets/forge/models/item/bucket.json b/src/main/resources/assets/forge/models/item/bucket.json index 4a8c26d79..0d22c7a62 100644 --- a/src/main/resources/assets/forge/models/item/bucket.json +++ b/src/main/resources/assets/forge/models/item/bucket.json @@ -1,6 +1,7 @@ { - "parent": "item/generated", + "parent": "forge:item/default", "textures": { - "layer0": "forge:items/bucket_base" + "base": "item/bucket", + "fluid": "forge:item/mask/bucket_fluid" } } diff --git a/src/main/resources/assets/forge/models/item/bucket_drip.json b/src/main/resources/assets/forge/models/item/bucket_drip.json new file mode 100644 index 000000000..0f8934beb --- /dev/null +++ b/src/main/resources/assets/forge/models/item/bucket_drip.json @@ -0,0 +1,7 @@ +{ + "parent": "forge:item/default", + "textures": { + "base": "item/bucket", + "fluid": "forge:item/mask/bucket_fluid_drip" + } +} diff --git a/src/main/resources/assets/forge/models/item/default-tool.json b/src/main/resources/assets/forge/models/item/default-tool.json new file mode 100644 index 000000000..d59106f2e --- /dev/null +++ b/src/main/resources/assets/forge/models/item/default-tool.json @@ -0,0 +1,24 @@ +{ + "display": { + "thirdperson_righthand": { + "rotation": [ 0, -90, 55 ], + "translation": [ 0, 4.0, 0.5 ], + "scale": [ 0.85, 0.85, 0.85 ] + }, + "thirdperson_lefthand": { + "rotation": [ 0, 90, -55 ], + "translation": [ 0, 4.0, 0.5 ], + "scale": [ 0.85, 0.85, 0.85 ] + }, + "firstperson_righthand": { + "rotation": [ 0, -90, 25 ], + "translation": [ 1.13, 3.2, 1.13 ], + "scale": [ 0.68, 0.68, 0.68 ] + }, + "firstperson_lefthand": { + "rotation": [ 0, 90, -25 ], + "translation": [ 1.13, 3.2, 1.13 ], + "scale": [ 0.68, 0.68, 0.68 ] + } + } +} diff --git a/src/main/resources/assets/forge/models/item/default.json b/src/main/resources/assets/forge/models/item/default.json new file mode 100644 index 000000000..6f83fb0fe --- /dev/null +++ b/src/main/resources/assets/forge/models/item/default.json @@ -0,0 +1,28 @@ +{ + "display": { + "ground": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 2, 0], + "scale":[ 0.5, 0.5, 0.5 ] + }, + "head": { + "rotation": [ 0, 180, 0 ], + "translation": [ 0, 13, 7], + "scale":[ 1, 1, 1] + }, + "thirdperson_righthand": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 3, 1 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson_righthand": { + "rotation": [ 0, -90, 25 ], + "translation": [ 1.13, 3.2, 1.13], + "scale": [ 0.68, 0.68, 0.68 ] + }, + "fixed": { + "rotation": [ 0, 180, 0 ], + "scale": [ 1, 1, 1 ] + } + } +} diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index c841520cd..d2e4c8ce5 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -4,27 +4,31 @@ net/minecraft/block/RedstoneWireBlock.canConnectTo(Lnet/minecraft/block/BlockSta net/minecraft/block/PoweredRailBlock.(Lnet/minecraft/block/Block$Properties;Z)=|p_i48349_1_,isActivator -net/minecraft/client/renderer/BlockRendererDispatcher.renderBlock(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/IEnviromentBlockReader;Lnet/minecraft/client/renderer/BufferBuilder;Ljava/util/Random;Lnet/minecraftforge/client/model/data/IModelData;)Z=|p_215330_1_,p_215330_2_,p_215330_3_,p_215330_4_,p_215330_5_,modelData +net/minecraft/client/renderer/BlockRendererDispatcher.renderBlock(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/ILightReader;Lnet/minecraft/client/renderer/BufferBuilder;Ljava/util/Random;Lnet/minecraftforge/client/model/data/IModelData;)Z=|p_215330_1_,p_215330_2_,p_215330_3_,p_215330_4_,p_215330_5_,modelData net/minecraft/client/renderer/BlockModelRenderer.renderModel(Lnet/minecraft/world/IEnviromentReader;Lnet/minecraft/client/renderer/model/IBakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/renderer/BufferBuilder;ZLjava/util/Random;JLnet/minecraftforge/client/model/data/IModelData;)Z=|p_217631_1_,p_217631_2_,p_217631_3_,p_217631_4_,p_217631_5_,p_217631_6_,p_217631_7_,p_217631_8_,modelData net/minecraft/client/renderer/BlockModelRenderer.renderModelSmooth(Lnet/minecraft/world/IEnviromentReader;Lnet/minecraft/client/renderer/model/IBakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/renderer/BufferBuilder;ZLjava/util/Random;JLnet/minecraftforge/client/model/data/IModelData;)Z=|p_217634_1_,p_217634_2_,p_217634_3_,p_217634_4_,p_217634_5_,p_217634_6_,p_217634_7_,p_217634_8_,modelData net/minecraft/client/renderer/BlockModelRenderer.renderModelFlat(Lnet/minecraft/world/IEnviromentReader;Lnet/minecraft/client/renderer/model/IBakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/renderer/BufferBuilder;ZLjava/util/Random;JLnet/minecraftforge/client/model/data/IModelData;)Z=|p_217635_1_,p_217635_2_,p_217635_3_,p_217635_4_,p_217635_5_,p_217635_6_,p_217635_7_,p_217635_8_,modelData +net/minecraft/client/renderer/FluidBlockRenderer.func_228797_a_(Lcom/mojang/blaze3d/vertex/IVertexBuilder;DDDFFFFFFI)V=|p_228797_1_,p_228797_2_,p_228797_4_,p_228797_6_,p_228797_8_,p_228797_9_,p_228797_10_,alpha,p_228797_11_,p_228797_12_,p_228797_13_ + +net/minecraft/client/renderer/FogRenderer.setupFog(Lnet/minecraft/client/renderer/ActiveRenderInfo;Lnet/minecraft/client/renderer/FogRenderer$FogType;FZF)V=|p_228372_0_,p_228372_1_,p_228372_2_,p_228372_3_,partialTicks + net/minecraft/client/renderer/model/BakedQuad.([IILnet/minecraft/util/Direction;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;ZLnet/minecraft/client/renderer/vertex/VertexFormat;)V=|p_i46574_1_,p_i46574_2_,p_i46574_3_,p_i46574_4_,applyDiffuseLighting,format -net/minecraft/client/renderer/model/ModelBakery.getBakedModel(Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ISprite;Ljava/util/function/Function;Lnet/minecraft/client/renderer/vertex/VertexFormat;)Lnet/minecraft/client/renderer/model/IBakedModel;=|p_217845_1_,p_217845_2_,textureGetter,format +net/minecraft/client/renderer/model/ModelBakery.getBakedModel(Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/IModelTransform;Ljava/util/function/Function;Lnet/minecraft/client/renderer/vertex/VertexFormat;)Lnet/minecraft/client/renderer/model/IBakedModel;=|p_217845_1_,p_217845_2_,textureGetter,format -net/minecraft/client/renderer/model/FaceBakery.makeBakedQuad(Lnet/minecraft/client/renderer/Vector3f;Lnet/minecraft/client/renderer/Vector3f;Lnet/minecraft/client/renderer/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/Direction;Lnet/minecraft/client/renderer/texture/ISprite;Lnet/minecraft/client/renderer/model/BlockPartRotation;Z)Lnet/minecraft/client/renderer/model/BakedQuad;=|p_217648_1_,p_217648_2_,p_217648_3_,p_217648_4_,p_217648_5_,p_217648_6_,p_217648_7_,p_217648_8_,p_217648_9_ +net/minecraft/client/renderer/model/FaceBakery.makeBakedQuad(Lnet/minecraft/client/renderer/Vector3f;Lnet/minecraft/client/renderer/Vector3f;Lnet/minecraft/client/renderer/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/Direction;Lnet/minecraft/client/renderer/texture/IModelTransform;Lnet/minecraft/client/renderer/model/BlockPartRotation;Z)Lnet/minecraft/client/renderer/model/BakedQuad;=|p_217648_1_,p_217648_2_,p_217648_3_,p_217648_4_,p_217648_5_,p_217648_6_,p_217648_7_,p_217648_8_,p_217648_9_ net/minecraft/client/renderer/model/FaceBakery.makeQuadVertexData(Lnet/minecraft/client/renderer/model/BlockFaceUV;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/Direction;[FLnet/minecraftforge/common/model/ITransformation;Lnet/minecraft/client/renderer/model/BlockPartRotation;Z)[I=|p_188012_1_,p_188012_2_,p_188012_3_,p_188012_4_,p_188012_5_,p_188012_6_,p_188012_7_ net/minecraft/client/renderer/model/FaceBakery.fillVertexData([IILnet/minecraft/util/Direction;Lnet/minecraft/client/renderer/model/BlockFaceUV;[FLnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraftforge/common/model/ITransformation;Lnet/minecraft/client/renderer/model/BlockPartRotation;Z)V=|p_188015_1_,p_188015_2_,p_188015_3_,p_188015_4_,p_188015_5_,p_188015_6_,p_188015_7_,p_188015_8_,p_188015_9_ net/minecraft/client/renderer/model/ItemOverrideList.(Lnet/minecraft/client/renderer/model/ModelBakery;Lnet/minecraft/client/renderer/model/IUnbakedModel;Ljava/util/function/Function;Ljava/util/function/Function;Ljava/util/List;Lnet/minecraft/client/renderer/vertex/VertexFormat;)V=|p_i50984_1_,p_i50984_2_,p_i50984_3_,textureGetter,p_i50984_4_,format -net/minecraft/client/renderer/model/BlockModel.bake(Lnet/minecraft/client/renderer/model/ModelBakery;Lnet/minecraft/client/renderer/model/BlockModel;Ljava/util/function/Function;Lnet/minecraft/client/renderer/texture/ISprite;Lnet/minecraft/client/renderer/vertex/VertexFormat;)Lnet/minecraft/client/renderer/model/IBakedModel;=|p_217644_1_,p_217644_2_,p_217644_3_,p_217644_4_,format +net/minecraft/client/renderer/model/BlockModel.bake(Lnet/minecraft/client/renderer/model/ModelBakery;Lnet/minecraft/client/renderer/model/BlockModel;Ljava/util/function/Function;Lnet/minecraft/client/renderer/texture/IModelTransform;Lnet/minecraft/client/renderer/vertex/VertexFormat;)Lnet/minecraft/client/renderer/model/IBakedModel;=|p_217644_1_,p_217644_2_,p_217644_3_,p_217644_4_,format -net/minecraft/client/renderer/model/VariantList.bake(Lnet/minecraft/client/renderer/model/ModelBakery;Ljava/util/function/Function;Lnet/minecraft/client/renderer/texture/ISprite;Lnet/minecraft/client/renderer/vertex/VertexFormat;)Lnet/minecraft/client/renderer/model/IBakedModel;=|p_217641_1_,p_217641_2_,p_217641_3_,format +net/minecraft/client/renderer/model/VariantList.bake(Lnet/minecraft/client/renderer/model/ModelBakery;Ljava/util/function/Function;Lnet/minecraft/client/renderer/texture/IModelTransform;Lnet/minecraft/client/renderer/vertex/VertexFormat;)Lnet/minecraft/client/renderer/model/IBakedModel;=|p_217641_1_,p_217641_2_,p_217641_3_,format -net/minecraft/client/renderer/model/multipart/Multipart.bake(Lnet/minecraft/client/renderer/model/ModelBakery;Ljava/util/function/Function;Lnet/minecraft/client/renderer/texture/ISprite;Lnet/minecraft/client/renderer/vertex/VertexFormat;)Lnet/minecraft/client/renderer/model/IBakedModel;=|p_217641_1_,p_217641_2_,p_217641_3_,format +net/minecraft/client/renderer/model/multipart/Multipart.bake(Lnet/minecraft/client/renderer/model/ModelBakery;Ljava/util/function/Function;Lnet/minecraft/client/renderer/texture/IModelTransform;Lnet/minecraft/client/renderer/vertex/VertexFormat;)Lnet/minecraft/client/renderer/model/IBakedModel;=|p_217641_1_,p_217641_2_,p_217641_3_,format net/minecraft/client/resources/ClientResourcePackInfo.(Ljava/lang/String;ZLjava/util/function/Supplier;Lnet/minecraft/resources/IResourcePack;Lnet/minecraft/resources/data/PackMetadataSection;Lnet/minecraft/resources/ResourcePackInfo$Priority;Z)V=|p_i48113_1_,p_i48113_2_,p_i48113_3_,p_i48113_4_,p_i48113_5_,p_i48113_6_,hidden net/minecraft/client/resources/ClientResourcePackInfo.(Ljava/lang/String;ZLjava/util/function/Supplier;Lnet/minecraft/util/text/ITextComponent;Lnet/minecraft/util/text/ITextComponent;Lnet/minecraft/resources/PackCompatibility;Lnet/minecraft/resources/ResourcePackInfo$Priority;ZLnet/minecraft/client/renderer/texture/NativeImage;Z)V=|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_,hidden @@ -68,6 +72,7 @@ net/minecraft/world/chunk/BlockStateContainer.setBits(IZ)V=|p_186012_1_,forceBit net/minecraft/world/end/DragonFightManager.(Lnet/minecraft/world/server/ServerWorld;Lnet/minecraft/nbt/CompoundNBT;Lnet/minecraft/world/dimension/EndDimension;)V=|p_i46669_1_,p_i46669_2_,dim +net/minecraft/world/gen/feature/HugeTreesFeature.validSoil(Lnet/minecraft/world/gen/IWorldGenerationReader;Lnet/minecraft/util/math/BlockPos;Lnet/minecraftforge/common/IPlantable;)Z=|p_202405_1_,p_202405_2_,sapling net/minecraft/world/gen/feature/OreFeatureConfig$FillerBlockType.create(Ljava/lang/String;Ljava/lang/String;Ljava/util/function/Predicate;)Lnet/minecraft/world/gen/feature/OreFeatureConfig$FillerBlockType;=|enumName,p_i50618_3_,p_i50618_4_ net/minecraft/world/gen/feature/jigsaw/JigsawPattern$PlacementBehaviour.create(Ljava/lang/String;Ljava/lang/String;Lcom/google/common/collect/ImmutableList;)Lnet/minecraft/world/gen/feature/jigsaw/JigsawPattern$PlacementBehaviour;=|enumName,p_i50487_3_,p_i50487_4_ net/minecraft/world/gen/feature/template/StructureProcessor.process(Lnet/minecraft/world/IWorldReader;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/gen/feature/template/Template$BlockInfo;Lnet/minecraft/world/gen/feature/template/Template$BlockInfo;Lnet/minecraft/world/gen/feature/template/PlacementSettings;Lnet/minecraft/world/gen/feature/template/Template;)Lnet/minecraft/world/gen/feature/template/Template$BlockInfo;=|p_215194_1_,p_215194_2_,p_215194_3_,p_215194_4_,p_215194_5_,template diff --git a/src/main/resources/forge.sas b/src/main/resources/forge.sas index d7857e112..e374ead25 100644 --- a/src/main/resources/forge.sas +++ b/src/main/resources/forge.sas @@ -31,7 +31,6 @@ net/minecraft/block/CropsBlock func_199772_f()Lnet/minecraft/util/IItemProvider; net/minecraft/block/PotatoBlock func_199772_f()Lnet/minecraft/util/IItemProvider; net/minecraft/block/SoundType func_185845_c()Lnet/minecraft/util/SoundEvent; # getBreakSound net/minecraft/block/SoundType func_185846_f()Lnet/minecraft/util/SoundEvent; # getHitSound -net/minecraft/item/DyeColor func_196057_c()I # getSwappedColorValue net/minecraft/item/DyeColor func_218388_g()I # getTextColor net/minecraft/item/DyeColor func_196058_b(I)Lnet/minecraft/item/DyeColor; # byFireworkColor net/minecraft/item/crafting/Ingredient func_193365_a()[Lnet/minecraft/item/ItemStack; # getMatchingStacks @@ -77,20 +76,10 @@ net/minecraft/resources/IResourceManager func_199001_a()Ljava/util/Set; # getRes net/minecraft/resources/IResourceManager func_219533_b(Lnet/minecraft/util/ResourceLocation;)Z # hasResource net/minecraft/resources/FallbackResourceManager func_219533_b(Lnet/minecraft/util/ResourceLocation;)Z net/minecraft/resources/SimpleReloadableResourceManager func_219533_b(Lnet/minecraft/util/ResourceLocation;)Z -net/minecraft/resources/IResourceManager func_199021_a(Lnet/minecraft/resources/IResourcePack;)V # addResourcePack - net/minecraft/resources/FallbackResourceManager func_199021_a(Lnet/minecraft/resources/IResourcePack;)V - net/minecraft/resources/SimpleReloadableResourceManager func_199021_a(Lnet/minecraft/resources/IResourcePack;)V -net/minecraft/resources/IReloadableResourceManager func_219535_a(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;)Lnet/minecraft/resources/IAsyncReloader; # initialReload - net/minecraft/resources/SimpleReloadableResourceManager func_219535_a(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;)Lnet/minecraft/resources/IAsyncReloader; net/minecraft/tags/TagCollection func_199913_a(Ljava/lang/Object;)Ljava/util/Collection; # getOwningTags net/minecraft/tileentity/TileEntity func_145835_a(DDD)D # getDistanceSq -net/minecraft/util/Direction func_176732_a(Lnet/minecraft/util/Direction$Axis;)Lnet/minecraft/util/Direction; # rotateAround -net/minecraft/util/Direction func_176744_n()Lnet/minecraft/util/Direction; # rotateX -net/minecraft/util/Direction func_176738_p()Lnet/minecraft/util/Direction; # rotateZ net/minecraft/util/Direction func_176739_a(Ljava/lang/String;)Lnet/minecraft/util/Direction; # byName net/minecraft/util/Direction$Axis func_176717_a(Ljava/lang/String;)Lnet/minecraft/util/Direction$Axis; # byName net/minecraft/util/math/Vec3d func_216371_e()Lnet/minecraft/util/math/Vec3d; net/minecraft/util/math/Vec3d func_189984_a(Lnet/minecraft/util/math/Vec2f;)Lnet/minecraft/util/math/Vec3d; # fromPitchYaw -net/minecraft/util/math/Vec3d func_189986_a(FF)Lnet/minecraft/util/math/Vec3d; # fromPitchYaw -net/minecraft/world/World func_72971_b(F)F # getSunBrightness -net/minecraft/world/World func_72919_O()D # getHorizon \ No newline at end of file +net/minecraft/util/math/Vec3d func_189986_a(FF)Lnet/minecraft/util/math/Vec3d; # fromPitchYaw \ No newline at end of file diff --git a/src/test/java/net/minecraftforge/debug/block/CustomTNTTest.java b/src/test/java/net/minecraftforge/debug/block/CustomTNTTest.java index 9749b7a5d..309bc3ab7 100644 --- a/src/test/java/net/minecraftforge/debug/block/CustomTNTTest.java +++ b/src/test/java/net/minecraftforge/debug/block/CustomTNTTest.java @@ -47,10 +47,10 @@ import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +/* @Mod(CustomTNTTest.MODID) @Mod.EventBusSubscriber(modid = CustomTNTTest.MODID, bus = Bus.MOD) public class CustomTNTTest { - static final String MODID = "custom_tnt_test"; static final String BLOCK_ID = "test_tnt"; @@ -94,14 +94,14 @@ public class CustomTNTTest { if (!world.isRemote) { TNTEntity tnt = new CustomTNTEntity(world, pos.getX() + 0.5F, pos.getY(), pos.getZ() + 0.5F, igniter); world.addEntity(tnt); - world.playSound(null, tnt.posX, tnt.posY, tnt.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound(null, tnt.func_226277_ct_(), tnt.func_226278_cu_(), tnt.func_226281_cx_(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F); } } } /** * Custom TNT Entity that has a fuse of a quarter length, and four times the explosion strength - */ + *//* public static class CustomTNTEntity extends TNTEntity { public CustomTNTEntity(EntityType type, World world) { @@ -122,7 +122,7 @@ public class CustomTNTTest { @Override protected void explode() { - this.world.createExplosion(this, this.posX, this.posY, this.posZ, 16.0F, Explosion.Mode.BREAK); + this.world.createExplosion(this, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), 16.0F, Explosion.Mode.BREAK); } @Nonnull @@ -131,4 +131,5 @@ public class CustomTNTTest { return NetworkHooks.getEntitySpawningPacket(this); } } -} \ No newline at end of file +} + */ diff --git a/src/test/java/net/minecraftforge/debug/block/FarmlandTrampleEventTest.java b/src/test/java/net/minecraftforge/debug/block/FarmlandTrampleEventTest.java index e2daaadce..c2cb9f4a7 100644 --- a/src/test/java/net/minecraftforge/debug/block/FarmlandTrampleEventTest.java +++ b/src/test/java/net/minecraftforge/debug/block/FarmlandTrampleEventTest.java @@ -30,7 +30,7 @@ public class FarmlandTrampleEventTest @SubscribeEvent public static void onFarmlandTrampled(BlockEvent.FarmlandTrampleEvent event) { - if(event.getEntity().isSneaking()) + if(event.getEntity().isCrouching()) event.setCanceled(true); } } diff --git a/src/test/java/net/minecraftforge/debug/block/PathNodeTypeTest.java b/src/test/java/net/minecraftforge/debug/block/PathNodeTypeTest.java index 2f62ccd07..1553d75f6 100644 --- a/src/test/java/net/minecraftforge/debug/block/PathNodeTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/block/PathNodeTypeTest.java @@ -22,7 +22,6 @@ package net.minecraftforge.debug.block; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; -import net.minecraft.entity.MobEntity; import net.minecraft.pathfinding.PathNodeType; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; @@ -31,8 +30,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.registries.ObjectHolder; -import javax.annotation.Nullable; - @Mod(PathNodeTypeTest.MOD_ID) @Mod.EventBusSubscriber public class PathNodeTypeTest @@ -44,20 +41,20 @@ public class PathNodeTypeTest @ObjectHolder(BLOCK_ID) private static Block TEST_BLOCK = null; + /*TODO @SubscribeEvent public static void register(RegistryEvent.Register event) { event.getRegistry().register((new Block(Block.Properties.create(Material.ROCK)) { @Override - public PathNodeType getAiPathNodeType(BlockState state, IBlockReader world, BlockPos pos, @Nullable MobEntity entity) + public PathNodeType getAiPathNodeType(BlockState state, IBlockReader world, BlockPos pos) { return PathNodeType.DOOR_OPEN; } }).setRegistryName(MOD_ID, BLOCK_ID)); } - /* @Mod.EventBusSubscriber(value = Dist.CLIENT, modid = MOD_ID) public static class ClientEventHandler { diff --git a/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java b/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java index e3024501d..84ccd88bc 100644 --- a/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java +++ b/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java @@ -25,8 +25,8 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.PistonBlock; +import net.minecraft.block.PistonBlockStructureHelper; import net.minecraft.block.material.Material; -import net.minecraft.block.state.PistonBlockStructureHelper; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItem; diff --git a/src/test/java/net/minecraftforge/debug/client/model/BlockstateRetextureTest.java b/src/test/java/net/minecraftforge/debug/client/model/BlockstateRetextureTest.java deleted file mode 100644 index 8ed23d8ce..000000000 --- a/src/test/java/net/minecraftforge/debug/client/model/BlockstateRetextureTest.java +++ /dev/null @@ -1,81 +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.debug.client.model; - -import java.util.function.Function; - -import com.google.common.collect.ImmutableMap; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.ModelBakery; -import net.minecraft.client.renderer.model.ModelResourceLocation; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.ModelBakeEvent; -import net.minecraftforge.client.model.BasicState; -import net.minecraftforge.client.model.IModel; -import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.common.model.TRSRTransformation; -import net.minecraftforge.fml.common.Mod; - -@Mod(BlockstateRetextureTest.MODID) -public class BlockstateRetextureTest -{ - public static final String MODID = "forge_blockstate_retexture_test"; - static final boolean ENABLED = true; - - private static ResourceLocation fenceName = new ResourceLocation("minecraft", "oak_fence"); - private static ModelResourceLocation fenceLocation = new ModelResourceLocation(fenceName, "east=true,north=false,south=false,waterlogged=false,west=true"); - private static ResourceLocation stoneName = new ResourceLocation("minecraft", "stone"); - private static ModelResourceLocation stoneLocation = new ModelResourceLocation(stoneName, ""); - - private static Function textureGetter = location -> - { - assert location != null; - return Minecraft.getInstance().getTextureMap().getAtlasSprite(location.toString()); - }; - - @Mod.EventBusSubscriber(modid = MODID, value = Dist.CLIENT) - public static class ClientEvents - { - @net.minecraftforge.eventbus.api.SubscribeEvent - public static void onModelBakeEvent(ModelBakeEvent event) - { - if (!ENABLED) - { - return; - } - - IModel fence = ModelLoaderRegistry.getModelOrLogError(fenceLocation, "Error loading fence model"); - IModel stone = ModelLoaderRegistry.getModelOrLogError(stoneLocation, "Error loading stone model"); - IModel retexturedFence = fence.retexture(ImmutableMap.of("texture", "blocks/log_oak")); - IModel retexturedStone = stone.retexture(ImmutableMap.of("all", "blocks/diamond_block")); - - IBakedModel fenceResult = retexturedFence.bake(event.getModelLoader(), textureGetter, new BasicState(fence.getDefaultState(), true), DefaultVertexFormats.ITEM); - IBakedModel stoneResult = retexturedStone.bake(event.getModelLoader(), textureGetter, new BasicState(stone.getDefaultState(), true), DefaultVertexFormats.ITEM); - - event.getModelRegistry().put(fenceLocation, fenceResult); - event.getModelRegistry().put(stoneLocation, ModelLoaderRegistry.getMissingModel().bake(event.getModelLoader(), textureGetter, new BasicState(TRSRTransformation.identity(), false), DefaultVertexFormats.ITEM)); - } - } -} diff --git a/src/test/java/net/minecraftforge/debug/client/model/ForgeBlockStatesLoaderTest.java b/src/test/java/net/minecraftforge/debug/client/model/ForgeBlockStatesLoaderTest.java deleted file mode 100644 index de86f76c3..000000000 --- a/src/test/java/net/minecraftforge/debug/client/model/ForgeBlockStatesLoaderTest.java +++ /dev/null @@ -1,61 +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.debug.client.model; - -import net.minecraft.block.Block; -import net.minecraft.block.WallBlock; -import net.minecraft.block.material.Material; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.ObjectHolder; - -@Mod(ForgeBlockStatesLoaderTest.MODID) -@Mod.EventBusSubscriber(modid = ForgeBlockStatesLoaderTest.MODID, bus= Mod.EventBusSubscriber.Bus.MOD) -public class ForgeBlockStatesLoaderTest -{ - public static final String MODID = "forgeblockstatesloader"; - - @ObjectHolder(MODID) - public static class BLOCKS - { - public static final WallBlock custom_wall = null; - } - - @SubscribeEvent - public static void registerBlocks(RegistryEvent.Register event) - { - event.getRegistry().registerAll( - new WallBlock(Block.Properties.create(Material.ROCK)) - .setRegistryName(MODID, "custom_wall") - ); - } - - @SubscribeEvent - public static void registerItems(RegistryEvent.Register event) - { - event.getRegistry().registerAll( - new BlockItem(BLOCKS.custom_wall, new Item.Properties().group(ItemGroup.DECORATIONS)).setRegistryName(BLOCKS.custom_wall.getRegistryName()) - ); - } -} diff --git a/src/test/java/net/minecraftforge/debug/client/model/ModelDataTest.java b/src/test/java/net/minecraftforge/debug/client/model/ModelDataTest.java index 675036a70..1c90b4158 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/ModelDataTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/ModelDataTest.java @@ -46,7 +46,7 @@ import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; -import net.minecraft.world.IEnviromentBlockReader; +import net.minecraft.world.ILightReader; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.model.ModelDataManager; import net.minecraftforge.client.model.data.IDynamicBakedModel; @@ -127,7 +127,7 @@ public class ModelDataTest @Override @Nonnull - public IModelData getModelData(@Nonnull IEnviromentBlockReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) + public IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) { if (world.getBlockState(pos.down()).getBlock() == Blocks.AIR) { diff --git a/src/test/java/net/minecraftforge/debug/client/model/ModelLoaderRegistryTest.java b/src/test/java/net/minecraftforge/debug/client/model/ModelLoaderRegistryTest.java index 94e881622..6148cbb28 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/ModelLoaderRegistryTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/ModelLoaderRegistryTest.java @@ -67,7 +67,7 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.b3d.B3DLoader; import net.minecraftforge.client.model.obj.OBJLoader; -import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.Object; import net.minecraftforge.common.model.IModelState; import net.minecraftforge.common.model.Models; import net.minecraftforge.common.model.TRSRTransformation; @@ -370,10 +370,10 @@ public class ModelLoaderRegistryTest private final List hidden = new ArrayList(); private final IModelState state = new IModelState() { - private final Optional value = Optional.of(TRSRTransformation.identity()); + private final Optional value = Optional.of(TransformationMatrix.func_227983_a_()); @Override - public Optional apply(Optional part) + public Optional apply(Optional part) { if (part.isPresent()) { @@ -796,7 +796,7 @@ public class ModelLoaderRegistryTest if (world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof OBJDynamicEyeTileEntity) { OBJDynamicEyeTileEntity te = (OBJDynamicEyeTileEntity) world.getTileEntity(pos); - if (te.transform != TRSRTransformation.identity()) + if (te.transform != TransformationMatrix.func_227983_a_()) { return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, te.transform); } @@ -813,7 +813,7 @@ public class ModelLoaderRegistryTest super(null); // TODO } - private TRSRTransformation transform = TRSRTransformation.identity(); + private TRSRTransformation transform = TransformationMatrix.func_227983_a_(); @Override public void tick() diff --git a/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java b/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java new file mode 100644 index 000000000..d5ef1ca9b --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java @@ -0,0 +1,112 @@ +/* + * 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.debug.client.model; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.model.ItemCameraTransforms; +import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.entity.Entity; +import net.minecraft.inventory.EquipmentSlotType; +import net.minecraft.item.*; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.obj.OBJLoader; +import net.minecraftforge.client.model.obj.OBJModel; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.NonNullLazy; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.RegistryObject; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; + +@Mod(NewModelLoaderTest.MODID) +public class NewModelLoaderTest +{ + public static final String MODID = "new_model_loader_test"; + public static final DeferredRegister BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, MODID); + public static final DeferredRegister ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, MODID); + + public static RegistryObject obj_item = ITEMS.register("obj_item", () -> + new Item(new Item.Properties().group(ItemGroup.MISC)) { + @Override + public boolean canEquip(ItemStack stack, EquipmentSlotType armorType, Entity entity) + { + return armorType == EquipmentSlotType.HEAD; + } + } + ); + + public static RegistryObject custom_transforms = ITEMS.register("custom_transforms", () -> + new Item(new Item.Properties().group(ItemGroup.MISC)) + ); + + public static RegistryObject custom_vanilla_loader = ITEMS.register("custom_vanilla_loader", () -> + new Item(new Item.Properties().group(ItemGroup.MISC)) + ); + + public NewModelLoaderTest() + { + IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); + + BLOCKS.register(modEventBus); + ITEMS.register(modEventBus); + + /*DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { + MinecraftForge.EVENT_BUS.addListener(this::renderGuiOverlay); + });*/ + } + + /* + private NonNullLazy> modelRenderer = NonNullLazy.of(() -> { + OBJModel model = OBJLoader.INSTANCE.loadModel(new ResourceLocation("new_model_loader_test", "models/item/sugar_glider.obj"), false, false, true, false); + return IRenderable.withParameter(model.bakeRenderable(ModelLoader.defaultTextureGetter()), null); + }); + + private NonNullLazy modelRenderer2 = NonNullLazy.of(() -> { + return BakedModelRenderable.of(new ItemStack(Items.COAL)); + }); + + public void renderGuiOverlay(RenderGameOverlayEvent.Post event) + { + if (event.getType() == RenderGameOverlayEvent.ElementType.ALL) + { + Minecraft mc = Minecraft.getInstance(); + mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + RenderSystem.pushMatrix(); + RenderSystem.translatef(event.getWindow().getScaledWidth() / 2.0f, event.getWindow().getScaledHeight() / 2.0f, 200); + RenderSystem.scalef(16,16,16); + //mc.getItemRenderer().renderItemAndEffectIntoGUI(new ItemStack(Items.COAL),0,0); + modelRenderer.get().render(); + RenderSystem.translatef(1,1,1); + modelRenderer2.get().render(new BakedModelRenderable.Context().withPerspective(ItemCameraTransforms.TransformType.GUI).withStack(new ItemStack(Items.COAL))); + RenderSystem.popMatrix(); + } + } + */ +} diff --git a/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java b/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java index a1d943170..0af852f66 100644 --- a/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java @@ -98,7 +98,7 @@ public class GravityAttributeTest for(LivingEntity liv : list) { IAttributeInstance grav = liv.getAttribute(LivingEntity.ENTITY_GRAVITY); - boolean inPlains = liv.world.getBiome(liv.getPosition()).getCategory() == Category.PLAINS; + boolean inPlains = liv.world.func_226691_t_(liv.getPosition()).getCategory() == Category.PLAINS; if (inPlains && !grav.hasModifier(REDUCED_GRAVITY)) { logger.info("Granted low gravity to Entity: {}", liv); diff --git a/src/test/java/net/minecraftforge/debug/entity/player/PlayerXpEventTest.java b/src/test/java/net/minecraftforge/debug/entity/player/PlayerXpEventTest.java index 2d007e40c..d0c4b8027 100644 --- a/src/test/java/net/minecraftforge/debug/entity/player/PlayerXpEventTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/player/PlayerXpEventTest.java @@ -1,9 +1,27 @@ +/* + * 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.debug.entity.player; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; import net.minecraftforge.event.entity.player.PlayerXpEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -23,13 +41,6 @@ public class PlayerXpEventTest logger.info("The PlayerXpEvent has been called!"); } - @SubscribeEvent - public static void onPlayerPickupXpOld(PlayerPickupXpEvent event) - { - if (!ENABLE) return; - logger.info("The deprecated PlayerPickupXpEvent has been called!"); - } - @SubscribeEvent public static void onPlayerPickupXp(PlayerXpEvent.PickupXp event) { diff --git a/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java b/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java index 914c79193..59febf69d 100644 --- a/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java +++ b/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java @@ -23,7 +23,8 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.FlowingFluidBlock; -import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.model.Material; +import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.fluid.FlowingFluid; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; @@ -46,8 +47,8 @@ public class NewFluidTest { public static final String MODID = "new_fluid_test"; - public static final ResourceLocation FLUID_STILL = new ResourceLocation("minecraft:block/brown_mushroom_block"); - public static final ResourceLocation FLUID_FLOWING = new ResourceLocation("minecraft:block/mushroom_stem"); + public static final Material FLUID_STILL = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft:block/brown_mushroom_block")); + public static final Material FLUID_FLOWING = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft:block/mushroom_stem")); public static final DeferredRegister BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, MODID); public static final DeferredRegister ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, MODID); @@ -61,7 +62,7 @@ public class NewFluidTest ); public static RegistryObject test_fluid_block = BLOCKS.register("test_fluid_block", () -> - new FlowingFluidBlock(test_fluid, Block.Properties.create(Material.WATER).doesNotBlockMovement().hardnessAndResistance(100.0F).noDrops()) + new FlowingFluidBlock(test_fluid, Block.Properties.create(net.minecraft.block.material.Material.WATER).doesNotBlockMovement().hardnessAndResistance(100.0F).noDrops()) ); public static RegistryObject test_fluid_bucket = ITEMS.register("test_fluid_bucket", () -> new BucketItem(test_fluid, new Item.Properties().containerItem(Items.BUCKET).maxStackSize(1).group(ItemGroup.MISC)) diff --git a/src/test/java/net/minecraftforge/testmods/TestOBJModelMod.java b/src/test/java/net/minecraftforge/testmods/TestOBJModelMod.java deleted file mode 100644 index b03f9b4aa..000000000 --- a/src/test/java/net/minecraftforge/testmods/TestOBJModelMod.java +++ /dev/null @@ -1,70 +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.testmods; - -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.IUnbakedModel; -import net.minecraft.client.renderer.model.ModelResourceLocation; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.ModelBakeEvent; -import net.minecraftforge.client.model.BasicState; -import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.client.model.obj.OBJLoader; -import net.minecraftforge.client.model.obj.OBJModel; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -@Mod("testobjmodelmod") -public class TestOBJModelMod { - private static final Logger LOGGER = LogManager.getLogger(); - - public TestOBJModelMod() { - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); - } - - private void doClientStuff(final FMLClientSetupEvent event) { - OBJLoader.INSTANCE.addDomain("testobjmodelmod"); - } - - @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) - public static class RegistryEvents { - @SubscribeEvent - public static void onModelBakeEvent(ModelBakeEvent event) { - try { - // Try to load an OBJ model (placed in src/main/resources/assets/examplemod/models/) - IUnbakedModel model = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation("testobjmodelmod:sample_model.obj")); - - if (model instanceof OBJModel) { - // If loading OBJ model succeeds, bake the model and replace stick's model with the baked model - IBakedModel bakedModel = model.bake(event.getModelLoader(), ModelLoader.defaultTextureGetter(), new BasicState(model.getDefaultState(), false), DefaultVertexFormats.ITEM); - event.getModelRegistry().put(new ModelResourceLocation("stick", "inventory"), bakedModel); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } -} diff --git a/src/test/resources/META-INF/mods.toml b/src/test/resources/META-INF/mods.toml index 2e7e6fe52..2bd162409 100644 --- a/src/test/resources/META-INF/mods.toml +++ b/src/test/resources/META-INF/mods.toml @@ -1,14 +1,6 @@ modLoader="javafml" loaderVersion="[28,)" -[[mods]] - modId="testobjmodelmod" -#[[mods]] -# modId="forgedebugmodeldata" -##[[mods]] -## modId="forgedebugmodelloaderregistry" -[[mods]] - modId="forge_blockstate_retexture_test" [[mods]] modId="containertypetest" [[mods]] @@ -56,6 +48,6 @@ loaderVersion="[28,)" [[mods]] modId="player_xp_event_test" [[mods]] - modId="forgeblockstatesloader" + modId="custom_tnt_test" [[mods]] - modId="custom_tnt_test" \ No newline at end of file + modId="new_model_loader_test" diff --git a/src/test/resources/assets/new_fluid_test/blockstates/test_fluid_block.json b/src/test/resources/assets/new_fluid_test/blockstates/test_fluid_block.json new file mode 100644 index 000000000..ccdddf760 --- /dev/null +++ b/src/test/resources/assets/new_fluid_test/blockstates/test_fluid_block.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "new_fluid_test:block/test_fluid" } + } +} diff --git a/src/test/resources/assets/new_fluid_test/models/block/test_fluid.json b/src/test/resources/assets/new_fluid_test/models/block/test_fluid.json new file mode 100644 index 000000000..ac14d9087 --- /dev/null +++ b/src/test/resources/assets/new_fluid_test/models/block/test_fluid.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "block/water_still" + } +} diff --git a/src/test/resources/assets/new_fluid_test/models/item/test_fluid_bucket.json b/src/test/resources/assets/new_fluid_test/models/item/test_fluid_bucket.json new file mode 100644 index 000000000..a6064e384 --- /dev/null +++ b/src/test/resources/assets/new_fluid_test/models/item/test_fluid_bucket.json @@ -0,0 +1,31 @@ +{ + "parent": "forge:item/bucket_drip", + "loader": "forge:bucket", + "fluid": "new_fluid_test:test_fluid", + "display": { + "ground": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 2, 0], + "scale":[ 0.5, 0.5, 0.5 ] + }, + "head": { + "rotation": [ 0, 180, 0 ], + "translation": [ 0, 13, 7], + "scale":[ 1, 1, 1] + }, + "thirdperson_righthand": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 3, 1 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson_righthand": { + "rotation": [ 0, -90, 25 ], + "translation": [ 1.13, 3.2, 1.13], + "scale": [ 0.68, 0.68, 0.68 ] + }, + "fixed": { + "rotation": [ 0, 180, 0 ], + "scale": [ 1, 1, 1 ] + } + } +} diff --git a/src/test/resources/assets/new_model_loader_test/models/item/concept_item.json b/src/test/resources/assets/new_model_loader_test/models/item/concept_item.json new file mode 100644 index 000000000..3770ba0c0 --- /dev/null +++ b/src/test/resources/assets/new_model_loader_test/models/item/concept_item.json @@ -0,0 +1,14 @@ +{ + "parent": "forge:item/default", + "loader": "forge:composite", + "models": [ + { + "loader": "...", + "transform": {} + }, + { + "loader": "...", + "transform": {} + } + ] +} diff --git a/src/test/resources/assets/new_model_loader_test/models/item/custom_transforms.json b/src/test/resources/assets/new_model_loader_test/models/item/custom_transforms.json new file mode 100644 index 000000000..4d8af77c4 --- /dev/null +++ b/src/test/resources/assets/new_model_loader_test/models/item/custom_transforms.json @@ -0,0 +1,13 @@ +{ + "parent": "forge:item/default", + "loader": "forge:obj", + "model": "new_model_loader_test:models/item/item_direction.obj", + "textures": { + "particle": "block/oak_planks" + }, + "transform": { + "firstperson_righthand": { + "scale": 3.0 + } + } +} diff --git a/src/test/resources/assets/new_model_loader_test/models/item/custom_vanilla_loader.json b/src/test/resources/assets/new_model_loader_test/models/item/custom_vanilla_loader.json new file mode 100644 index 000000000..ecf881346 --- /dev/null +++ b/src/test/resources/assets/new_model_loader_test/models/item/custom_vanilla_loader.json @@ -0,0 +1,56 @@ +{ + "parent": "block/block", + "loader": "minecraft:elements", + "display": { + "firstperson_righthand": { + "rotation": [ 0, 135, 0 ], + "translation": [ 0, 0, 0 ], + "scale": [ 0.4, 0.4, 0.4 ] + } + }, + "textures": { + "particle": "block/lectern_sides", + "bottom": "block/oak_planks", + "base": "block/lectern_base", + "front": "block/lectern_front", + "sides": "block/lectern_sides", + "top": "block/lectern_top" + }, + "elements": [ + { + "from": [ 0, 0, 0 ], + "to": [ 16, 2, 16 ], + "faces": { + "north": { "uv": [ 0, 14, 16, 16 ], "texture": "#base", "cullface": "north" }, + "east": { "uv": [ 0, 6, 16, 8 ], "texture": "#base", "cullface": "east" }, + "south": { "uv": [ 0, 6, 16, 8 ], "texture": "#base", "cullface": "south" }, + "west": { "uv": [ 0, 6, 16, 8 ], "texture": "#base", "cullface": "west" }, + "up": { "uv": [ 0, 0, 16, 16 ], "rotation": 180, "texture": "#base" }, + "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" } + } + }, + { + "from": [4, 2, 4], + "to": [12, 15, 12], + "faces": { + "north": { "uv": [ 0, 0, 8, 13 ], "texture": "#front" }, + "east": { "uv": [ 2, 16, 15, 8 ], "rotation": 90, "texture": "#sides" }, + "south": { "uv": [ 8, 3, 16, 16 ], "texture": "#front" }, + "west": { "uv": [ 2, 8, 15, 16 ], "rotation": 90, "texture": "#sides" } + } + }, + { + "from": [ 0.01, 12, 3 ], + "to": [ 15.99, 16, 16 ], + "rotation": { "angle": -22.5, "axis": "x", "origin": [ 8, 8, 8 ] }, + "faces": { + "north": { "uv": [ 0, 0, 16, 4 ], "texture": "#sides" }, + "east": { "uv": [ 0, 4, 13, 8 ], "texture": "#sides" }, + "south": { "uv": [ 0, 4, 16, 8 ], "texture": "#sides" }, + "west": { "uv": [ 0, 4, 13, 8 ], "texture": "#sides" }, + "up": { "uv": [ 0, 1, 16, 14 ], "rotation": 180, "texture": "#top" }, + "down": { "uv": [ 0, 0, 16, 13 ], "texture": "#bottom" } + } + } + ] +} diff --git a/src/test/resources/assets/new_model_loader_test/models/item/item_direction.mtl b/src/test/resources/assets/new_model_loader_test/models/item/item_direction.mtl new file mode 100644 index 000000000..db7f1af66 --- /dev/null +++ b/src/test/resources/assets/new_model_loader_test/models/item/item_direction.mtl @@ -0,0 +1,7 @@ +newmtl None +Ns 0 +Ka 1.0000 1.0000 1.0000 +Kd 0.8 0.8 0.8 +Ks 0.8 0.8 0.8 +d 1 +illum 2 diff --git a/src/test/resources/assets/new_model_loader_test/models/item/item_direction.obj b/src/test/resources/assets/new_model_loader_test/models/item/item_direction.obj new file mode 100644 index 000000000..20157d0cb --- /dev/null +++ b/src/test/resources/assets/new_model_loader_test/models/item/item_direction.obj @@ -0,0 +1,650 @@ +mtllib item_direction.mtl +o Cylinder.001 +v 0.584859 0.436110 0.874908 +v 0.659354 0.514439 0.772372 +v 0.705396 0.514439 0.914073 +v 0.584859 0.514440 1.001649 +v 0.464321 0.514439 0.914073 +v 0.510363 0.514439 0.772372 +v 0.705396 0.641182 0.835744 +v 0.659354 0.641182 0.977444 +v 0.510363 0.641182 0.977444 +v 0.464321 0.641182 0.835744 +v 0.584859 0.641182 0.748167 +v 0.584859 0.719512 0.874908 +v 0.655708 0.457272 0.897928 +v 0.628646 0.457272 0.814639 +v 0.699496 0.503313 0.837659 +v 0.584859 0.503313 0.754370 +v 0.541071 0.457272 0.814639 +v 0.584859 0.457273 0.949404 +v 0.655709 0.503313 0.972425 +v 0.514009 0.457272 0.897928 +v 0.514008 0.503313 0.972425 +v 0.470221 0.503313 0.837659 +v 0.628646 0.577811 0.740142 +v 0.541071 0.577811 0.740142 +v 0.726560 0.577811 0.874908 +v 0.699497 0.577811 0.791618 +v 0.628646 0.577811 1.009674 +v 0.699497 0.577811 0.958198 +v 0.470220 0.577811 0.958198 +v 0.541071 0.577811 1.009674 +v 0.470220 0.577811 0.791618 +v 0.443157 0.577811 0.874908 +v 0.655709 0.652308 0.777391 +v 0.699496 0.652308 0.912157 +v 0.584859 0.652308 0.995446 +v 0.470221 0.652308 0.912157 +v 0.514008 0.652308 0.777391 +v 0.655708 0.698349 0.851888 +v 0.584859 0.698349 0.800412 +v 0.628646 0.698349 0.935177 +v 0.541071 0.698349 0.935177 +v 0.514009 0.698349 0.851888 +v 0.649105 0.608429 0.910870 +v 0.649105 0.047528 0.910870 +v 0.645187 0.608429 0.871087 +v 0.645187 0.047528 0.871087 +v 0.633582 0.608429 0.832833 +v 0.633583 0.047528 0.832833 +v 0.614738 0.608429 0.797578 +v 0.614738 0.047528 0.797578 +v 0.589378 0.608429 0.766677 +v 0.589378 0.047528 0.766677 +v 0.558477 0.608429 0.741317 +v 0.558477 0.047528 0.741317 +v 0.523222 0.608429 0.722473 +v 0.523222 0.047528 0.722473 +v 0.484968 0.608429 0.710868 +v 0.484968 0.047528 0.710868 +v 0.445185 0.608429 0.706950 +v 0.445185 0.047528 0.706950 +v 0.405402 0.608429 0.710868 +v 0.405402 0.047528 0.710868 +v 0.367148 0.608429 0.722473 +v 0.367148 0.047528 0.722473 +v 0.331893 0.608429 0.741317 +v 0.331893 0.047528 0.741317 +v 0.300992 0.608429 0.766677 +v 0.300992 0.047528 0.766677 +v 0.275632 0.608429 0.797578 +v 0.275632 0.047528 0.797578 +v 0.256788 0.608429 0.832833 +v 0.256788 0.047528 0.832833 +v 0.245183 0.608429 0.871087 +v 0.245183 0.047528 0.871087 +v 0.241265 0.608429 0.910870 +v 0.241265 0.047528 0.910870 +v 0.245183 0.608429 0.950653 +v 0.245183 0.047528 0.950653 +v 0.256788 0.608429 0.988907 +v 0.256788 0.047528 0.988907 +v 0.275632 0.608429 1.024162 +v 0.275632 0.047528 1.024162 +v 0.300992 0.608429 1.055063 +v 0.300992 0.047528 1.055063 +v 0.331893 0.608429 1.080423 +v 0.331893 0.047528 1.080423 +v 0.367148 0.608429 1.099268 +v 0.367148 0.047528 1.099268 +v 0.405402 0.608429 1.110872 +v 0.405402 0.047528 1.110872 +v 0.445185 0.608429 1.114790 +v 0.445185 0.047528 1.114790 +v 0.484968 0.608429 1.110872 +v 0.484968 0.047528 1.110872 +v 0.523222 0.608429 1.099267 +v 0.523222 0.047528 1.099267 +v 0.558477 0.608429 1.080423 +v 0.558477 0.047528 1.080423 +v 0.589378 0.608429 1.055063 +v 0.589378 0.047528 1.055063 +v 0.614738 0.608429 1.024162 +v 0.614739 0.047528 1.024162 +v 0.633583 0.608429 0.988907 +v 0.633583 0.047528 0.988907 +v 0.645187 0.608429 0.950653 +v 0.645187 0.047528 0.950653 +v -0.406158 0.670618 0.910870 +v 0.627582 0.670618 0.910870 +v -0.406158 0.666700 0.871087 +v 0.627582 0.666700 0.871087 +v -0.406158 0.655096 0.832833 +v 0.627582 0.655096 0.832833 +v -0.406158 0.636251 0.797578 +v 0.627582 0.636251 0.797578 +v -0.406158 0.610891 0.766677 +v 0.627582 0.610891 0.766677 +v -0.406158 0.579990 0.741317 +v 0.627582 0.579990 0.741317 +v -0.406158 0.544735 0.722473 +v 0.627582 0.544735 0.722473 +v -0.406158 0.506481 0.710868 +v 0.627582 0.506481 0.710868 +v -0.406158 0.466698 0.706950 +v 0.627582 0.466698 0.706950 +v -0.406158 0.426915 0.710868 +v 0.627582 0.426915 0.710868 +v -0.406158 0.388661 0.722473 +v 0.627582 0.388661 0.722473 +v -0.406158 0.353406 0.741317 +v 0.627582 0.353406 0.741317 +v -0.406158 0.322505 0.766677 +v 0.627582 0.322505 0.766677 +v -0.406158 0.297145 0.797578 +v 0.627582 0.297145 0.797578 +v -0.406158 0.278301 0.832833 +v 0.627582 0.278301 0.832833 +v -0.406158 0.266696 0.871087 +v 0.627582 0.266696 0.871087 +v -0.406158 0.262778 0.910870 +v 0.627582 0.262778 0.910870 +v -0.406158 0.266696 0.950653 +v 0.627582 0.266696 0.950653 +v -0.406158 0.278301 0.988907 +v 0.627582 0.278301 0.988907 +v -0.406158 0.297145 1.024162 +v 0.627582 0.297145 1.024162 +v -0.406158 0.322505 1.055063 +v 0.627582 0.322505 1.055063 +v -0.406158 0.353406 1.080423 +v 0.627582 0.353406 1.080423 +v -0.406158 0.388661 1.099268 +v 0.627582 0.388661 1.099268 +v -0.406158 0.426915 1.110872 +v 0.627582 0.426915 1.110872 +v -0.406158 0.466698 1.114790 +v 0.627582 0.466698 1.114790 +v -0.406158 0.506481 1.110872 +v 0.627582 0.506481 1.110872 +v -0.406158 0.544735 1.099267 +v 0.627582 0.544735 1.099267 +v -0.406158 0.579990 1.080423 +v 0.627582 0.579990 1.080423 +v -0.406158 0.610891 1.055063 +v 0.627582 0.610891 1.055063 +v -0.406158 0.636251 1.024162 +v 0.627582 0.636251 1.024162 +v -0.406158 0.655096 0.988907 +v 0.627582 0.655096 0.988907 +v -0.406158 0.666700 0.950653 +v 0.627582 0.666700 0.950653 +vn 0.315100 -0.943500 -0.102400 +vn 0.268000 -0.661700 -0.700200 +vn 0.194700 -0.943500 0.268000 +vn -0.194700 -0.943500 0.268000 +vn -0.315100 -0.943500 -0.102400 +vn 0.268000 -0.330400 -0.905000 +vn 0.943500 -0.330400 -0.024700 +vn 0.315100 -0.330400 0.889700 +vn -0.748800 -0.330400 0.574600 +vn -0.777900 -0.330400 -0.534600 +vn 0.583100 -0.125600 -0.802600 +vn 0.943500 -0.125600 0.306600 +vn -0.000000 -0.125600 0.992100 +vn -0.943500 -0.125600 0.306600 +vn -0.583100 -0.125600 -0.802600 +vn 0.628400 0.661700 -0.408900 +vn 0.583100 0.661700 0.471300 +vn -0.268000 0.661700 0.700200 +vn -0.748800 0.661700 -0.038500 +vn -0.194700 0.661700 -0.724000 +vn -0.194700 0.943500 -0.268000 +vn -0.356800 0.794700 -0.491100 +vn -0.628400 0.661700 -0.408900 +vn -0.315100 0.943500 0.102400 +vn -0.577300 0.794700 0.187600 +vn -0.583100 0.661700 0.471300 +vn -0.000000 0.943500 0.331300 +vn -0.000000 0.794700 0.607100 +vn 0.268000 0.661700 0.700200 +vn 0.315100 0.943500 0.102400 +vn 0.577300 0.794700 0.187600 +vn 0.748800 0.661700 -0.038500 +vn 0.194700 0.943500 -0.268000 +vn 0.356800 0.794700 -0.491100 +vn 0.194700 0.661700 -0.724000 +vn -0.315100 0.330400 -0.889700 +vn -0.577300 0.187600 -0.794700 +vn -0.748800 0.330400 -0.574600 +vn -0.943500 0.330400 0.024700 +vn -0.934200 0.187600 0.303500 +vn -0.777900 0.330400 0.534600 +vn -0.268000 0.330400 0.905000 +vn 0.000000 0.187600 0.982200 +vn 0.268000 0.330400 0.905000 +vn 0.777900 0.330400 0.534600 +vn 0.934200 0.187600 0.303500 +vn 0.943500 0.330400 0.024700 +vn 0.748800 0.330400 -0.574600 +vn 0.577300 0.187600 -0.794700 +vn 0.315100 0.330400 -0.889700 +vn -0.943500 0.125600 -0.306600 +vn -0.934200 -0.187600 -0.303500 +vn -0.943500 -0.330400 -0.024700 +vn -0.583100 0.125600 0.802600 +vn -0.577300 -0.187600 0.794700 +vn -0.315100 -0.330400 0.889700 +vn 0.583100 0.125600 0.802600 +vn 0.577300 -0.187600 0.794700 +vn 0.748800 -0.330400 0.574600 +vn 0.943500 0.125600 -0.306600 +vn 0.934200 -0.187600 -0.303500 +vn 0.777900 -0.330400 -0.534600 +vn 0.000000 0.125600 -0.992100 +vn 0.000000 -0.187600 -0.982200 +vn -0.268000 -0.330400 -0.905000 +vn -0.583100 -0.661700 -0.471300 +vn -0.577300 -0.794700 -0.187600 +vn -0.748800 -0.661700 0.038500 +vn -0.628400 -0.661700 0.408900 +vn -0.356800 -0.794700 0.491100 +vn -0.194700 -0.661700 0.724000 +vn 0.194700 -0.661700 0.724000 +vn 0.356800 -0.794700 0.491100 +vn 0.628400 -0.661700 0.408900 +vn -0.268000 -0.661700 -0.700200 +vn 0.000000 -0.794700 -0.607100 +vn 0.000000 -0.943500 -0.331300 +vn 0.748800 -0.661700 0.038500 +vn 0.577300 -0.794700 -0.187600 +vn 0.583100 -0.661700 -0.471300 +vn 0.995200 0.000000 -0.098000 +vn 0.956900 0.000000 -0.290300 +vn 0.881900 0.000000 -0.471400 +vn 0.773000 0.000000 -0.634400 +vn 0.634400 0.000000 -0.773000 +vn 0.471400 0.000000 -0.881900 +vn 0.290300 0.000000 -0.956900 +vn 0.098000 0.000000 -0.995200 +vn -0.098000 0.000000 -0.995200 +vn -0.290300 0.000000 -0.956900 +vn -0.471400 -0.000000 -0.881900 +vn -0.634400 -0.000000 -0.773000 +vn -0.773000 -0.000000 -0.634400 +vn -0.881900 -0.000000 -0.471400 +vn -0.956900 -0.000000 -0.290300 +vn -0.995200 -0.000000 -0.098000 +vn -0.995200 -0.000000 0.098000 +vn -0.956900 -0.000000 0.290300 +vn -0.881900 -0.000000 0.471400 +vn -0.773000 -0.000000 0.634400 +vn -0.634400 -0.000000 0.773000 +vn -0.471400 0.000000 0.881900 +vn -0.290300 0.000000 0.956900 +vn -0.098000 -0.000000 0.995200 +vn 0.098000 0.000000 0.995200 +vn 0.290300 0.000000 0.956900 +vn 0.471400 0.000000 0.881900 +vn 0.634400 0.000000 0.773000 +vn 0.773000 0.000000 0.634400 +vn 0.881900 0.000000 0.471400 +vn 0.000000 -1.000000 -0.000000 +vn 0.995200 0.000000 0.098000 +vn 0.956900 0.000000 0.290300 +vn -0.000000 1.000000 0.000000 +vn 0.000000 0.995200 -0.098000 +vn 0.000000 0.956900 -0.290300 +vn 0.000000 0.881900 -0.471400 +vn 0.000000 0.773000 -0.634400 +vn 0.000000 0.634400 -0.773000 +vn 0.000000 0.471400 -0.881900 +vn -0.000000 0.290300 -0.956900 +vn 0.000000 0.098000 -0.995200 +vn 0.000000 -0.098000 -0.995200 +vn 0.000000 -0.290300 -0.956900 +vn 0.000000 -0.471400 -0.881900 +vn 0.000000 -0.634400 -0.773000 +vn 0.000000 -0.773000 -0.634400 +vn 0.000000 -0.881900 -0.471400 +vn 0.000000 -0.956900 -0.290300 +vn 0.000000 -0.995200 -0.098000 +vn 0.000000 -0.995200 0.098000 +vn 0.000000 -0.956900 0.290300 +vn 0.000000 -0.881900 0.471400 +vn 0.000000 -0.773000 0.634400 +vn -0.000000 -0.634400 0.773000 +vn -0.000000 -0.471400 0.881900 +vn 0.000000 -0.290300 0.956900 +vn 0.000000 -0.098000 0.995200 +vn 0.000000 0.098000 0.995200 +vn -0.000000 0.290300 0.956900 +vn -0.000000 0.471400 0.881900 +vn 0.000000 0.634400 0.773000 +vn 0.000000 0.773000 0.634400 +vn 0.000000 0.881900 0.471400 +vn 1.000000 0.000000 0.000000 +vn 0.000000 0.995200 0.098000 +vn -0.000000 0.956900 0.290300 +vn -1.000000 -0.000000 0.000000 +usemtl None +s off +f 1//1 14//1 13//1 +f 2//2 14//2 16//2 +f 1//3 13//3 18//3 +f 1//4 18//4 20//4 +f 1//5 20//5 17//5 +f 2//6 16//6 23//6 +f 3//7 15//7 25//7 +f 4//8 19//8 27//8 +f 5//9 21//9 29//9 +f 6//10 22//10 31//10 +f 2//11 23//11 26//11 +f 3//12 25//12 28//12 +f 4//13 27//13 30//13 +f 5//14 29//14 32//14 +f 6//15 31//15 24//15 +f 7//16 33//16 38//16 +f 8//17 34//17 40//17 +f 9//18 35//18 41//18 +f 10//19 36//19 42//19 +f 11//20 37//20 39//20 +f 39//21 42//21 12//21 +f 39//22 37//22 42//22 +f 37//23 10//23 42//23 +f 42//24 41//24 12//24 +f 42//25 36//25 41//25 +f 36//26 9//26 41//26 +f 41//27 40//27 12//27 +f 41//28 35//28 40//28 +f 35//29 8//29 40//29 +f 40//30 38//30 12//30 +f 40//31 34//31 38//31 +f 34//32 7//32 38//32 +f 38//33 39//33 12//33 +f 38//34 33//34 39//34 +f 33//35 11//35 39//35 +f 24//36 37//36 11//36 +f 24//37 31//37 37//37 +f 31//38 10//38 37//38 +f 32//39 36//39 10//39 +f 32//40 29//40 36//40 +f 29//41 9//41 36//41 +f 30//42 35//42 9//42 +f 30//43 27//43 35//43 +f 27//44 8//44 35//44 +f 28//45 34//45 8//45 +f 28//46 25//46 34//46 +f 25//47 7//47 34//47 +f 26//48 33//48 7//48 +f 26//49 23//49 33//49 +f 23//50 11//50 33//50 +f 31//51 32//51 10//51 +f 31//52 22//52 32//52 +f 22//53 5//53 32//53 +f 29//54 30//54 9//54 +f 29//55 21//55 30//55 +f 21//56 4//56 30//56 +f 27//57 28//57 8//57 +f 27//58 19//58 28//58 +f 19//59 3//59 28//59 +f 25//60 26//60 7//60 +f 25//61 15//61 26//61 +f 15//62 2//62 26//62 +f 23//63 24//63 11//63 +f 23//64 16//64 24//64 +f 16//65 6//65 24//65 +f 17//66 22//66 6//66 +f 17//67 20//67 22//67 +f 20//68 5//68 22//68 +f 20//69 21//69 5//69 +f 20//70 18//70 21//70 +f 18//71 4//71 21//71 +f 18//72 19//72 4//72 +f 18//73 13//73 19//73 +f 13//74 3//74 19//74 +f 16//75 17//75 6//75 +f 16//76 14//76 17//76 +f 14//77 1//77 17//77 +f 13//78 15//78 3//78 +f 13//79 14//79 15//79 +f 14//80 2//80 15//80 +f 44//81 46//81 45//81 +f 46//82 48//82 47//82 +f 48//83 50//83 49//83 +f 50//84 52//84 51//84 +f 52//85 54//85 53//85 +f 54//86 56//86 55//86 +f 56//87 58//87 57//87 +f 58//88 60//88 59//88 +f 60//89 62//89 61//89 +f 62//90 64//90 63//90 +f 64//91 66//91 65//91 +f 66//92 68//92 67//92 +f 68//93 70//93 69//93 +f 69//94 70//94 72//94 +f 72//95 74//95 73//95 +f 74//96 76//96 75//96 +f 76//97 78//97 77//97 +f 78//98 80//98 79//98 +f 80//99 82//99 81//99 +f 82//100 84//100 83//100 +f 84//101 86//101 85//101 +f 85//102 86//102 88//102 +f 88//103 90//103 89//103 +f 90//104 92//104 91//104 +f 92//105 94//105 93//105 +f 94//106 96//106 95//106 +f 96//107 98//107 97//107 +f 98//108 100//108 99//108 +f 100//109 102//109 101//109 +f 102//110 104//110 103//110 +f 80//111 64//111 48//111 +f 106//112 44//112 43//112 +f 104//113 106//113 105//113 +f 73//114 89//114 105//114 +f 108//115 110//115 109//115 +f 110//116 112//116 111//116 +f 112//117 114//117 113//117 +f 114//118 116//118 115//118 +f 116//119 118//119 117//119 +f 118//120 120//120 119//120 +f 120//121 122//121 121//121 +f 122//122 124//122 123//122 +f 124//123 126//123 125//123 +f 126//124 128//124 127//124 +f 128//125 130//125 129//125 +f 130//126 132//126 131//126 +f 132//127 134//127 133//127 +f 134//128 136//128 135//128 +f 136//129 138//129 137//129 +f 138//130 140//130 139//130 +f 140//131 142//131 141//131 +f 142//132 144//132 143//132 +f 144//133 146//133 145//133 +f 146//134 148//134 147//134 +f 148//135 150//135 149//135 +f 150//136 152//136 151//136 +f 152//137 154//137 153//137 +f 154//138 156//138 155//138 +f 156//139 158//139 157//139 +f 157//140 158//140 160//140 +f 160//141 162//141 161//141 +f 162//142 164//142 163//142 +f 164//143 166//143 165//143 +f 166//144 168//144 167//144 +f 136//145 128//145 112//145 +f 170//146 108//146 107//146 +f 168//147 170//147 169//147 +f 137//148 153//148 169//148 +f 43//81 44//81 45//81 +f 45//82 46//82 47//82 +f 47//83 48//83 49//83 +f 49//84 50//84 51//84 +f 51//85 52//85 53//85 +f 53//86 54//86 55//86 +f 55//87 56//87 57//87 +f 57//88 58//88 59//88 +f 59//89 60//89 61//89 +f 61//90 62//90 63//90 +f 63//91 64//91 65//91 +f 65//92 66//92 67//92 +f 67//93 68//93 69//93 +f 71//94 69//94 72//94 +f 71//95 72//95 73//95 +f 73//96 74//96 75//96 +f 75//97 76//97 77//97 +f 77//98 78//98 79//98 +f 79//99 80//99 81//99 +f 81//100 82//100 83//100 +f 83//101 84//101 85//101 +f 87//102 85//102 88//102 +f 87//103 88//103 89//103 +f 89//104 90//104 91//104 +f 91//105 92//105 93//105 +f 93//106 94//106 95//106 +f 95//107 96//107 97//107 +f 97//108 98//108 99//108 +f 99//109 100//109 101//109 +f 101//110 102//110 103//110 +f 48//111 46//111 104//111 +f 44//111 106//111 104//111 +f 104//111 102//111 100//111 +f 100//111 98//111 96//111 +f 96//111 94//111 92//111 +f 92//111 90//111 96//111 +f 88//111 86//111 84//111 +f 84//111 82//111 88//111 +f 80//111 78//111 76//111 +f 76//111 74//111 80//111 +f 72//111 70//111 68//111 +f 68//111 66//111 64//111 +f 64//111 62//111 56//111 +f 60//111 58//111 56//111 +f 56//111 54//111 52//111 +f 52//111 50//111 48//111 +f 46//111 44//111 104//111 +f 104//111 100//111 96//111 +f 96//111 90//111 88//111 +f 88//111 82//111 80//111 +f 80//111 74//111 72//111 +f 72//111 68//111 80//111 +f 62//111 60//111 56//111 +f 56//111 52//111 64//111 +f 48//111 104//111 96//111 +f 96//111 88//111 80//111 +f 80//111 68//111 64//111 +f 64//111 52//111 48//111 +f 48//111 96//111 80//111 +f 105//112 106//112 43//112 +f 103//113 104//113 105//113 +f 105//114 43//114 49//114 +f 45//114 47//114 49//114 +f 49//114 51//114 57//114 +f 53//114 55//114 57//114 +f 57//114 59//114 61//114 +f 61//114 63//114 65//114 +f 65//114 67//114 69//114 +f 69//114 71//114 73//114 +f 73//114 75//114 77//114 +f 77//114 79//114 73//114 +f 81//114 83//114 85//114 +f 85//114 87//114 81//114 +f 89//114 91//114 93//114 +f 93//114 95//114 89//114 +f 97//114 99//114 101//114 +f 101//114 103//114 97//114 +f 43//114 45//114 49//114 +f 51//114 53//114 57//114 +f 57//114 61//114 65//114 +f 65//114 69//114 73//114 +f 73//114 79//114 81//114 +f 81//114 87//114 89//114 +f 89//114 95//114 97//114 +f 97//114 103//114 105//114 +f 105//114 49//114 57//114 +f 57//114 65//114 73//114 +f 73//114 81//114 89//114 +f 89//114 97//114 105//114 +f 105//114 57//114 73//114 +f 107//115 108//115 109//115 +f 109//116 110//116 111//116 +f 111//117 112//117 113//117 +f 113//118 114//118 115//118 +f 115//119 116//119 117//119 +f 117//120 118//120 119//120 +f 119//121 120//121 121//121 +f 121//122 122//122 123//122 +f 123//123 124//123 125//123 +f 125//124 126//124 127//124 +f 127//125 128//125 129//125 +f 129//126 130//126 131//126 +f 131//127 132//127 133//127 +f 133//128 134//128 135//128 +f 135//129 136//129 137//129 +f 137//130 138//130 139//130 +f 139//131 140//131 141//131 +f 141//132 142//132 143//132 +f 143//133 144//133 145//133 +f 145//134 146//134 147//134 +f 147//135 148//135 149//135 +f 149//136 150//136 151//136 +f 151//137 152//137 153//137 +f 153//138 154//138 155//138 +f 155//139 156//139 157//139 +f 159//140 157//140 160//140 +f 159//141 160//141 161//141 +f 161//142 162//142 163//142 +f 163//143 164//143 165//143 +f 165//144 166//144 167//144 +f 112//145 110//145 168//145 +f 108//145 170//145 168//145 +f 168//145 166//145 164//145 +f 164//145 162//145 160//145 +f 160//145 158//145 156//145 +f 156//145 154//145 160//145 +f 152//145 150//145 144//145 +f 148//145 146//145 144//145 +f 144//145 142//145 136//145 +f 140//145 138//145 136//145 +f 136//145 134//145 132//145 +f 132//145 130//145 128//145 +f 128//145 126//145 124//145 +f 124//145 122//145 120//145 +f 120//145 118//145 116//145 +f 116//145 114//145 112//145 +f 110//145 108//145 168//145 +f 168//145 164//145 112//145 +f 160//145 154//145 152//145 +f 150//145 148//145 144//145 +f 142//145 140//145 136//145 +f 136//145 132//145 128//145 +f 128//145 124//145 120//145 +f 120//145 116//145 128//145 +f 112//145 164//145 160//145 +f 160//145 152//145 144//145 +f 144//145 136//145 112//145 +f 128//145 116//145 112//145 +f 112//145 160//145 144//145 +f 169//146 170//146 107//146 +f 167//147 168//147 169//147 +f 169//148 107//148 109//148 +f 109//148 111//148 113//148 +f 113//148 115//148 121//148 +f 117//148 119//148 121//148 +f 121//148 123//148 125//148 +f 125//148 127//148 129//148 +f 129//148 131//148 137//148 +f 133//148 135//148 137//148 +f 137//148 139//148 141//148 +f 141//148 143//148 145//148 +f 145//148 147//148 149//148 +f 149//148 151//148 153//148 +f 153//148 155//148 157//148 +f 157//148 159//148 161//148 +f 161//148 163//148 165//148 +f 165//148 167//148 169//148 +f 169//148 109//148 113//148 +f 115//148 117//148 121//148 +f 121//148 125//148 129//148 +f 131//148 133//148 137//148 +f 137//148 141//148 145//148 +f 145//148 149//148 137//148 +f 153//148 157//148 169//148 +f 161//148 165//148 169//148 +f 169//148 113//148 137//148 +f 121//148 129//148 137//148 +f 137//148 149//148 153//148 +f 157//148 161//148 169//148 +f 113//148 121//148 137//148 diff --git a/src/test/resources/assets/new_model_loader_test/models/item/obj_item.json b/src/test/resources/assets/new_model_loader_test/models/item/obj_item.json new file mode 100644 index 000000000..a5a5c5f05 --- /dev/null +++ b/src/test/resources/assets/new_model_loader_test/models/item/obj_item.json @@ -0,0 +1,50 @@ +{ + "parent": "forge:item/default", + "loader": "forge:obj", + "model": "new_model_loader_test:models/item/sugar_glider.obj", + "ambientToFullbright": true, + "textures": { + "particle": "block/oak_planks" + }, + "display": { + "gui": { + "rotation": [ 30, 45, 0 ], + "translation": [ 0, 3, 0 ], + "scale": [ 1, 1, 1 ] + }, + "fixed": { + "rotation": [ 0, 180, 0 ], + "translation": [ 0, 4, 0], + "scale":[ 1, 1, 1 ] + }, + "ground": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 3, 0 ], + "scale": [ 0.5, 0.5, 0.5 ] + }, + "head": { + "rotation": [ 0, 180, 0 ], + "translation": [ 0, 5, 0 ], + "scale":[ 1.5, 1.5, 1.5 ] + }, + "thirdperson_righthand": { + "rotation": [ 45, 45, 0 ], + "translation": [ 0, 3, 0 ], + "scale": [ 0.5, 0.5, 0.5 ] + } + }, + "transform": { + "firstperson_righthand": { + "scale": 2.0, + "translation": [0,0.5,0] + }, + "firstperson_lefthand": { + "scale": 0.5, + "translation": [0,1.5,1.5] + } + }, + "visibility": { + "object_1": false, + "object_3": true + } +} diff --git a/src/test/resources/assets/new_model_loader_test/models/item/sugar_glider.mtl b/src/test/resources/assets/new_model_loader_test/models/item/sugar_glider.mtl new file mode 100644 index 000000000..e2688c6b3 --- /dev/null +++ b/src/test/resources/assets/new_model_loader_test/models/item/sugar_glider.mtl @@ -0,0 +1,46 @@ +# Rhino +newmtl New material 001 (1) +Ka 0.0000 0.0000 0.0000 +Kd 0.4588 0.3333 0.1882 +Ks 1.0000 1.0000 1.0000 +Tf 0.0000 0.0000 0.0000 +d 1.0000 +Ns 0 +map_Kd block/birch_planks + +newmtl New material 001 +Ka 0.0000 0.0000 0.0000 +Kd 0.6745 0.5216 0.3412 +Ks 1.0000 1.0000 1.0000 +Tf 0.0000 0.0000 0.0000 +d 1.0000 +Ns 0 +map_Kd block/birch_planks + +newmtl Default +Ka 0.0000 0.0000 0.0000 +Kd 1.0000 1.0000 1.0000 +Ks 1.0000 1.0000 1.0000 +Tf 0.0000 0.0000 0.0000 +d 1.0000 +Ns 0 +map_Kd block/birch_planks + +newmtl New material 002 +Ka 0.0000 0.0000 0.0000 +Kd 0.4118 0.4118 0.4118 +Ks 1.0000 1.0000 1.0000 +Tf 0.0000 0.0000 0.0000 +d 1.0000 +Ns 0 +map_Kd block/birch_planks + +newmtl New material 003 +Ka 0.0000 0.0000 0.0000 +Kd 0.1490 0.1490 0.1490 +Ks 1.0000 1.0000 1.0000 +Tf 0.0000 0.0000 0.0000 +d 1.0000 +Ns 0 +map_Kd block/birch_planks + diff --git a/src/test/resources/assets/new_model_loader_test/models/item/sugar_glider.obj b/src/test/resources/assets/new_model_loader_test/models/item/sugar_glider.obj new file mode 100644 index 000000000..3b1c5bd27 --- /dev/null +++ b/src/test/resources/assets/new_model_loader_test/models/item/sugar_glider.obj @@ -0,0 +1,579 @@ +# Rhino + +mtllib sugar_glider.mtl +o object_1 +usemtl New material 001 (1) +v 0.7132 0.6084 0.6162 +v 0.7132 0.3283 0.4863 +v 0.8296 0.5819 0.6734 +v 0.8296 0.3018 0.5435 +v 0.8605 0.7225 0.3699 +v 0.8605 0.4425 0.24 +v 0.9769 0.6963 0.4272 +v 0.9769 0.4159 0.2973 +vt 0.7132 0.6084 +vt 0.6162 0.6084 +vt 0.7132 0.3838 +vt 0.7132 0.3283 +vt 0.4863 0.3283 +vt 0.2868 0.5137 +vt 0.8296 0.5819 +vt 0.3266 0.5819 +vt 0.8296 0.3266 +vt 0.8296 0.3018 +vt 0.4565 0.3018 +vt 0.1704 0.4565 +vt 0.1395 0.7225 +vt 0.3699 0.7225 +vt 0.8605 0.6301 +vt 0.1395 0.4425 +vt 0.24 0.4425 +vt 0.1395 0.76 +vt 0.5728 0.6963 +vt 0.0231 0.6963 +vt 0.9769 0.5728 +vt 0.7027 0.4159 +vt 0.0231 0.4159 +vt 0.0231 0.7027 +vn -0.4768 -0.3698 0.7974 +vn -0.879 0.2006 -0.4325 +vn 0 0.9072 0.4207 +vn -0.4768 -0.3698 0.7974 +vn -0.879 0.2006 -0.4325 +vn 0 -0.9072 -0.4207 +vn -0.4768 -0.3698 0.7974 +vn 0.879 -0.2006 0.4325 +vn 0 0.9072 0.4207 +vn -0.4768 -0.3698 0.7974 +vn 0.879 -0.2006 0.4325 +vn 0 -0.9072 -0.4207 +vn 0.4768 0.3698 -0.7974 +vn -0.879 0.2006 -0.4325 +vn 0 0.9072 0.4207 +vn 0.4768 0.3698 -0.7974 +vn -0.879 0.2006 -0.4325 +vn 0 -0.9072 -0.4207 +vn 0.879 -0.2006 0.4325 +vn 0.4768 0.3698 -0.7974 +vn 0 0.9072 0.4207 +vn 0.879 -0.2006 0.4325 +vn 0.4768 0.3698 -0.7974 +vn 0 -0.9072 -0.4207 +f 2/4/4 4/10/10 3/7/7 1/1/1 +f 4/11/11 8/22/22 7/19/19 3/8/8 +f 8/23/23 6/16/16 5/13/13 7/20/20 +f 6/17/17 2/5/5 1/2/2 5/14/14 +f 6/18/18 8/24/24 4/12/12 2/6/6 +f 3/9/9 7/21/21 5/15/15 1/3/3 +o object_2 +usemtl New material 001 +v 0.2059 0 0.7941 +v 0.2059 0.5883 0.7941 +v 0.2059 0 0.2059 +v 0.2059 0.5883 0.2059 +v 0.7941 0 0.7941 +v 0.7941 0.5883 0.7941 +v 0.7941 0 0.2059 +v 0.7941 0.5883 0.2059 +vt 0.2059 0 +vt 0.7941 0 +vt 0.7941 0.2059 +vt 0.2059 0.5883 +vt 0.7941 0.5883 +vt 0.2059 0.2059 +vt 0.7941 0 +vt 0.2059 0 +vt 0.7941 0.7941 +vt 0.7941 0.5883 +vt 0.2059 0.5883 +vt 0.2059 0.7941 +vt 0.7941 0 +vt 0.2059 0 +vt 0.2059 0.2059 +vt 0.7941 0.5883 +vt 0.2059 0.5883 +vt 0.7941 0.2059 +vt 0.7941 0 +vt 0.2059 0 +vt 0.2059 0.7941 +vt 0.7941 0.5883 +vt 0.2059 0.5883 +vt 0.7941 0.7941 +vn 0 0 1 +vn -1 0 0 +vn 0 -1 0 +vn 0 0 1 +vn -1 0 0 +vn 0 1 0 +vn 0 0 -1 +vn -1 0 0 +vn 0 -1 0 +vn 0 0 -1 +vn -1 0 0 +vn 0 1 0 +vn 0 0 1 +vn 1 0 0 +vn 0 -1 0 +vn 0 0 1 +vn 1 0 0 +vn 0 1 0 +vn 1 0 0 +vn 0 0 -1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 -1 +vn 0 1 0 +f 9/25/25 13/37/37 14/40/40 10/28/28 +f 13/38/38 15/43/43 16/46/46 14/41/41 +f 15/44/44 11/31/31 12/34/34 16/47/47 +f 11/32/32 9/26/26 10/29/29 12/35/35 +f 11/33/33 15/45/45 13/39/39 9/27/27 +f 14/42/42 16/48/48 12/36/36 10/30/30 +o object_3 +usemtl Default +v 0.5294 0.2353 0.8235 +v 0.5294 0.4706 0.8235 +v 0.5294 0.2353 0.7941 +v 0.5294 0.4706 0.7941 +v 0.7647 0.2353 0.8235 +v 0.7647 0.4706 0.8235 +v 0.7647 0.2353 0.7941 +v 0.7647 0.4706 0.7941 +vt 0.4706 0.1765 +vt 0.8235 0.2353 +vt 0.5294 0.2353 +vt 0.5294 0.1765 +vt 0.8235 0.4706 +vt 0.5294 0.4706 +vt 0.4706 0.2059 +vt 0.7941 0.2353 +vt 0.4706 0.2353 +vt 0.5294 0.2059 +vt 0.7941 0.4706 +vt 0.4706 0.4706 +vt 0.2353 0.1765 +vt 0.1765 0.2353 +vt 0.7647 0.2353 +vt 0.1765 0.4706 +vt 0.7647 0.1765 +vt 0.7647 0.4706 +vt 0.2353 0.2059 +vt 0.2059 0.2353 +vt 0.2353 0.2353 +vt 0.2059 0.4706 +vt 0.7647 0.2059 +vt 0.2353 0.4706 +vn 0 -1 0 +vn -1 0 0 +vn 0 0 1 +vn 0 1 0 +vn -1 0 0 +vn 0 0 1 +vn 0 -1 0 +vn -1 0 0 +vn 0 0 -1 +vn 0 1 0 +vn -1 0 0 +vn 0 0 -1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 1 +vn 1 0 0 +vn 0 1 0 +vn 0 0 1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 -1 +vn 1 0 0 +vn 0 1 0 +vn 0 0 -1 +f 19/55/55 23/67/67 21/61/61 17/49/49 +f 23/68/68 24/70/70 22/64/64 21/62/62 +f 24/71/71 20/58/58 18/52/52 22/65/65 +f 20/59/59 19/56/56 17/50/50 18/53/53 +f 20/60/60 24/72/72 23/69/69 19/57/57 +f 21/63/63 22/66/66 18/54/54 17/51/51 +o object_4 +usemtl Default +v 0.2353 0.2353 0.8235 +v 0.2353 0.4706 0.8235 +v 0.2353 0.2353 0.7941 +v 0.2353 0.4706 0.7941 +v 0.4706 0.2353 0.8235 +v 0.4706 0.4706 0.8235 +v 0.4706 0.2353 0.7941 +v 0.4706 0.4706 0.7941 +vt 0.7647 0.1765 +vt 0.8235 0.2353 +vt 0.2353 0.2353 +vt 0.2353 0.1765 +vt 0.8235 0.4706 +vt 0.2353 0.4706 +vt 0.7647 0.2059 +vt 0.7941 0.2353 +vt 0.7647 0.2353 +vt 0.2353 0.2059 +vt 0.7941 0.4706 +vt 0.7647 0.4706 +vt 0.5294 0.1765 +vt 0.1765 0.2353 +vt 0.4706 0.2353 +vt 0.1765 0.4706 +vt 0.4706 0.1765 +vt 0.4706 0.4706 +vt 0.5294 0.2059 +vt 0.2059 0.2353 +vt 0.5294 0.2353 +vt 0.2059 0.4706 +vt 0.4706 0.2059 +vt 0.5294 0.4706 +vn 0 -1 0 +vn -1 0 0 +vn 0 0 1 +vn 0 1 0 +vn -1 0 0 +vn 0 0 1 +vn 0 -1 0 +vn -1 0 0 +vn 0 0 -1 +vn 0 1 0 +vn -1 0 0 +vn 0 0 -1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 1 +vn 1 0 0 +vn 0 1 0 +vn 0 0 1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 -1 +vn 1 0 0 +vn 0 1 0 +vn 0 0 -1 +f 27/79/79 31/91/91 29/85/85 25/73/73 +f 31/92/92 32/94/94 30/88/88 29/86/86 +f 32/95/95 28/82/82 26/76/76 30/89/89 +f 28/83/83 27/80/80 25/74/74 26/77/77 +f 28/84/84 32/96/96 31/93/93 27/81/81 +f 29/87/87 30/90/90 26/78/78 25/75/75 +o object_5 +usemtl New material 001 +v 0.4118 0 0.8824 +v 0.4118 0.1765 0.8824 +v 0.4118 0 0.7353 +v 0.4118 0.1765 0.7353 +v 0.5882 0 0.8824 +v 0.5882 0.1765 0.8824 +v 0.5882 0 0.7353 +v 0.5882 0.1765 0.7353 +vt 0.4118 0 +vt 0.8824 0 +vt 0.5882 0.1176 +vt 0.4118 0.1765 +vt 0.8824 0.1765 +vt 0.4118 0.1176 +vt 0.5882 0 +vt 0.7353 0 +vt 0.5882 0.2647 +vt 0.5882 0.1765 +vt 0.7353 0.1765 +vt 0.4118 0.2647 +vt 0.5882 0 +vt 0.1176 0 +vt 0.4118 0.1176 +vt 0.5882 0.1765 +vt 0.1176 0.1765 +vt 0.5882 0.1176 +vt 0.2647 0 +vt 0.4118 0 +vt 0.4118 0.2647 +vt 0.2647 0.1765 +vt 0.4118 0.1765 +vt 0.5882 0.2647 +vn 0 0 1 +vn -1 0 0 +vn 0 -1 0 +vn 0 0 1 +vn -1 0 0 +vn 0 1 0 +vn 0 0 -1 +vn -1 0 0 +vn 0 -1 0 +vn 0 0 -1 +vn -1 0 0 +vn 0 1 0 +vn 0 0 1 +vn 1 0 0 +vn 0 -1 0 +vn 0 0 1 +vn 1 0 0 +vn 0 1 0 +vn 1 0 0 +vn 0 0 -1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 -1 +vn 0 1 0 +f 33/97/97 37/109/109 38/112/112 34/100/100 +f 37/110/110 39/115/115 40/118/118 38/113/113 +f 39/116/116 35/103/103 36/106/106 40/119/119 +f 35/104/104 33/98/98 34/101/101 36/107/107 +f 35/105/105 39/117/117 37/111/111 33/99/99 +f 38/114/114 40/120/120 36/108/108 34/102/102 +o object_6 +usemtl New material 002 +v 0.4706 0.1176 0.9118 +v 0.4706 0.1765 0.9118 +v 0.4706 0.1176 0.8824 +v 0.4706 0.1765 0.8824 +v 0.5294 0.1176 0.9118 +v 0.5294 0.1765 0.9118 +v 0.5294 0.1176 0.8824 +v 0.5294 0.1765 0.8824 +vt 0.5294 0.0882 +vt 0.9118 0.1176 +vt 0.4706 0.1176 +vt 0.4706 0.0882 +vt 0.9118 0.1765 +vt 0.4706 0.1765 +vt 0.5294 0.1176 +vt 0.8824 0.1176 +vt 0.5294 0.1176 +vt 0.4706 0.1176 +vt 0.8824 0.1765 +vt 0.5294 0.1765 +vt 0.4706 0.0882 +vt 0.0882 0.1176 +vt 0.5294 0.1176 +vt 0.0882 0.1765 +vt 0.5294 0.0882 +vt 0.5294 0.1765 +vt 0.4706 0.1176 +vt 0.1176 0.1176 +vt 0.4706 0.1176 +vt 0.1176 0.1765 +vt 0.5294 0.1176 +vt 0.4706 0.1765 +vn 0 -1 0 +vn -1 0 0 +vn 0 0 1 +vn 0 1 0 +vn -1 0 0 +vn 0 0 1 +vn 0 -1 0 +vn -1 0 0 +vn 0 0 -1 +vn 0 1 0 +vn -1 0 0 +vn 0 0 -1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 1 +vn 1 0 0 +vn 0 1 0 +vn 0 0 1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 -1 +vn 1 0 0 +vn 0 1 0 +vn 0 0 -1 +f 43/127/127 47/139/139 45/133/133 41/121/121 +f 47/140/140 48/142/142 46/136/136 45/134/134 +f 48/143/143 44/130/130 42/124/124 46/137/137 +f 44/131/131 43/128/128 41/122/122 42/125/125 +f 44/132/132 48/144/144 47/141/141 43/129/129 +f 45/135/135 46/138/138 42/126/126 41/123/123 +o object_7 +usemtl New material 003 +v 0.5882 0.2736 0.8347 +v 0.5882 0.3912 0.8347 +v 0.5882 0.2736 0.8053 +v 0.5882 0.3912 0.8053 +v 0.7059 0.2736 0.8347 +v 0.7059 0.3912 0.8347 +v 0.7059 0.2736 0.8053 +v 0.7059 0.3912 0.8053 +vt 0.4118 0.1653 +vt 0.8347 0.2736 +vt 0.5882 0.2736 +vt 0.5882 0.1653 +vt 0.8347 0.3912 +vt 0.5882 0.3912 +vt 0.4118 0.1947 +vt 0.8053 0.2736 +vt 0.4118 0.2736 +vt 0.5882 0.1947 +vt 0.8053 0.3912 +vt 0.4118 0.3912 +vt 0.2941 0.1653 +vt 0.1653 0.2736 +vt 0.7059 0.2736 +vt 0.1653 0.3912 +vt 0.7059 0.1653 +vt 0.7059 0.3912 +vt 0.2941 0.1947 +vt 0.1947 0.2736 +vt 0.2941 0.2736 +vt 0.1947 0.3912 +vt 0.7059 0.1947 +vt 0.2941 0.3912 +vn 0 -1 0 +vn -1 0 0 +vn 0 0 1 +vn 0 1 0 +vn -1 0 0 +vn 0 0 1 +vn 0 -1 0 +vn -1 0 0 +vn 0 0 -1 +vn 0 1 0 +vn -1 0 0 +vn 0 0 -1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 1 +vn 1 0 0 +vn 0 1 0 +vn 0 0 1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 -1 +vn 1 0 0 +vn 0 1 0 +vn 0 0 -1 +f 51/151/151 55/163/163 53/157/157 49/145/145 +f 55/164/164 56/166/166 54/160/160 53/158/158 +f 56/167/167 52/154/154 50/148/148 54/161/161 +f 52/155/155 51/152/152 49/146/146 50/149/149 +f 52/156/156 56/168/168 55/165/165 51/153/153 +f 53/159/159 54/162/162 50/150/150 49/147/147 +o object_8 +usemtl New material 003 +v 0.2941 0.2736 0.8347 +v 0.2941 0.3912 0.8347 +v 0.2941 0.2736 0.8053 +v 0.2941 0.3912 0.8053 +v 0.4118 0.2736 0.8347 +v 0.4118 0.3912 0.8347 +v 0.4118 0.2736 0.8053 +v 0.4118 0.3912 0.8053 +vt 0.7059 0.1653 +vt 0.8347 0.2736 +vt 0.2941 0.2736 +vt 0.2941 0.1653 +vt 0.8347 0.3912 +vt 0.2941 0.3912 +vt 0.7059 0.1947 +vt 0.8053 0.2736 +vt 0.7059 0.2736 +vt 0.2941 0.1947 +vt 0.8053 0.3912 +vt 0.7059 0.3912 +vt 0.5882 0.1653 +vt 0.1653 0.2736 +vt 0.4118 0.2736 +vt 0.1653 0.3912 +vt 0.4118 0.1653 +vt 0.4118 0.3912 +vt 0.5882 0.1947 +vt 0.1947 0.2736 +vt 0.5882 0.2736 +vt 0.1947 0.3912 +vt 0.4118 0.1947 +vt 0.5882 0.3912 +vn 0 -1 0 +vn -1 0 0 +vn 0 0 1 +vn 0 1 0 +vn -1 0 0 +vn 0 0 1 +vn 0 -1 0 +vn -1 0 0 +vn 0 0 -1 +vn 0 1 0 +vn -1 0 0 +vn 0 0 -1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 1 +vn 1 0 0 +vn 0 1 0 +vn 0 0 1 +vn 0 -1 0 +vn 1 0 0 +vn 0 0 -1 +vn 1 0 0 +vn 0 1 0 +vn 0 0 -1 +f 59/175/175 63/187/187 61/181/181 57/169/169 +f 63/188/188 64/190/190 62/184/184 61/182/182 +f 64/191/191 60/178/178 58/172/172 62/185/185 +f 60/179/179 59/176/176 57/170/170 58/173/173 +f 60/180/180 64/192/192 63/189/189 59/177/177 +f 61/183/183 62/186/186 58/174/174 57/171/171 +o object_9 +usemtl New material 001 (1) +v 0.02313 0.6963 0.4272 +v 0.02313 0.4159 0.2973 +v 0.1395 0.7225 0.3699 +v 0.1395 0.4425 0.24 +v 0.1704 0.5819 0.6734 +v 0.1704 0.3018 0.5435 +v 0.2868 0.6084 0.6162 +v 0.2868 0.3283 0.4863 +vt 0.9769 0.6963 +vt 0.4272 0.6963 +vt 0.02313 0.5728 +vt 0.9769 0.4159 +vt 0.2973 0.4159 +vt 0.9769 0.7027 +vt 0.6301 0.7225 +vt 0.8605 0.7225 +vt 0.1395 0.6301 +vt 0.76 0.4425 +vt 0.8605 0.4425 +vt 0.8605 0.76 +vt 0.6734 0.5819 +vt 0.1704 0.5819 +vt 0.1704 0.3266 +vt 0.5435 0.3018 +vt 0.1704 0.3018 +vt 0.8296 0.4565 +vt 0.3838 0.6084 +vt 0.2868 0.6084 +vt 0.2868 0.3838 +vt 0.5137 0.3283 +vt 0.2868 0.3283 +vt 0.7132 0.5137 +vn -0.4768 0.3698 -0.7974 +vn -0.879 -0.2006 0.4325 +vn 0 0.9072 0.4207 +vn -0.4768 0.3698 -0.7974 +vn -0.879 -0.2006 0.4325 +vn 0 -0.9072 -0.4207 +vn 0.879 0.2006 -0.4325 +vn -0.4768 0.3698 -0.7974 +vn 0 0.9072 0.4207 +vn 0.879 0.2006 -0.4325 +vn -0.4768 0.3698 -0.7974 +vn 0 -0.9072 -0.4207 +vn -0.879 -0.2006 0.4325 +vn 0.4768 -0.3698 0.7974 +vn 0 0.9072 0.4207 +vn -0.879 -0.2006 0.4325 +vn 0.4768 -0.3698 0.7974 +vn 0 -0.9072 -0.4207 +vn 0.879 0.2006 -0.4325 +vn 0.4768 -0.3698 0.7974 +vn 0 0.9072 0.4207 +vn 0.879 0.2006 -0.4325 +vn 0.4768 -0.3698 0.7974 +vn 0 -0.9072 -0.4207 +f 72/214/214 68/202/202 67/199/199 71/211/211 +f 68/203/203 66/196/196 65/193/193 67/200/200 +f 66/197/197 70/208/208 69/205/205 65/194/194 +f 70/209/209 72/215/215 71/212/212 69/206/206 +f 66/198/198 68/204/204 72/216/216 70/210/210 +f 71/213/213 67/201/201 65/195/195 69/207/207